UNPKG

@carbon/react

Version:

React components for the Carbon Design System

52 lines (51 loc) 2.19 kB
/** * Copyright IBM Corp. 2016, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import React, { type MouseEventHandler } from 'react'; import type { TranslateWithId } from '../../types/common'; declare const TableBatchActionsTranslationKeys: readonly ["carbon.table.batch.cancel", "carbon.table.batch.items.selected", "carbon.table.batch.item.selected", "carbon.table.batch.selectAll"]; export type TableBatchActionsTranslationKey = (typeof TableBatchActionsTranslationKeys)[number]; export interface TableBatchActionsTranslationArgs { totalSelected?: number; totalCount?: number; } export interface TableBatchActionsProps extends React.HTMLAttributes<HTMLDivElement>, TranslateWithId<TableBatchActionsTranslationKey, TableBatchActionsTranslationArgs> { /** * Provide elements to be rendered inside of the component. */ children?: React.ReactNode; /** * Hook required to listen for when the user initiates a cancel request * through this component. */ onCancel: MouseEventHandler<HTMLButtonElement>; /** * Hook to listen for when the user initiates a select all * request through this component. This _only_ controls the rendering * of the `Select All` button and does not include built in functionality */ onSelectAll?: MouseEventHandler<HTMLButtonElement>; /** * Boolean specifier for whether or not the batch action bar should be * displayed. */ shouldShowBatchActions?: boolean; /** * Numeric representation of the total number of items selected in a table. * This number is used to derive the selection message. */ totalSelected: number; /** * Numeric representation of the total number of items in a table. * This number is used in the select all button text */ totalCount?: number; } export interface TableBatchActionsComponent extends React.FC<TableBatchActionsProps> { translationKeys: ReadonlyArray<TableBatchActionsTranslationKey>; } declare const TableBatchActions: TableBatchActionsComponent; export default TableBatchActions;