UNPKG

@carbon/react

Version:

React components for the Carbon Design System

91 lines (90 loc) 3.78 kB
/** * Copyright IBM Corp. 2016, 2025 * * 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 PropTypes from 'prop-types'; import React, { type MouseEventHandler } from 'react'; import type { TranslateWithId } from '../../types/common'; declare const translationIds: { readonly 'carbon.table.batch.cancel': "carbon.table.batch.cancel"; readonly 'carbon.table.batch.items.selected': "carbon.table.batch.items.selected"; readonly 'carbon.table.batch.item.selected': "carbon.table.batch.item.selected"; readonly 'carbon.table.batch.selectAll': "carbon.table.batch.selectAll"; }; type TranslationKey = keyof typeof translationIds; export type TableBatchActionsTranslationArgs = { totalSelected?: number; totalCount?: number; }; export interface TableBatchActionsProps extends React.HTMLAttributes<HTMLDivElement>, TranslateWithId<TranslationKey, 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; } declare const TableBatchActions: { ({ className, children, shouldShowBatchActions, totalSelected, totalCount, onCancel, onSelectAll, translateWithId: t, ...rest }: TableBatchActionsProps): import("react/jsx-runtime").JSX.Element; propTypes: { children: PropTypes.Requireable<PropTypes.ReactNodeLike>; className: PropTypes.Requireable<string>; /** * Hook required to listen for when the user initiates a cancel request * through this component */ onCancel: PropTypes.Validator<(...args: any[]) => any>; /** * 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: PropTypes.Requireable<(...args: any[]) => any>; /** * Boolean specifier for whether or not the batch action bar should be * displayed */ shouldShowBatchActions: PropTypes.Requireable<boolean>; /** * Numeric representation of the total number of items in a table. * This number is used in the select all button text */ totalCount: PropTypes.Requireable<number>; /** * Numeric representation of the total number of items selected in a table. * This number is used to derive the selection message */ totalSelected: PropTypes.Validator<number>; /** * Translates component strings using your i18n tool. */ translateWithId: PropTypes.Requireable<(...args: any[]) => any>; }; }; export default TableBatchActions;