/*! * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") * * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and limitations under the License. */ import { MRT_DensityState, MRT_RowData, MRT_RowSelectionState, MRT_SortingState, MRT_TableOptions, MRT_VisibilityState } from "material-react-table"; import { ReactNode } from "react"; import { MenuButtonProps } from "../../Buttons/MenuButton.js"; import { type PaginationProps } from "../../Pagination/Pagination.js"; import { DataFilter } from "../DataFilters.js"; import { paginationTypeValues } from "../DataTablePagination.js"; import { availableCardLayouts, availableLayouts } from "./constants.js"; import { DataCardProps } from "./DataCard.js"; import { DataColumnVisibilityState, DataGetDataType, DataOnReorderRowsType, DataRowSelectionState, DataTableColumn, GetRowId } from "./dataTypes.js"; import { RowActionsProps } from "./RowActions.js"; export type DataLayout = (typeof availableLayouts)[number]; export type CardLayout = (typeof availableCardLayouts)[number]; export type AvailableLayouts = DataLayout[]; export type AvailableCardLayouts = CardLayout[]; export type UniversalProps = { additionalActionButton?: ReactNode; additionalActionMenuItems?: ReactNode; bulkActionMenuItems?: (selectedRows: MRT_RowSelectionState) => MenuButtonProps["children"]; currentPage?: number; emptyPlaceholder?: ReactNode; enableVirtualization?: boolean; errorMessage?: string; filters?: Array | string>; getData: ({ page, resultsPerPage, search, filters, sort, }: DataGetDataType) => TData[] | Promise; getRowId?: GetRowId; hasFilters?: boolean; hasPagination?: boolean; hasRowReordering?: boolean; hasRowSelection?: boolean; hasSearch?: boolean; hasSearchSubmitButton?: boolean; /** * Seeds the selected rows on initial mount (uncontrolled). Keys must match the ids produced by `getRowId`. Ignored once the user changes the selection, and ignored entirely when the controlled `rowSelection` prop is provided. */ initialRowSelection?: DataRowSelectionState; isEmpty?: boolean; isLoading?: boolean; isNoResults?: boolean; isPaginationMoreDisabled?: boolean; isRowReorderingDisabled?: boolean; /** * Returns `true` for any row whose selection should be disabled. The row still renders, but its selection checkbox is non-interactive and the bulk "Select all" action skips it. Only applies when `hasRowSelection` is `true`. */ isRowSelectionDisabled?: (row: TData) => boolean; maxPages?: number; maxResultsPerPage?: number; metaText?: string; noResultsPlaceholder?: ReactNode; /** * @deprecated onChangeRowSelection is now onRowSelectionChange */ onChangeRowSelection?: (rowSelection: DataRowSelectionState) => void; onColumnVisibilityChange?: (columnVisibility: DataColumnVisibilityState) => void; onPaginationChange?: ({ pageIndex, pageSize, }: { pageIndex: number; pageSize: number; }) => void; onReorderRows?: ({ rowId, newRowIndex }: DataOnReorderRowsType) => void; onRowSelectionChange?: (rowSelection: DataRowSelectionState) => void; paginationType?: (typeof paginationTypeValues)[number]; resultsPerPage?: number; /** * Controlled selected-rows state. When provided, DataView no longer owns the selection — pair with `onRowSelectionChange` to update it. Keys must match the ids produced by `getRowId`. */ rowSelection?: DataRowSelectionState; searchDelayTime?: number; searchFieldLabel?: string; totalRows?: number; } & Pick; export type TableLayoutProps = { columns: DataTableColumn[]; hasChangeableDensity?: boolean; hasColumnResizing?: boolean; hasColumnVisibility?: boolean; hasSorting?: boolean; initialColumnVisibility?: DataColumnVisibilityState; initialDensity?: MRT_DensityState; /** * Seeds the sort order on initial mount (uncontrolled). Each entry is a column id and a direction. Ignored once the user changes the sort, and only meaningful when `hasSorting` is `true`. * @default [] */ initialSorting?: MRT_SortingState; renderDetailPanel?: MRT_TableOptions["renderDetailPanel"]; rowActionButtons?: RowActionsProps["rowActionButtons"]; rowActionMenuItems?: RowActionsProps["rowActionMenuItems"]; }; export type CardLayoutProps = { itemProps: (row: TData) => DataCardProps; maxGridColumns?: number; renderDetailPanel?: (props: { row: TData; }) => ReactNode; rowActionMenuItems?: RowActionsProps["rowActionMenuItems"]; }; export type ViewProps = { availableLayouts?: L[]; cardLayoutOptions?: CardLayoutProps; initialLayout?: L; tableLayoutOptions?: TableLayoutProps; }; export type TableState = { columnSorting: MRT_SortingState; columnVisibility: MRT_VisibilityState; rowDensity?: MRT_DensityState; }; //# sourceMappingURL=componentTypes.d.ts.map