{"version":3,"file":"componentTypes.cjs","names":[],"sources":["../../../../src/labs/DataView/componentTypes.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n  MRT_DensityState,\n  MRT_RowData,\n  MRT_RowSelectionState,\n  MRT_SortingState,\n  MRT_TableOptions,\n  MRT_VisibilityState,\n} from \"material-react-table\";\nimport { ReactNode } from \"react\";\n\nimport { MenuButtonProps } from \"../../Buttons/MenuButton.js\";\nimport { type PaginationProps } from \"../../Pagination/Pagination.js\";\nimport { DataFilter } from \"../DataFilters.js\";\nimport { paginationTypeValues } from \"../DataTablePagination.js\";\nimport { availableCardLayouts, availableLayouts } from \"./constants.js\";\nimport { DataCardProps } from \"./DataCard.js\";\nimport {\n  DataColumnVisibilityState,\n  DataGetDataType,\n  DataOnReorderRowsType,\n  DataRowSelectionState,\n  DataTableColumn,\n  GetRowId,\n} from \"./dataTypes.js\";\nimport { RowActionsProps } from \"./RowActions.js\";\n\nexport type DataLayout = (typeof availableLayouts)[number];\nexport type CardLayout = (typeof availableCardLayouts)[number];\n\nexport type AvailableLayouts = DataLayout[];\nexport type AvailableCardLayouts = CardLayout[];\n\nexport type UniversalProps<TData extends MRT_RowData> = {\n  additionalActionButton?: ReactNode;\n  additionalActionMenuItems?: ReactNode;\n  bulkActionMenuItems?: (\n    selectedRows: MRT_RowSelectionState,\n  ) => MenuButtonProps[\"children\"];\n  currentPage?: number;\n  emptyPlaceholder?: ReactNode;\n  enableVirtualization?: boolean;\n  errorMessage?: string;\n  filters?: Array<DataFilter | DataTableColumn<TData> | string>;\n  getData: ({\n    page,\n    resultsPerPage,\n    search,\n    filters,\n    sort,\n  }: DataGetDataType) => TData[] | Promise<TData[]>;\n  getRowId?: GetRowId<TData>;\n  hasFilters?: boolean;\n  hasPagination?: boolean;\n  hasRowReordering?: boolean;\n  hasRowSelection?: boolean;\n  hasSearch?: boolean;\n  hasSearchSubmitButton?: boolean;\n  /**\n   * 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.\n   */\n  initialRowSelection?: DataRowSelectionState;\n  isEmpty?: boolean;\n  isLoading?: boolean;\n  isNoResults?: boolean;\n  isPaginationMoreDisabled?: boolean;\n  isRowReorderingDisabled?: boolean;\n  /**\n   * 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`.\n   */\n  isRowSelectionDisabled?: (row: TData) => boolean;\n  maxPages?: number;\n  maxResultsPerPage?: number;\n  metaText?: string;\n  noResultsPlaceholder?: ReactNode;\n  /**\n   * @deprecated onChangeRowSelection is now onRowSelectionChange\n   */\n  onChangeRowSelection?: (rowSelection: DataRowSelectionState) => void;\n  onColumnVisibilityChange?: (\n    columnVisibility: DataColumnVisibilityState,\n  ) => void;\n  onPaginationChange?: ({\n    pageIndex,\n    pageSize,\n  }: {\n    pageIndex: number;\n    pageSize: number;\n  }) => void;\n  onReorderRows?: ({ rowId, newRowIndex }: DataOnReorderRowsType) => void;\n  onRowSelectionChange?: (rowSelection: DataRowSelectionState) => void;\n  paginationType?: (typeof paginationTypeValues)[number];\n  resultsPerPage?: number;\n  /**\n   * 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`.\n   */\n  rowSelection?: DataRowSelectionState;\n  searchDelayTime?: number;\n  searchFieldLabel?: string;\n  totalRows?: number;\n} & Pick<\n  PaginationProps,\n  \"hasPageInput\" | \"hasRowCountInput\" | \"hasRowCountLabel\"\n>;\n\nexport type TableLayoutProps<TData extends MRT_RowData> = {\n  columns: DataTableColumn<TData>[];\n  hasChangeableDensity?: boolean;\n  hasColumnResizing?: boolean;\n  hasColumnVisibility?: boolean;\n  hasSorting?: boolean;\n  initialColumnVisibility?: DataColumnVisibilityState;\n  initialDensity?: MRT_DensityState;\n  /**\n   * 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`.\n   * @default []\n   */\n  initialSorting?: MRT_SortingState;\n  renderDetailPanel?: MRT_TableOptions<TData>[\"renderDetailPanel\"];\n  rowActionButtons?: RowActionsProps<TData>[\"rowActionButtons\"];\n  rowActionMenuItems?: RowActionsProps<TData>[\"rowActionMenuItems\"];\n};\n\nexport type CardLayoutProps<TData extends MRT_RowData> = {\n  itemProps: (row: TData) => DataCardProps;\n  maxGridColumns?: number;\n  renderDetailPanel?: (props: { row: TData }) => ReactNode;\n  rowActionMenuItems?: RowActionsProps<TData>[\"rowActionMenuItems\"];\n};\n\nexport type ViewProps<TData extends MRT_RowData, L extends DataLayout> = {\n  availableLayouts?: L[];\n  cardLayoutOptions?: CardLayoutProps<TData>;\n  initialLayout?: L;\n  tableLayoutOptions?: TableLayoutProps<TData>;\n};\n\nexport type TableState = {\n  columnSorting: MRT_SortingState;\n  columnVisibility: MRT_VisibilityState;\n  rowDensity?: MRT_DensityState;\n};\n"],"mappings":"","ignoreList":[]}