import { type ReactNode, type Ref } from "react"; import { type ObjRef, type SortDirection } from "@gooddata/sdk-model"; import { type IAccessibilityConfigBase } from "../../typings/accessibility.js"; import { type IconType } from "../@types/icon.js"; import { type ThemeColor } from "../@types/themeColors.js"; /** * Variant for UiAsyncTable component. * - "regular": Standard table size for full pages * - "small": Compact table size for embedding in modals/dialogs * * @internal */ export type UiAsyncTableVariant = "regular" | "small"; /** * @internal */ export interface IUiAsyncTableAccessibilityConfig { getCheckboxItemAriaLabel?: (item: T) => string; checkboxAllAriaLabel?: string; searchAriaLabel?: string; gridAriaLabel?: string; } /** * @internal */ export interface IUiAsyncTableColumnAccessibilityConfig { ariaLabel?: string; } /** * @internal */ export interface IUiAsyncTableProps { items: T[]; totalItemsCount?: number; columns: Array>; onItemClick?: (item: T) => void; /** * Whether the row reacts to `onItemClick` by mouse or keyboard. Default: every row does. * A non-clickable row has no pointer cursor; its menu and checkbox still work. */ isItemClickable?: (item: T) => boolean; /** * Tooltip shown over the whole row on hover, and while the row is active during keyboard navigation * (Escape dismisses it), e.g. to explain why it can't be opened. * Default: no tooltip. Not applied to rows drawn by a custom `renderItem`. */ getItemTooltip?: (item: T) => string | undefined; scrollToIndex?: number; width?: number; maxHeight?: number; variant?: UiAsyncTableVariant; isMobileView?: boolean; skeletonItemsCount?: number; isLoading?: boolean; hasNextPage?: boolean; loadNextPage?: () => void; filters?: Array; isFiltersTooLarge?: boolean; sortBy?: keyof T; sortDirection?: SortDirection; onSort?: (key: keyof T) => void; allowSearch?: boolean; searchPlaceholder?: string; onSearch?: (search: string) => void; renderToolbarCustomElement?: () => ReactNode; bulkActions?: Array; selectedItemIds?: Array; setSelectedItemIds?: (items: Array) => void; renderItem?: (item: T) => ReactNode; renderHeader?: () => ReactNode; renderEmptyState?: () => ReactNode; hideHeader?: boolean; locale?: string; accessibilityConfig?: IUiAsyncTableAccessibilityConfig; } /** * @internal */ export type UiAsyncTableMenuRenderer = (item: T, closeDropdown: () => void) => ReactNode; /** * @internal */ export interface IUiAsyncTableColumn { key?: keyof T; label?: string; width?: number; renderMenu?: UiAsyncTableMenuRenderer; renderButton?: (item: T) => ReactNode; renderRoleIcon?: (item: T) => ReactNode; renderPrefixIcon?: (item: T) => ReactNode; renderSuffixIcon?: (item: T) => ReactNode; renderBadge?: (item: T) => ReactNode; getMultiLineTextContent?: (item: T) => Array; getTextContent?: (item: T) => string | ReactNode; getTextTitle?: (item: T) => string; getTextHref?: (item: T) => string | undefined; textColor?: ThemeColor; bold?: boolean; /** * Whether the item is shown locked, with a lock icon before its text; for multi-line content, before its first line. */ isLocked?: (item: T) => boolean; sortable?: boolean; /** * Text of a tooltip on the column header. It opens on hover and when keyboard navigation reaches the header. */ headerTooltip?: string; align?: "left" | "center" | "right"; getAccessibilityConfig?: (item: T) => IUiAsyncTableColumnAccessibilityConfig; } /** * @internal */ export interface IUiAsyncTableColumnDefinitionResponsive extends IUiAsyncTableColumn { minWidth?: number; } /** * @internal */ export interface IUiAsyncTableFilter { label: string; options: Array; onItemsSelect: (options: Array) => void; selected?: Array; isMultiSelect?: boolean; } /** * @internal */ export interface IUiAsyncTableFilterOption { value: string; label?: string; secondaryLabel?: string; } /** * @internal */ export interface IUiAsyncTableBulkAction { label: string; onClick: () => void; accessibilityConfig?: IAccessibilityConfigBase; } /** * @internal */ export interface IUiAsyncTableTitleProps { title: string; renderIcon?: () => ReactNode; onSearch?: (search: string) => void; actions: Array; scrollToStart: () => void; } /** * @internal */ export interface IUiAsyncTableTitleAction { renderAction: () => ReactNode; } export interface IUiAsyncTableHeaderProps { columns: Array>; handleColumnClick: (key?: keyof T) => void; sortBy?: keyof T; sortDirection?: SortDirection; hasCheckbox?: boolean; width?: number; small?: boolean; largeRow?: boolean; } /** * @internal */ export interface IUiAsyncTableFilterProps extends IUiAsyncTableFilter { isFiltersTooLarge?: boolean; variant?: UiAsyncTableVariant; isMobileView?: boolean; width?: number; /** * When provided, the chip shows a delete button. Clicking it calls this callback * (typically used to reset the filter to "All" state). */ onChipReset?: () => void; } export interface IUiAsyncTableRowProps { tableId: string; item: T; itemIndex: number; columns: Array>; onSelect?: (item: T) => void; onClick?: (item: T) => void; hasCheckbox?: boolean; isLarge?: boolean; isSelected?: boolean; isFocused?: boolean; focusedColumnIndex?: number; focusedElementRef?: Ref; accessibilityConfig?: IUiAsyncTableAccessibilityConfig; tooltip?: string; /** Opens the tooltip for keyboard navigation; hover opens it on its own. */ isTooltipOpen?: boolean; } export type UiAsyncTableCheckboxProps = { onChange?: () => void; checked?: boolean; indeterminate?: boolean; disabled?: boolean; ariaLabel?: string; header?: boolean; isCellFocused?: boolean; cellRef?: Ref; cellId?: string; }; export interface IUiAsyncTableToolbarProps { filters?: Array; allowSearch?: boolean; isFiltersTooLarge?: boolean; bulkActions?: Array; selectedItemIds?: Array; setSelectedItemIds: (items: Array) => void; totalItemsCount: number; items: Array; variant?: UiAsyncTableVariant; isMobileView?: boolean; width?: number; searchPlaceholder?: string; onSearch?: (search: string) => void; renderToolbarCustomElement?: () => ReactNode; accessibilityConfig?: IUiAsyncTableAccessibilityConfig; } export type UiAsyncTableDropdownItemProps = { label: string; secondaryLabel?: string; onClick: () => void; isSelected?: boolean; isMultiSelect?: boolean; isUnderlined?: boolean; accessibilityConfig?: IAccessibilityConfigBase; }; export interface IUiAsyncTableBulkActionsProps { bulkActions: Array; } export interface IUiAsyncTableIconRendererProps { renderIcon?: (item: T) => ReactNode; className: string; item: T; } export interface IUiAsyncTableBodyProps { tableId: string; hasDefaultRows: boolean; items: T[]; maxHeight: number; itemHeight: number; skeletonItemsCount: number; hasNextPage?: boolean; isLoading?: boolean; onItemClick?: (item: T) => void; loadNextPage?: () => void; columns: Array>; bulkActions?: Array; scrollToIndex?: number; isLargeRow?: boolean; shouldLoadNextPage?: (lastItemIndex: number, itemsCount: number) => boolean; getItemTooltip?: (item: T) => string | undefined; renderItem: (item: T, itemIndex: number, focusedItemRef: Ref, isFocused: boolean, focusedColumnIndex: number | undefined, isTooltipOpen: boolean) => ReactNode; } /** * @internal */ export interface IUiAsyncTableEmptyStateProps { title?: string; description?: string; icon?: IconType; } //# sourceMappingURL=types.d.ts.map