UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

135 lines (134 loc) 7.93 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 Cell, type CellContext, type Header as HeaderType, type Row, type RowData, type SortDirection } from '@tanstack/react-table'; import type React from 'react'; import { Menu } from '../context-menu'; import { IconButton } from '../icon-button'; import { type ColumnAction } from './datagrid-types'; import NoDataIllustration from './illustrations/NoData'; type MenuItemProps = React.ComponentProps<typeof Menu.Item>; export declare const DEFAULT_SORT_ACTIONS: (cell: HeaderType<any, unknown>) => { [key in SortDirection | 'default']: ColumnAction; }; export interface CommonInnerProps<T = HTMLDivElement> { /** Children are surfaced to allow easy overriding */ children?: React.ReactNode; innerProps?: { className?: string; style?: React.CSSProperties; onClick?: (e: React.MouseEvent<T, MouseEvent>) => void; htmlAttributes?: React.HTMLAttributes<T>; }; } export interface ResizingBarProps<T extends RowData> extends CommonInnerProps<HTMLButtonElement> { header: HeaderType<T, unknown>; } declare const ResizingBar: <T extends RowData>({ header, children, innerProps, }: ResizingBarProps<T>) => import("react/jsx-runtime").JSX.Element; declare const Scrollable: ({ children, innerProps }: CommonInnerProps) => React.JSX.Element; declare const Header: ({ children, innerProps }: CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element; export interface ActionButtonProps { action: ColumnAction; children?: React.ReactNode; innerProps?: MenuItemProps; /** Callback provided to close the context menu */ onClose: () => void; } export declare const ActionButton: ({ action, children, onClose, innerProps, }: ActionButtonProps) => import("react/jsx-runtime").JSX.Element; export interface RowActionCellProps<T extends RowData> { cell?: CellContext<T, unknown>; innerIconButtonProps?: Partial<React.ComponentPropsWithoutRef<typeof IconButton>>; innerMenuProps?: Partial<React.ComponentProps<typeof Menu>>; } declare const RowActionCell: <T extends RowData>({ cell, innerIconButtonProps, innerMenuProps, }: RowActionCellProps<T>) => import("react/jsx-runtime").JSX.Element | null; export interface ColumnControlsProps<T extends RowData> extends CommonInnerProps<HTMLDivElement> { cell: HeaderType<T, unknown>; } export declare const ColumnControls: <T extends RowData>({ cell, children, innerProps, }: ColumnControlsProps<T>) => import("react/jsx-runtime").JSX.Element | null; export interface HeaderCellProps<T> extends CommonInnerProps<HTMLDivElement> { cell: HeaderType<T, unknown>; } declare const HeaderCell: <T extends RowData>({ cell, children, innerProps, }: HeaderCellProps<T>) => import("react/jsx-runtime").JSX.Element; export interface HeaderTitleProps<T> extends CommonInnerProps<HTMLDivElement> { cell: HeaderType<T, unknown>; } declare const HeaderTitle: <T extends RowData>({ cell, children, innerProps, }: HeaderTitleProps<T>) => import("react/jsx-runtime").JSX.Element; declare const Body: ({ children, innerProps }: CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element; export interface BodyCellProps<T extends RowData> extends CommonInnerProps<HTMLDivElement> { cell: Cell<T, unknown>; } declare const BodyCell: <T extends RowData>({ cell, children, innerProps, }: BodyCellProps<T>) => import("react/jsx-runtime").JSX.Element; export interface BodyRowProps<T extends RowData> extends CommonInnerProps<HTMLDivElement> { row: Row<T>; } declare const BodyRow: <T extends RowData>({ row, children, innerProps, }: BodyRowProps<T>) => import("react/jsx-runtime").JSX.Element; export interface TableResultProps extends CommonInnerProps<HTMLSpanElement> { manualPagination?: { from: number; to: number; totalRows: number; }; } declare const TableResults: ({ children, innerProps, manualPagination, }: TableResultProps) => import("react/jsx-runtime").JSX.Element; export interface RowsPerPageProps extends CommonInnerProps<HTMLDivElement> { /** * The target element to portal the menu of the select component to. * Should be document.body normally, or the modal root if the select is inside a modal. */ menuPortalTarget?: HTMLElement | null; } declare const RowsPerPage: ({ children, innerProps, menuPortalTarget: menuPortalTargetProp, }: RowsPerPageProps) => import("react/jsx-runtime").JSX.Element; export interface PaginationArrowButtonProps extends CommonInnerProps<HTMLButtonElement> { action: 'previous' | 'next'; } declare const PaginationArrowButton: ({ action, children, innerProps, }: PaginationArrowButtonProps) => import("react/jsx-runtime").JSX.Element; export interface PaginationNumericButtonProps extends CommonInnerProps<HTMLButtonElement> { currentIndex: number | string; isSelected: boolean; } declare const PaginationNumericButton: ({ currentIndex, isSelected, children, innerProps, }: PaginationNumericButtonProps) => import("react/jsx-runtime").JSX.Element; declare const PaginationNumericButtons: () => import("react/jsx-runtime").JSX.Element; declare const Pagination: ({ children, innerProps, }: CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element; declare const Navigation: ({ children, innerProps, }: CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element; declare const LoadingPlaceholder: ({ children, innerProps, }: CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element; declare const NoDataPlaceholder: ({ children, innerProps, }: CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element; export declare const NoDataPlaceholderContentWrapper: ({ children, innerProps, }: CommonInnerProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element; export interface InlineEditCellProps<T extends RowData> { cell: CellContext<T, unknown>; value: string; ariaLabel?: string; } declare const InlineEditCell: <T extends RowData>({ cell, value, ariaLabel, }: InlineEditCellProps<T>) => import("react/jsx-runtime").JSX.Element | null; export interface DropDownCellProps<T extends RowData> { cell: CellContext<T, unknown>; options: { value: string; label: string; }[]; /** * The target element to portal the menu of the select component to, e.g. the modal root if the data grid is inside a modal. * @defaultValue document.body */ portalTarget?: HTMLElement | null; ariaLabel?: string; } declare const DropDownCell: <T extends RowData>({ cell, options, portalTarget: portalTargetProp, ariaLabel, }: DropDownCellProps<T>) => import("react/jsx-runtime").JSX.Element | null; declare const NoDataIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>; export { ResizingBar, Header, Body, BodyCell, BodyRow, InlineEditCell, DropDownCell, RowActionCell, HeaderCell, HeaderTitle, Navigation, TableResults, RowsPerPage, Pagination, PaginationNumericButtons, PaginationArrowButton, PaginationNumericButton, NoDataPlaceholder, NoDataIllustration, NoDataIcon, LoadingPlaceholder, Scrollable, };