@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
169 lines (168 loc) • 9.73 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 Cell, type CellContext, type Header as HeaderType, type Row, type RowData, type SortDirection } from '@tanstack/react-table';
import type React from 'react';
import { type CommonProps, type PolymorphicCommonProps } from '../_common/types';
import { CleanIconButton } from '../clean-icon-button';
import { DataGridCrossIcon } from '../icons';
import { Menu } from '../menu';
import { type ColumnAction } from './datagrid-types';
export declare const DEFAULT_SORT_ACTIONS: (cell: HeaderType<any, unknown>) => {
[key in SortDirection | 'default']: ColumnAction;
};
type ResizingBarProps<T extends RowData> = {
header: HeaderType<T, unknown>;
};
declare const ResizingBar: <T extends RowData>({ header, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"button", ResizingBarProps<T>>) => import("react/jsx-runtime").JSX.Element;
type ScrollableProps = {
children?: React.ReactNode;
};
declare const Scrollable: ({ children, ref, className, style, htmlAttributes, ...restProps }: CommonProps<"div", ScrollableProps> & {
ref: React.RefObject<HTMLDivElement | null>;
}) => import("react/jsx-runtime").JSX.Element;
type HeaderProps = {
children?: React.ReactNode;
};
declare const Header: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", HeaderProps>) => import("react/jsx-runtime").JSX.Element;
type ActionButtonProps = {
action: ColumnAction;
onClose: () => void;
};
export declare const ActionButton: <T extends React.ElementType = "button">({ action, onClose, as, className, style, htmlAttributes, ref, ...restProps }: PolymorphicCommonProps<T, ActionButtonProps>) => import("react/jsx-runtime").JSX.Element;
export interface ActionCellProps<T extends RowData> {
cell?: CellContext<T, unknown>;
innerCleanIconButtonProps?: Partial<React.ComponentPropsWithoutRef<typeof CleanIconButton>>;
innerMenuProps?: Partial<React.ComponentProps<typeof Menu>>;
}
declare const ActionCell: <T extends RowData>({ cell, innerCleanIconButtonProps, innerMenuProps, }: ActionCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
type ColumnControlsProps<T extends RowData> = {
cell: HeaderType<T, unknown>;
children?: React.ReactNode;
};
export declare const ColumnControls: <T extends RowData>({ cell, children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", ColumnControlsProps<T>>) => import("react/jsx-runtime").JSX.Element | null;
type HeaderCellProps<T> = {
cell: HeaderType<T, unknown>;
children?: React.ReactNode;
};
declare const HeaderCell: <T extends RowData>({ cell, children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", HeaderCellProps<T>>) => import("react/jsx-runtime").JSX.Element;
type HeaderTitleProps<T> = {
cell: HeaderType<T, unknown>;
children?: React.ReactNode;
};
declare const HeaderTitle: <T extends RowData>({ cell, children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", HeaderTitleProps<T>>) => import("react/jsx-runtime").JSX.Element;
type BodyProps = {
children?: React.ReactNode;
};
declare const Body: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", BodyProps>) => import("react/jsx-runtime").JSX.Element;
type BodyCellProps<T extends RowData> = {
cell: Cell<T, unknown>;
children?: React.ReactNode;
};
declare const BodyCell: <T extends RowData>({ cell, children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", BodyCellProps<T>>) => import("react/jsx-runtime").JSX.Element;
type BodyRowProps<T extends RowData> = {
row: Row<T>;
children?: React.ReactNode;
};
declare const BodyRow: <T extends RowData>({ row, children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", BodyRowProps<T>>) => import("react/jsx-runtime").JSX.Element;
type TableResultProps = {
manualPagination?: {
from: number;
to: number;
totalRows: number;
};
children?: React.ReactNode;
/**
* The label to use for the results, meaning the word "results" in the sentence "Showing X-Y of Z results".
* @defaultValue 'results'
*/
resultsLabel?: string;
};
declare const TableResults: ({ manualPagination, children, className, style, htmlAttributes, ref, resultsLabel, ...restProps }: CommonProps<"span", TableResultProps>) => import("react/jsx-runtime").JSX.Element | null;
type RowsPerPageProps = {
/**
* 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.
* Defaults to the portalTarget prop of the DataGrid root component.
*/
portalTarget?: HTMLElement | null;
children?: React.ReactNode;
};
declare const RowsPerPage: ({ portalTarget: portalTargetProp, children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", RowsPerPageProps>) => import("react/jsx-runtime").JSX.Element;
type PaginationArrowButtonProps = {
action: 'previous' | 'next';
children?: React.ReactNode;
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
};
declare const PaginationArrowButton: ({ action, children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"button", PaginationArrowButtonProps>) => import("react/jsx-runtime").JSX.Element;
type PaginationNumericButtonProps = {
currentIndex: number | string;
isSelected: boolean;
children?: React.ReactNode;
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
};
declare const PaginationNumericButton: ({ currentIndex, isSelected, children, className, style, htmlAttributes, onClick, ref, ...restProps }: CommonProps<"button", PaginationNumericButtonProps>) => import("react/jsx-runtime").JSX.Element;
declare const PaginationNumericButtons: () => import("react/jsx-runtime").JSX.Element;
type PaginationProps = {
children?: React.ReactNode;
};
declare const Pagination: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"nav", PaginationProps>) => import("react/jsx-runtime").JSX.Element;
type NavigationProps = {
children?: React.ReactNode;
};
declare const Navigation: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", NavigationProps>) => import("react/jsx-runtime").JSX.Element;
type LoadingPlaceholderProps = {
children?: React.ReactNode;
};
declare const LoadingPlaceholder: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", LoadingPlaceholderProps>) => import("react/jsx-runtime").JSX.Element;
type NoDataPlaceholderProps = {
children?: React.ReactNode;
};
declare const NoDataPlaceholder: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", NoDataPlaceholderProps>) => import("react/jsx-runtime").JSX.Element;
type NoDataPlaceholderContentWrapperProps = {
children?: React.ReactNode;
};
export declare const NoDataPlaceholderContentWrapper: ({ children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", NoDataPlaceholderContentWrapperProps>) => 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, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"input", InlineEditCellProps<T>>) => import("react/jsx-runtime").JSX.Element | null;
type 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.
* Defaults to the portalTarget prop of the DataGrid root component.
*/
portalTarget?: HTMLElement | null;
/** Aria label of the select component. Required for accessibility. */
ariaLabel: string;
/** Whether the select component is disabled */
isDisabled?: boolean;
};
declare const DropDownCell: <T extends RowData>({ cell, options, portalTarget: portalTargetProp, ariaLabel, className, style, htmlAttributes, ref: forwardRef, isDisabled, ...restProps }: CommonProps<"div", DropDownCellProps<T>>) => import("react/jsx-runtime").JSX.Element | null;
declare const NoDataIcon: ({ className, ...restProps }: React.ComponentPropsWithoutRef<typeof DataGridCrossIcon>) => import("react/jsx-runtime").JSX.Element;
export { ResizingBar, Header, Body, BodyCell, BodyRow, InlineEditCell, DropDownCell, ActionCell, HeaderCell, HeaderTitle, Navigation, TableResults, RowsPerPage, Pagination, PaginationNumericButtons, PaginationArrowButton, PaginationNumericButton, NoDataPlaceholder, NoDataIcon, LoadingPlaceholder, Scrollable, };
//# sourceMappingURL=Components.d.ts.map