@carbon/react 1.33.2 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/es/components/Button/Button.d.ts +1 -1
  2. package/es/components/ComposedModal/ComposedModal.js +13 -14
  3. package/es/components/DataTable/DataTable.d.ts +541 -0
  4. package/es/components/DataTable/DataTable.js +35 -14
  5. package/es/components/DataTable/index.d.ts +2 -2
  6. package/es/components/DataTable/state/sortStates.d.ts +13 -0
  7. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +17 -16
  8. package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  9. package/es/components/ExpandableSearch/ExpandableSearch.js +16 -8
  10. package/es/components/InlineCheckbox/InlineCheckbox.js +3 -2
  11. package/es/components/OverflowMenu/OverflowMenu.js +2 -2
  12. package/es/components/Search/Search.d.ts +2 -2
  13. package/es/components/Search/Search.js +25 -4
  14. package/es/components/Tabs/Tabs.js +2 -0
  15. package/es/components/Tag/Tag.js +9 -2
  16. package/es/components/TextArea/TextArea.js +1 -0
  17. package/es/components/Toggle/Toggle.d.ts +8 -8
  18. package/es/components/UIShell/HeaderMenuButton.d.ts +57 -0
  19. package/es/components/UIShell/HeaderMenuButton.js +4 -0
  20. package/es/components/UIShell/HeaderNavigation.d.ts +56 -0
  21. package/es/prop-types/isRequiredOneOf.js +2 -2
  22. package/lib/components/Button/Button.d.ts +1 -1
  23. package/lib/components/ComposedModal/ComposedModal.js +13 -14
  24. package/lib/components/DataTable/DataTable.d.ts +541 -0
  25. package/lib/components/DataTable/DataTable.js +39 -18
  26. package/lib/components/DataTable/index.d.ts +2 -2
  27. package/lib/components/DataTable/state/sortStates.d.ts +13 -0
  28. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +17 -16
  29. package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  30. package/lib/components/ExpandableSearch/ExpandableSearch.js +16 -8
  31. package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -2
  32. package/lib/components/OverflowMenu/OverflowMenu.js +2 -2
  33. package/lib/components/Search/Search.d.ts +2 -2
  34. package/lib/components/Search/Search.js +24 -3
  35. package/lib/components/Tabs/Tabs.js +2 -0
  36. package/lib/components/Tag/Tag.js +9 -2
  37. package/lib/components/TextArea/TextArea.js +1 -0
  38. package/lib/components/Toggle/Toggle.d.ts +8 -8
  39. package/lib/components/UIShell/HeaderMenuButton.d.ts +57 -0
  40. package/lib/components/UIShell/HeaderMenuButton.js +4 -0
  41. package/lib/components/UIShell/HeaderNavigation.d.ts +56 -0
  42. package/lib/prop-types/isRequiredOneOf.js +2 -2
  43. package/package.json +6 -6
@@ -0,0 +1,541 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ import type { DataTableSortState } from './state/sortStates';
10
+ import Table from './Table';
11
+ import TableActionList from './TableActionList';
12
+ import TableBatchAction from './TableBatchAction';
13
+ import TableBatchActions from './TableBatchActions';
14
+ import TableBody from './TableBody';
15
+ import TableCell from './TableCell';
16
+ import TableContainer from './TableContainer';
17
+ import TableExpandHeader from './TableExpandHeader';
18
+ import TableExpandRow from './TableExpandRow';
19
+ import TableExpandedRow from './TableExpandedRow';
20
+ import TableHead from './TableHead';
21
+ import TableHeader from './TableHeader';
22
+ import TableRow from './TableRow';
23
+ import TableSelectAll from './TableSelectAll';
24
+ import TableSelectRow from './TableSelectRow';
25
+ import TableToolbar from './TableToolbar';
26
+ import TableToolbarAction from './TableToolbarAction';
27
+ import TableToolbarContent from './TableToolbarContent';
28
+ import TableToolbarSearch from './TableToolbarSearch';
29
+ import TableToolbarMenu from './TableToolbarMenu';
30
+ declare const dataTableDefaultProps: {
31
+ filterRows: ({ rowIds, headers, cellsById, inputValue, getCellId, }: {
32
+ rowIds: string[];
33
+ headers: any[];
34
+ cellsById: any;
35
+ inputValue: string;
36
+ getCellId: Function;
37
+ }) => string[];
38
+ locale: string;
39
+ overflowMenuOnHover: boolean;
40
+ size: string;
41
+ sortRow: (cellA: any, cellB: any, { sortDirection, sortStates, locale }: {
42
+ sortDirection: any;
43
+ sortStates: any;
44
+ locale: any;
45
+ }) => number;
46
+ translateWithId: (id: any) => string;
47
+ };
48
+ export type DataTableSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
49
+ export interface DataTableCell {
50
+ id: string;
51
+ value: unknown;
52
+ isEditable: boolean;
53
+ isEditing: boolean;
54
+ isValid: boolean;
55
+ errors: null | Array<Error>;
56
+ info: {
57
+ header: string;
58
+ };
59
+ }
60
+ export interface DataTableRow {
61
+ id: string;
62
+ cells: Array<DataTableCell>;
63
+ disabled?: boolean;
64
+ isExpanded?: boolean;
65
+ isSelected?: boolean;
66
+ }
67
+ export interface DataTableHeader {
68
+ key: string;
69
+ header: React.ReactNode;
70
+ }
71
+ export interface DataTableRenderProps {
72
+ headers: Array<DataTableHeader>;
73
+ rows: Array<DataTableRow>;
74
+ selectedRows: Array<DataTableRow>;
75
+ getHeaderProps: (getHeaderPropsArgs: {
76
+ header: DataTableHeader;
77
+ isSortable?: boolean;
78
+ onClick?: (e: MouseEvent, sortState: {
79
+ sortHeaderKey: string;
80
+ sortDirection: DataTableSortState;
81
+ }) => void;
82
+ [key: string]: unknown;
83
+ }) => {
84
+ isSortable: boolean | undefined;
85
+ isSortHeader: boolean;
86
+ key: string;
87
+ onClick: (e: MouseEvent) => void;
88
+ sortDirection: DataTableSortState;
89
+ [key: string]: unknown;
90
+ };
91
+ getExpandHeaderProps: (getExpandHeaderPropsArgs?: {
92
+ onClick?: (e: MouseEvent, expandState: {
93
+ isExpanded?: boolean;
94
+ }) => void;
95
+ onExpand?: (e: MouseEvent) => void;
96
+ [key: string]: unknown;
97
+ }) => {
98
+ ariaLabel: string;
99
+ isExpanded: boolean;
100
+ onExpand: (e: MouseEvent) => void;
101
+ [key: string]: unknown;
102
+ };
103
+ getRowProps: (getRowPropsArgs: {
104
+ onClick?: (e: MouseEvent) => void;
105
+ row: DataTableRow;
106
+ [key: string]: unknown;
107
+ }) => {
108
+ ariaLabel: string;
109
+ disabled: boolean | undefined;
110
+ isExpanded?: boolean;
111
+ isSelected?: boolean;
112
+ key: string;
113
+ onExpand: (e: MouseEvent) => void;
114
+ [key: string]: unknown;
115
+ };
116
+ getSelectionProps: (getSelectionPropsArgs: {
117
+ onClick?: (e: MouseEvent) => void;
118
+ row: DataTableRow;
119
+ [key: string]: unknown;
120
+ }) => {
121
+ ariaLabel: string;
122
+ checked: boolean | undefined;
123
+ disabled?: boolean | undefined;
124
+ id: string;
125
+ indeterminate?: boolean;
126
+ name: string;
127
+ onSelect: (e: MouseEvent) => void;
128
+ radio?: boolean | null;
129
+ [key: string]: unknown;
130
+ };
131
+ getToolbarProps: (getToolbarPropsArgs?: {
132
+ [key: string]: unknown;
133
+ }) => {
134
+ size: 'sm' | undefined;
135
+ [key: string]: unknown;
136
+ };
137
+ getBatchActionProps: (getBatchActionPropsArgs?: {
138
+ [key: string]: unknown;
139
+ }) => {
140
+ onCancel: () => void;
141
+ shouldShowBatchActions: boolean;
142
+ totalSelected: number;
143
+ [key: string]: unknown;
144
+ };
145
+ getTableProps: () => {
146
+ experimentalAutoAlign?: boolean;
147
+ isSortable?: boolean;
148
+ overflowMenuOnHover: boolean;
149
+ size: DataTableSize;
150
+ stickyHeader?: boolean;
151
+ useStaticWidth?: boolean;
152
+ useZebraStyles?: boolean;
153
+ };
154
+ getTableContainerProps: () => {
155
+ stickyHeader?: boolean;
156
+ useStaticWidth?: boolean;
157
+ };
158
+ onInputChange: (e: Event, defaultValue?: string) => void;
159
+ sortBy: (headerKey: string) => void;
160
+ selectAll: () => void;
161
+ selectRow: (rowId: string) => void;
162
+ expandRow: (rowId: string) => void;
163
+ expandAll: () => void;
164
+ radio: boolean | undefined;
165
+ }
166
+ export interface DataTableProps {
167
+ children?: (renderProps: DataTableRenderProps) => React.ReactElement;
168
+ experimentalAutoAlign?: boolean;
169
+ filterRows?: (filterRowsArgs: {
170
+ cellsById: Record<string, DataTableCell>;
171
+ getCellId: (rowId: string, header: string) => string;
172
+ headers: Array<DataTableHeader>;
173
+ inputValue: string;
174
+ rowIds: Array<string>;
175
+ }) => Array<string>;
176
+ headers: Array<DataTableHeader>;
177
+ isSortable?: boolean;
178
+ locale?: string;
179
+ overflowMenuOnHover?: boolean;
180
+ radio?: boolean;
181
+ render?: (renderProps: DataTableRenderProps) => React.ReactElement;
182
+ rows: Array<Omit<DataTableRow, 'cells'>>;
183
+ size?: DataTableSize;
184
+ sortRow?: (cellA: DataTableCell, cellB: DataTableCell, sortRowOptions: {
185
+ sortDirection: DataTableSortState;
186
+ sortStates: Record<DataTableSortState, DataTableSortState>;
187
+ locale: string;
188
+ }) => number;
189
+ stickyHeader?: boolean;
190
+ translateWithId?: (id: string) => string;
191
+ useStaticWidth?: boolean;
192
+ useZebraStyles?: boolean;
193
+ }
194
+ interface DataTableState {
195
+ cellsById: Record<string, DataTableCell>;
196
+ filterInputValue: string | null;
197
+ initialRowOrder: Array<string>;
198
+ isExpandedAll: boolean;
199
+ rowIds: Array<string>;
200
+ rowsById: Record<string, DataTableRow>;
201
+ shouldShowBatchActions: boolean;
202
+ sortDirection: DataTableSortState;
203
+ sortHeaderKey: string | null;
204
+ }
205
+ /**
206
+ * Data Tables are used to represent a collection of resources, displaying a
207
+ * subset of their fields in columns, or headers. We prioritize direct updates
208
+ * to the state of what we're rendering, so internally we end up normalizing the
209
+ * given data and then denormalizing it when rendering.
210
+ *
211
+ * As a result, each part of the DataTable is accessible through look-up by id,
212
+ * and updating the state of the single entity will cascade updates to the
213
+ * consumer.
214
+ */
215
+ declare class DataTable extends React.Component<DataTableProps & typeof dataTableDefaultProps, DataTableState> {
216
+ instanceId: number;
217
+ static defaultProps: {
218
+ filterRows: ({ rowIds, headers, cellsById, inputValue, getCellId, }: {
219
+ rowIds: string[];
220
+ headers: any[];
221
+ cellsById: any;
222
+ inputValue: string;
223
+ getCellId: Function;
224
+ }) => string[];
225
+ locale: string;
226
+ overflowMenuOnHover: boolean;
227
+ size: string;
228
+ sortRow: (cellA: any, cellB: any, { sortDirection, sortStates, locale }: {
229
+ sortDirection: any;
230
+ sortStates: any;
231
+ locale: any;
232
+ }) => number;
233
+ translateWithId: (id: any) => string;
234
+ };
235
+ static propTypes: {
236
+ /**
237
+ * Experimental property. Allows table to align cell contents to the top if there is text wrapping in the content. Might have performance issues, intended for smaller tables
238
+ */
239
+ experimentalAutoAlign: PropTypes.Requireable<boolean>;
240
+ /**
241
+ * Optional hook to manually control filtering of the rows from the
242
+ * TableToolbarSearch component
243
+ */
244
+ filterRows: PropTypes.Requireable<(...args: any[]) => any>;
245
+ /**
246
+ * The `headers` prop represents the order in which the headers should
247
+ * appear in the table. We expect an array of objects to be passed in, where
248
+ * `key` is the name of the key in a row object, and `header` is the name of
249
+ * the header.
250
+ */
251
+ headers: PropTypes.Validator<(PropTypes.InferProps<{
252
+ key: PropTypes.Validator<string>;
253
+ header: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
254
+ }> | null | undefined)[]>;
255
+ /**
256
+ * Specify whether the table should be able to be sorted by its headers
257
+ */
258
+ isSortable: PropTypes.Requireable<boolean>;
259
+ /**
260
+ * Provide a string for the current locale
261
+ */
262
+ locale: PropTypes.Requireable<string>;
263
+ /**
264
+ * Specify whether the overflow menu (if it exists) should be shown always, or only on hover
265
+ */
266
+ overflowMenuOnHover: PropTypes.Requireable<boolean>;
267
+ /**
268
+ * Specify whether the control should be a radio button or inline checkbox
269
+ */
270
+ radio: PropTypes.Requireable<boolean>;
271
+ /**
272
+ * The `rows` prop is where you provide us with a list of all the rows that
273
+ * you want to render in the table. The only hard requirement is that this
274
+ * is an array of objects, and that each object has a unique `id` field
275
+ * available on it.
276
+ */
277
+ rows: PropTypes.Validator<(PropTypes.InferProps<{
278
+ id: PropTypes.Validator<string>;
279
+ disabled: PropTypes.Requireable<boolean>;
280
+ isSelected: PropTypes.Requireable<boolean>;
281
+ isExpanded: PropTypes.Requireable<boolean>;
282
+ }> | null | undefined)[]>;
283
+ /**
284
+ * Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
285
+ */
286
+ size: PropTypes.Requireable<string>;
287
+ /**
288
+ * Optional hook to manually control sorting of the rows.
289
+ */
290
+ sortRow: PropTypes.Requireable<(...args: any[]) => any>;
291
+ /**
292
+ * Specify whether the header should be sticky.
293
+ * Still experimental: may not work with every combination of table props
294
+ */
295
+ stickyHeader: PropTypes.Requireable<boolean>;
296
+ /**
297
+ * Optional method that takes in a message id and returns an
298
+ * internationalized string. See `DataTable.translationKeys` for all
299
+ * available message ids.
300
+ */
301
+ translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
302
+ /**
303
+ * `false` If true, will use a width of 'auto' instead of 100%
304
+ */
305
+ useStaticWidth: PropTypes.Requireable<boolean>;
306
+ /**
307
+ * `true` to add useZebraStyles striping.
308
+ */
309
+ useZebraStyles: PropTypes.Requireable<boolean>;
310
+ };
311
+ static translationKeys: string[];
312
+ static Table: typeof Table;
313
+ static TableActionList: typeof TableActionList;
314
+ static TableBatchAction: typeof TableBatchAction;
315
+ static TableBatchActions: typeof TableBatchActions;
316
+ static TableBody: typeof TableBody;
317
+ static TableCell: typeof TableCell;
318
+ static TableContainer: typeof TableContainer;
319
+ static TableExpandHeader: typeof TableExpandHeader;
320
+ static TableExpandRow: typeof TableExpandRow;
321
+ static TableExpandedRow: typeof TableExpandedRow;
322
+ static TableHead: typeof TableHead;
323
+ static TableHeader: typeof TableHeader;
324
+ static TableRow: typeof TableRow;
325
+ static TableSelectAll: typeof TableSelectAll;
326
+ static TableSelectRow: typeof TableSelectRow;
327
+ static TableToolbar: typeof TableToolbar;
328
+ static TableToolbarAction: typeof TableToolbarAction;
329
+ static TableToolbarContent: typeof TableToolbarContent;
330
+ static TableToolbarSearch: typeof TableToolbarSearch;
331
+ static TableToolbarMenu: typeof TableToolbarMenu;
332
+ constructor(props: any);
333
+ shouldComponentUpdate(nextProps: any): boolean;
334
+ /**
335
+ * Get the props associated with the given header. Mostly used for adding in
336
+ * sorting behavior.
337
+ *
338
+ * @param {object} config
339
+ * @param {string} config.header the header we want the props for
340
+ * @param {Function} config.onClick a custom click handler for the header
341
+ * @param {boolean} config.isSortable
342
+ * @returns {object}
343
+ */
344
+ getHeaderProps: ({ header, onClick, isSortable, ...rest }: {
345
+ [key: string]: unknown;
346
+ header: DataTableHeader;
347
+ onClick?: ((e: MouseEvent, sortState: {
348
+ sortHeaderKey: string;
349
+ sortDirection: DataTableSortState;
350
+ }) => void) | undefined;
351
+ isSortable?: boolean | undefined;
352
+ }) => {
353
+ key: string;
354
+ sortDirection: DataTableSortState;
355
+ isSortable: boolean | undefined;
356
+ isSortHeader: boolean;
357
+ onClick: (event: any) => void;
358
+ };
359
+ /**
360
+ * Get the props associated with the given expand header.
361
+ *
362
+ * @param {object} config
363
+ * @param {Function} config.onClick a custom click handler for the expand header
364
+ * @param {Function} config.onExpand a custom click handler called when header is expanded
365
+ * @returns {object}
366
+ */
367
+ getExpandHeaderProps: ({ onClick, onExpand, ...rest }?: {
368
+ [key: string]: unknown;
369
+ onClick?: ((e: MouseEvent, expandState: {
370
+ isExpanded: boolean;
371
+ }) => void) | undefined;
372
+ onExpand?: ((e: MouseEvent) => void) | undefined;
373
+ }) => {
374
+ ariaLabel: string;
375
+ isExpanded: boolean;
376
+ onExpand: any;
377
+ };
378
+ /**
379
+ * Decorate consumer's `onClick` event handler with sort parameters
380
+ *
381
+ * @param {Function} onClick
382
+ * @param {object} sortParams
383
+ * @returns {Function}
384
+ */
385
+ handleOnHeaderClick: (onClick: any, sortParams: any) => (e: any) => any;
386
+ /**
387
+ * Decorate consumer's `onClick` event handler with sort parameters
388
+ *
389
+ * @param {Function} onClick
390
+ * @param {object} expandParams
391
+ * @returns {Function}
392
+ */
393
+ handleOnExpandHeaderClick: (onClick: any, expandParams: any) => (e: any) => any;
394
+ /**
395
+ * Get the props associated with the given row. Mostly used for expansion.
396
+ *
397
+ * @param {object} config
398
+ * @param {object} config.row the row we want the props for
399
+ * @param {Function} config.onClick a custom click handler for the header
400
+ * @returns {object}
401
+ */
402
+ getRowProps: ({ row, onClick, ...rest }: {
403
+ [key: string]: unknown;
404
+ onClick?: ((e: MouseEvent) => void) | undefined;
405
+ row: DataTableRow;
406
+ }) => {
407
+ key: string;
408
+ onExpand: any;
409
+ isExpanded: boolean | undefined;
410
+ ariaLabel: string;
411
+ isSelected: boolean | undefined;
412
+ disabled: boolean | undefined;
413
+ };
414
+ /**
415
+ * Gets the props associated with selection for a header or a row, where
416
+ * applicable. Most often used to indicate selection status of the table or
417
+ * for a specific row.
418
+ *
419
+ * @param {object} [row] an optional row that we want to access the props for
420
+ * @param {Function} row.onClick
421
+ * @param {object} row.row
422
+ * @returns {object}
423
+ */
424
+ getSelectionProps: ({ onClick, row, ...rest }?: {
425
+ [key: string]: unknown;
426
+ onClick?: ((e: MouseEvent) => void) | undefined;
427
+ row: DataTableRow;
428
+ }) => {
429
+ checked: boolean | undefined;
430
+ onSelect: any;
431
+ id: string;
432
+ name: string;
433
+ ariaLabel: string;
434
+ disabled: boolean | undefined;
435
+ radio: true | null;
436
+ } | {
437
+ ariaLabel: string;
438
+ checked: boolean;
439
+ id: string;
440
+ indeterminate: boolean;
441
+ name: string;
442
+ onSelect: any;
443
+ };
444
+ getToolbarProps: (props?: {}) => {
445
+ [key: string]: unknown;
446
+ size: 'sm' | undefined;
447
+ };
448
+ getBatchActionProps: (props?: {}) => {
449
+ shouldShowBatchActions: boolean;
450
+ totalSelected: number;
451
+ onCancel: () => void;
452
+ };
453
+ /**
454
+ * Helper utility to get the Table Props.
455
+ */
456
+ getTableProps: () => {
457
+ useZebraStyles: boolean | undefined;
458
+ size: "sm" | "md" | "lg" | "xl" | "xs";
459
+ isSortable: boolean | undefined;
460
+ useStaticWidth: boolean | undefined;
461
+ stickyHeader: boolean | undefined;
462
+ overflowMenuOnHover: boolean;
463
+ experimentalAutoAlign: boolean | undefined;
464
+ };
465
+ /**
466
+ * Helper utility to get the TableContainer Props.
467
+ */
468
+ getTableContainerProps: () => {
469
+ stickyHeader: boolean | undefined;
470
+ useStaticWidth: boolean | undefined;
471
+ };
472
+ /**
473
+ * Helper utility to get all the currently selected rows
474
+ * @returns {Array<string>} the array of rowIds that are currently selected
475
+ */
476
+ getSelectedRows: () => string[];
477
+ /**
478
+ * Helper utility to get all of the available rows after applying the filter
479
+ * @returns {Array<string>} the array of rowIds that are currently included through the filter
480
+ * */
481
+ getFilteredRowIds: () => string[];
482
+ /**
483
+ * Helper for getting the table prefix for elements that require an
484
+ * `id` attribute that is unique.
485
+ *
486
+ * @returns {string}
487
+ */
488
+ getTablePrefix: () => string;
489
+ /**
490
+ * Helper for toggling all selected items in a state. Does not call
491
+ * setState, so use it when setting state.
492
+ * @param {object} initialState
493
+ * @returns {object} object to put into this.setState (use spread operator)
494
+ */
495
+ setAllSelectedState: (initialState: any, isSelected: any, filteredRowIds: any) => {
496
+ rowsById: any;
497
+ };
498
+ /**
499
+ * Handler for the `onCancel` event to hide the batch action bar and
500
+ * deselect all selected rows
501
+ */
502
+ handleOnCancel: () => void;
503
+ /**
504
+ * Handler for toggling the selection state of all rows in the database
505
+ */
506
+ handleSelectAll: () => void;
507
+ /**
508
+ * Handler for toggling the selection state of a given row.
509
+ *
510
+ * @param {string} rowId
511
+ * @returns {Function}
512
+ */
513
+ handleOnSelectRow: (rowId: any) => () => void;
514
+ /**
515
+ * Handler for toggling the expansion state of a given row.
516
+ *
517
+ * @param {string} rowId
518
+ * @returns {Function}
519
+ */
520
+ handleOnExpandRow: (rowId: any) => () => void;
521
+ /**
522
+ * Handler for changing the expansion state of all rows.
523
+ */
524
+ handleOnExpandAll: () => void;
525
+ /**
526
+ * Handler for transitioning to the next sort state of the table
527
+ *
528
+ * @param {string} headerKey the field for the header that we are sorting by
529
+ * @returns {Function}
530
+ */
531
+ handleSortBy: (headerKey: any) => () => void;
532
+ /**
533
+ * Event handler for transitioning input value state changes for the table
534
+ * filter component.
535
+ *
536
+ * @param {Event} event
537
+ */
538
+ handleOnInputValueChange: (event: any, defaultValue: any) => void;
539
+ render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
540
+ }
541
+ export default DataTable;
@@ -14,12 +14,12 @@ var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
15
  var isEqual = require('lodash.isequal');
16
16
  var getDerivedStateFromProps = require('./state/getDerivedStateFromProps.js');
17
- var sorting = require('./state/sorting.js');
17
+ var sorting$1 = require('./state/sorting.js');
18
18
  var cells = require('./tools/cells.js');
19
19
  var denormalize = require('./tools/denormalize.js');
20
20
  var events = require('../../tools/events.js');
21
21
  var filter = require('./tools/filter.js');
22
- var sorting$1 = require('./tools/sorting.js');
22
+ var sorting = require('./tools/sorting.js');
23
23
  var instanceId = require('./tools/instanceId.js');
24
24
  var Table = require('./Table.js');
25
25
  var TableActionList = require('./TableActionList.js');
@@ -70,7 +70,14 @@ const defaultTranslations = {
70
70
  [translationKeys.unselectRow]: 'Unselect row'
71
71
  };
72
72
  const translateWithId = id => defaultTranslations[id];
73
-
73
+ const dataTableDefaultProps = {
74
+ filterRows: filter.defaultFilterRows,
75
+ locale: 'en',
76
+ overflowMenuOnHover: true,
77
+ size: 'lg',
78
+ sortRow: sorting.defaultSortRow,
79
+ translateWithId
80
+ };
74
81
  /**
75
82
  * Data Tables are used to represent a collection of resources, displaying a
76
83
  * subset of their fields in columns, or headers. We prioritize direct updates
@@ -86,6 +93,7 @@ class DataTable extends React__default["default"].Component {
86
93
  var _this;
87
94
  super(_props);
88
95
  _this = this;
96
+ _rollupPluginBabelHelpers.defineProperty(this, "instanceId", void 0);
89
97
  /**
90
98
  * Get the props associated with the given header. Mostly used for adding in
91
99
  * sorting behavior.
@@ -114,7 +122,7 @@ class DataTable extends React__default["default"].Component {
114
122
  isSortable,
115
123
  isSortHeader: sortHeaderKey === header.key,
116
124
  onClick: event => {
117
- const nextSortState = sorting.getNextSortState(this.props, this.state, {
125
+ const nextSortState = sorting$1.getNextSortState(this.props, this.state, {
118
126
  key: header.key
119
127
  });
120
128
  this.setState(nextSortState, () => {
@@ -156,9 +164,9 @@ class DataTable extends React__default["default"].Component {
156
164
  isExpanded,
157
165
  // Compose the event handlers so we don't overwrite a consumer's `onClick`
158
166
  // handler
159
- onExpand: events.composeEventHandlers([_this.handleOnExpandAll, onExpand, onClick ? _this.handleOnExpandHeaderClick(onClick, {
167
+ onExpand: events.composeEventHandlers([_this.handleOnExpandAll, onExpand, onClick && _this.handleOnExpandHeaderClick(onClick, {
160
168
  isExpanded
161
- }) : null])
169
+ })])
162
170
  };
163
171
  });
164
172
  /**
@@ -268,7 +276,7 @@ class DataTable extends React__default["default"].Component {
268
276
  const {
269
277
  size
270
278
  } = _this.props;
271
- let isSmall = size === 'xs' || size === 'sm';
279
+ const isSmall = size === 'xs' || size === 'sm';
272
280
  return {
273
281
  ...props,
274
282
  size: isSmall ? 'sm' : undefined
@@ -506,7 +514,7 @@ class DataTable extends React__default["default"].Component {
506
514
  * @returns {Function}
507
515
  */
508
516
  _rollupPluginBabelHelpers.defineProperty(this, "handleSortBy", headerKey => () => {
509
- this.setState(state => sorting.getNextSortState(this.props, state, {
517
+ this.setState(state => sorting$1.getNextSortState(this.props, state, {
510
518
  key: headerKey
511
519
  }));
512
520
  });
@@ -612,6 +620,7 @@ class DataTable extends React__default["default"].Component {
612
620
  return null;
613
621
  }
614
622
  }
623
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "defaultProps", dataTableDefaultProps);
615
624
  _rollupPluginBabelHelpers.defineProperty(DataTable, "propTypes", {
616
625
  /**
617
626
  * Experimental property. Allows table to align cell contents to the top if there is text wrapping in the content. Might have performance issues, intended for smaller tables
@@ -688,15 +697,28 @@ _rollupPluginBabelHelpers.defineProperty(DataTable, "propTypes", {
688
697
  */
689
698
  useZebraStyles: PropTypes__default["default"].bool
690
699
  });
691
- _rollupPluginBabelHelpers.defineProperty(DataTable, "defaultProps", {
692
- sortRow: sorting$1.defaultSortRow,
693
- filterRows: filter.defaultFilterRows,
694
- locale: 'en',
695
- size: 'lg',
696
- overflowMenuOnHover: true,
697
- translateWithId
698
- });
699
700
  _rollupPluginBabelHelpers.defineProperty(DataTable, "translationKeys", Object.values(translationKeys));
701
+ // Static properties for sub-components
702
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "Table", void 0);
703
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableActionList", void 0);
704
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableBatchAction", void 0);
705
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableBatchActions", void 0);
706
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableBody", void 0);
707
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableCell", void 0);
708
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableContainer", void 0);
709
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableExpandHeader", void 0);
710
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableExpandRow", void 0);
711
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableExpandedRow", void 0);
712
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableHead", void 0);
713
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableHeader", void 0);
714
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableRow", void 0);
715
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableSelectAll", void 0);
716
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableSelectRow", void 0);
717
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbar", void 0);
718
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbarAction", void 0);
719
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbarContent", void 0);
720
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbarSearch", void 0);
721
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbarMenu", void 0);
700
722
  DataTable.Table = Table.Table;
701
723
  DataTable.TableActionList = TableActionList["default"];
702
724
  DataTable.TableBatchAction = TableBatchAction["default"];
@@ -717,6 +739,5 @@ DataTable.TableToolbarAction = TableToolbarAction["default"];
717
739
  DataTable.TableToolbarContent = TableToolbarContent["default"];
718
740
  DataTable.TableToolbarSearch = TableToolbarSearch["default"];
719
741
  DataTable.TableToolbarMenu = TableToolbarMenu["default"];
720
- var DataTable$1 = DataTable;
721
742
 
722
- exports["default"] = DataTable$1;
743
+ exports["default"] = DataTable;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import DataTable from './DataTable';
7
+ import DataTable, { type DataTableCell, type DataTableHeader, type DataTableRow, type DataTableProps, type DataTableRenderProps, type DataTableSize } from './DataTable';
8
8
  import Table from './Table';
9
9
  import TableActionList from './TableActionList';
10
10
  import TableBatchAction from './TableBatchAction';
@@ -25,5 +25,5 @@ import TableToolbarAction from './TableToolbarAction';
25
25
  import TableToolbarContent from './TableToolbarContent';
26
26
  import TableToolbarSearch from './TableToolbarSearch';
27
27
  import TableToolbarMenu from './TableToolbarMenu';
28
- export { DataTable, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
28
+ export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
29
29
  export default DataTable;