@atlaskit/dynamic-table 14.5.5 → 14.7.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 (127) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/components/{Body.js → body.js} +3 -3
  3. package/dist/cjs/components/{LoadingContainerAdvanced.js → loading-container-advanced.js} +3 -3
  4. package/dist/cjs/components/{LoadingContainer.js → loading-container.js} +3 -3
  5. package/dist/cjs/components/managed-pagination.js +4 -2
  6. package/dist/cjs/components/rankable/{Body.js → body.js} +3 -3
  7. package/dist/cjs/components/rankable/{TableCell.js → table-cell.js} +3 -3
  8. package/dist/cjs/components/rankable/{TableHeadCell.js → table-head-cell.js} +3 -3
  9. package/dist/cjs/components/rankable/{TableRow.js → table-row.js} +5 -5
  10. package/dist/cjs/components/{Stateful.js → stateful.js} +6 -4
  11. package/dist/cjs/components/{Stateless.js → stateless.js} +34 -24
  12. package/dist/cjs/components/{TableHeadCell.js → table-head-cell.js} +5 -3
  13. package/dist/cjs/components/{TableHead.js → table-head.js} +7 -6
  14. package/dist/cjs/components/{TableRow.js → table-row.js} +6 -5
  15. package/dist/cjs/hoc/{withDimensions.js → with-dimensions.js} +0 -0
  16. package/dist/cjs/hoc/{withSortedPageRows.js → with-sorted-page-rows.js} +0 -0
  17. package/dist/cjs/index.js +4 -4
  18. package/dist/cjs/styled/constants.js +2 -2
  19. package/dist/cjs/styled/{DynamicTable.js → dynamic-table.js} +19 -25
  20. package/dist/cjs/styled/{EmptyBody.js → empty-body.js} +4 -2
  21. package/dist/cjs/styled/{LoadingContainerAdvanced.js → loading-container-advanced.js} +10 -6
  22. package/dist/cjs/styled/{LoadingContainer.js → loading-container.js} +5 -3
  23. package/dist/cjs/styled/rankable/{RowPlaceholder.js → row-placeholder.js} +6 -4
  24. package/dist/cjs/styled/rankable/{TableCell.js → table-cell.js} +5 -4
  25. package/dist/cjs/styled/rankable/{TableRow.js → table-row.js} +10 -9
  26. package/dist/cjs/styled/{TableCell.js → table-cell.js} +3 -1
  27. package/dist/cjs/styled/{TableHead.js → table-head.js} +73 -95
  28. package/dist/cjs/styled/{TableRow.js → table-row.js} +7 -6
  29. package/dist/cjs/theme.js +13 -40
  30. package/dist/cjs/version.json +1 -1
  31. package/dist/es2019/components/{Body.js → body.js} +2 -2
  32. package/dist/es2019/components/{LoadingContainerAdvanced.js → loading-container-advanced.js} +3 -1
  33. package/dist/es2019/components/{LoadingContainer.js → loading-container.js} +1 -1
  34. package/dist/es2019/components/managed-pagination.js +4 -2
  35. package/dist/es2019/components/rankable/{Body.js → body.js} +2 -2
  36. package/dist/es2019/components/rankable/{TableCell.js → table-cell.js} +2 -2
  37. package/dist/es2019/components/rankable/{TableHeadCell.js → table-head-cell.js} +2 -2
  38. package/dist/es2019/components/rankable/{TableRow.js → table-row.js} +3 -3
  39. package/dist/es2019/components/{Stateful.js → stateful.js} +4 -3
  40. package/dist/es2019/components/{Stateless.js → stateless.js} +26 -17
  41. package/dist/es2019/components/{TableHeadCell.js → table-head-cell.js} +4 -2
  42. package/dist/es2019/components/{TableHead.js → table-head.js} +5 -4
  43. package/dist/es2019/components/{TableRow.js → table-row.js} +4 -3
  44. package/dist/es2019/hoc/{withDimensions.js → with-dimensions.js} +0 -0
  45. package/dist/es2019/hoc/{withSortedPageRows.js → with-sorted-page-rows.js} +0 -0
  46. package/dist/es2019/index.js +2 -2
  47. package/dist/es2019/styled/constants.js +4 -6
  48. package/dist/es2019/styled/{DynamicTable.js → dynamic-table.js} +24 -27
  49. package/dist/es2019/styled/{EmptyBody.js → empty-body.js} +4 -2
  50. package/dist/es2019/styled/{LoadingContainerAdvanced.js → loading-container-advanced.js} +7 -4
  51. package/dist/es2019/styled/{LoadingContainer.js → loading-container.js} +5 -3
  52. package/dist/es2019/styled/rankable/row-placeholder.js +12 -0
  53. package/dist/es2019/styled/rankable/{TableCell.js → table-cell.js} +5 -3
  54. package/dist/es2019/styled/rankable/{TableRow.js → table-row.js} +9 -8
  55. package/dist/es2019/styled/{TableCell.js → table-cell.js} +4 -2
  56. package/dist/es2019/styled/table-head.js +138 -0
  57. package/dist/es2019/styled/{TableRow.js → table-row.js} +3 -2
  58. package/dist/es2019/theme.js +10 -37
  59. package/dist/es2019/types.js +1 -0
  60. package/dist/es2019/version.json +1 -1
  61. package/dist/esm/components/{Body.js → body.js} +2 -2
  62. package/dist/esm/components/{LoadingContainerAdvanced.js → loading-container-advanced.js} +2 -1
  63. package/dist/esm/components/{LoadingContainer.js → loading-container.js} +1 -1
  64. package/dist/esm/components/managed-pagination.js +4 -2
  65. package/dist/esm/components/rankable/{Body.js → body.js} +2 -2
  66. package/dist/esm/components/rankable/{TableCell.js → table-cell.js} +2 -2
  67. package/dist/esm/components/rankable/{TableHeadCell.js → table-head-cell.js} +2 -2
  68. package/dist/esm/components/rankable/{TableRow.js → table-row.js} +3 -3
  69. package/dist/esm/components/{Stateful.js → stateful.js} +4 -3
  70. package/dist/esm/components/{Stateless.js → stateless.js} +26 -17
  71. package/dist/esm/components/{TableHeadCell.js → table-head-cell.js} +4 -2
  72. package/dist/esm/components/{TableHead.js → table-head.js} +5 -4
  73. package/dist/esm/components/{TableRow.js → table-row.js} +4 -3
  74. package/dist/esm/hoc/{withDimensions.js → with-dimensions.js} +0 -0
  75. package/dist/esm/hoc/{withSortedPageRows.js → with-sorted-page-rows.js} +0 -0
  76. package/dist/esm/index.js +2 -2
  77. package/dist/esm/styled/constants.js +2 -2
  78. package/dist/esm/styled/{DynamicTable.js → dynamic-table.js} +22 -25
  79. package/dist/esm/styled/{EmptyBody.js → empty-body.js} +4 -2
  80. package/dist/esm/styled/{LoadingContainerAdvanced.js → loading-container-advanced.js} +10 -6
  81. package/dist/esm/styled/{LoadingContainer.js → loading-container.js} +5 -3
  82. package/dist/esm/styled/rankable/{RowPlaceholder.js → row-placeholder.js} +7 -4
  83. package/dist/esm/styled/rankable/{TableCell.js → table-cell.js} +5 -3
  84. package/dist/esm/styled/rankable/{TableRow.js → table-row.js} +9 -8
  85. package/dist/esm/styled/{TableCell.js → table-cell.js} +4 -2
  86. package/dist/esm/styled/{TableHead.js → table-head.js} +75 -94
  87. package/dist/esm/styled/{TableRow.js → table-row.js} +3 -2
  88. package/dist/esm/theme.js +10 -37
  89. package/dist/esm/types.js +1 -0
  90. package/dist/esm/version.json +1 -1
  91. package/dist/types/components/{Body.d.ts → body.d.ts} +23 -23
  92. package/dist/types/components/{LoadingContainerAdvanced.d.ts → loading-container-advanced.d.ts} +5 -5
  93. package/dist/types/components/{LoadingContainer.d.ts → loading-container.d.ts} +0 -0
  94. package/dist/types/components/managed-pagination.d.ts +1 -0
  95. package/dist/types/components/rankable/body.d.ts +122 -0
  96. package/dist/types/components/rankable/table-cell.d.ts +14 -0
  97. package/dist/types/components/rankable/table-head-cell.d.ts +5 -0
  98. package/dist/types/components/rankable/table-row.d.ts +18 -0
  99. package/dist/types/components/{Stateful.d.ts → stateful.d.ts} +3 -2
  100. package/dist/types/components/{Stateless.d.ts → stateless.d.ts} +9 -8
  101. package/dist/types/components/{TableHeadCell.d.ts → table-head-cell.d.ts} +2 -2
  102. package/dist/types/components/{TableHead.d.ts → table-head.d.ts} +3 -3
  103. package/dist/types/components/{TableRow.d.ts → table-row.d.ts} +2 -2
  104. package/dist/types/hoc/{withDimensions.d.ts → with-dimensions.d.ts} +0 -0
  105. package/dist/types/hoc/{withSortedPageRows.d.ts → with-sorted-page-rows.d.ts} +23 -23
  106. package/dist/types/index.d.ts +2 -2
  107. package/dist/types/styled/constants.d.ts +2 -2
  108. package/dist/types/styled/{DynamicTable.d.ts → dynamic-table.d.ts} +2 -1
  109. package/dist/types/styled/{EmptyBody.d.ts → empty-body.d.ts} +0 -0
  110. package/dist/types/styled/{LoadingContainerAdvanced.d.ts → loading-container-advanced.d.ts} +0 -0
  111. package/dist/types/styled/{LoadingContainer.d.ts → loading-container.d.ts} +0 -0
  112. package/dist/types/styled/rankable/{RowPlaceholder.d.ts → row-placeholder.d.ts} +0 -0
  113. package/dist/types/styled/rankable/{TableCell.d.ts → table-cell.d.ts} +0 -0
  114. package/dist/types/styled/rankable/{TableRow.d.ts → table-row.d.ts} +1 -1
  115. package/dist/types/styled/{TableCell.d.ts → table-cell.d.ts} +0 -0
  116. package/dist/types/styled/{TableHead.d.ts → table-head.d.ts} +0 -2
  117. package/dist/types/styled/{TableRow.d.ts → table-row.d.ts} +0 -0
  118. package/dist/types/theme.d.ts +10 -9
  119. package/dist/types/types.d.ts +37 -31
  120. package/package.json +10 -6
  121. package/report.api.md +508 -0
  122. package/dist/es2019/styled/TableHead.js +0 -160
  123. package/dist/es2019/styled/rankable/RowPlaceholder.js +0 -10
  124. package/dist/types/components/rankable/Body.d.ts +0 -122
  125. package/dist/types/components/rankable/TableCell.d.ts +0 -14
  126. package/dist/types/components/rankable/TableHeadCell.d.ts +0 -5
  127. package/dist/types/components/rankable/TableRow.d.ts +0 -18
@@ -46,7 +46,7 @@ export interface StatelessProps extends WithAnalyticsEventsProps {
46
46
  /**
47
47
  * Rows to be placed in the table.
48
48
  * Each row contains cells which should map to the ones defined in the head.
49
-
49
+ *
50
50
  * Ensure each cell has a unique `key` per column - this is used for both Reacts reconcilation of lists and column sorting.
51
51
  */
52
52
  rows?: Array<RowType>;
@@ -90,7 +90,7 @@ export interface StatelessProps extends WithAnalyticsEventsProps {
90
90
  */
91
91
  onPageRowsUpdate?: (pageRows: Array<RowType>) => void;
92
92
  /**
93
- * Page the table should show.
93
+ * Page the table should show. Set by default to 1, so never undefined.
94
94
  */
95
95
  page?: number;
96
96
  /**
@@ -129,18 +129,19 @@ export interface StatelessProps extends WithAnalyticsEventsProps {
129
129
  */
130
130
  highlightedRowIndex?: number | number[];
131
131
  /**
132
- A `testId` prop is provided for specified elements,
133
- which is a unique string that appears as a data attribute
134
- `data-testid` in the rendered code, serving as a hook for automated tests.
135
-
136
- The value of `testId` is used to prefix `testId` props in given elements.
137
- + `${testId}--table` - Table.
138
- + `${testId}--head` - Table header.
139
- + `${testId}--head--{content of the cell}` - Table header cell can be identified by their content.
140
- + `${testId}--row--{index - content of the first cell}` - Table row.
141
- + `${testId}--body` - Table body.
142
- + `${testId}--body--{content of the cell}` - Table body cell can be identified by their content.
143
- + `${testId}--loadingSpinner` - The spinner overlaid when loading.
132
+ * A `testId` prop is provided for specified elements,
133
+ * which is a unique string that appears as a data attribute
134
+ * `data-testid` in the rendered code, serving as a hook for automated tests.
135
+ *
136
+ * The value of `testId` is used to prefix `testId` props in given elements.
137
+ * - `{testId}--table` - Table.
138
+ * - `{testId}--head` - Table header.
139
+ * - `{testId}--head--{content of the cell}` - Table header cell can be identified by their content.
140
+ * - `{testId}--row--{index - content of the first cell}` - Table row.
141
+ * - `{testId}--body` - Table body.
142
+ * - `{testId}--body--{content of the cell}` - Table body cell can be identified by their content.
143
+ * - `{testId}--loadingSpinner` - The spinner overlaid when loading.
144
+ * - `{testId}--pagination` - The table pagination.
144
145
  */
145
146
  testId?: string;
146
147
  /**
@@ -164,7 +165,6 @@ export interface StatefulProps extends WithAnalyticsEventsProps {
164
165
  * Rows to be placed in the table.
165
166
  * Each row contains cells which should map to the ones defined in the head.
166
167
  * Rows accept standard HTML <tr> props in addition to those listed below.
167
-
168
168
  * Ensure each cell has a unique `key` per column - this is used for both React's reconciliation of lists and column sorting.
169
169
  */
170
170
  rows?: Array<RowType>;
@@ -186,7 +186,7 @@ export interface StatefulProps extends WithAnalyticsEventsProps {
186
186
  */
187
187
  isFixedSize?: boolean;
188
188
  /**
189
- * Controls how many rows should be diplayed per page.
189
+ * Controls how many rows should be displayed per page. If set, also turns on pagination, if there is more than one page to show.
190
190
  */
191
191
  rowsPerPage?: number;
192
192
  /**
@@ -260,18 +260,18 @@ export interface StatefulProps extends WithAnalyticsEventsProps {
260
260
  */
261
261
  highlightedRowIndex?: number | number[];
262
262
  /**
263
- A `testId` prop is provided for specified elements,
264
- which is a unique string that appears as a data attribute
265
- `data-testid` in the rendered code, serving as a hook for automated tests.
266
-
267
- The value of `testId` is used to prefix `testId` props in given elements.
268
- + `${testId}--table` - Table.
269
- + `${testId}--head` - Table header.
270
- + `${testId}--head--{content of the cell}` - Table header cell can be identified by their content.
271
- + `${testId}--row--{index - content of the first cell}` - Table row.
272
- + `${testId}--body` - Table body.
273
- + `${testId}--body--{content of the cell}` - Table body cell can be identified by their content.
274
- + `${testId}--loadingSpinner` - The spinner overlaid when loading.
263
+ * A `testId` prop is provided for specified elements,
264
+ * which is a unique string that appears as a data attribute
265
+ * `data-testid` in the rendered code, serving as a hook for automated tests.
266
+ * The value of `testId` is used to prefix `testId` props in given elements.
267
+ * - `{testId}--table` - Table.
268
+ * - `{testId}--head` - Table header.
269
+ * - `{testId}--head--{content of the cell}` - Table header cell can be identified by their content.
270
+ * - `{testId}--row--{index - content of the first cell}` - Table row.
271
+ * - `{testId}--body` - Table body.
272
+ * - `{testId}--body--{content of the cell}` - Table body cell can be identified by their content.
273
+ * - `{testId}--loadingSpinner` - The spinner overlaid when loading.
274
+ * - `{testId}--pagination` - The table pagination.
275
275
  */
276
276
  testId?: string;
277
277
  /**
@@ -313,11 +313,17 @@ export declare type SortOrderType = 'ASC' | 'DESC';
313
313
  export declare type SpinnerSizeType = SizeType;
314
314
  export declare type LoadingSpinnerSizeType = 'small' | 'large';
315
315
  export interface HeadCellType extends RowCellType {
316
- /** Whether the column the cell sits above is sortable. */
316
+ /**
317
+ * Whether the column the cell sits above is sortable.
318
+ */
317
319
  isSortable?: boolean;
318
- /** The pixel width of the cell. */
320
+ /**
321
+ * The width of the cell as a percentage.
322
+ */
319
323
  width?: number;
320
- /** Whether the text in the cell will truncate or not if constrained. */
324
+ /**
325
+ * Whether the text in the cell will truncate or not if constrained.
326
+ */
321
327
  shouldTruncate?: boolean;
322
328
  }
323
329
  export interface RankEndLocation {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "14.5.5",
3
+ "version": "14.7.0",
4
4
  "description": "A dynamic table displays rows of data with built-in pagination, sorting, and re-ordering functionality.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
8
8
  "homepage": "https://atlassian.design/components/dynamic-table/",
9
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
9
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
10
10
  "author": "Atlassian Pty Ltd",
11
11
  "license": "Apache-2.0",
12
12
  "main": "dist/cjs/index.js",
@@ -14,17 +14,19 @@
14
14
  "module:es2019": "dist/es2019/index.js",
15
15
  "types": "dist/types/index.d.ts",
16
16
  "sideEffects": false,
17
- "atlaskit:src": "src/index.ts",
17
+ "atlaskit:src": "src/index.tsx",
18
18
  "atlassian": {
19
19
  "team": "Design System Team",
20
20
  "deprecatedAutoEntryPoints": true,
21
21
  "releaseModel": "scheduled",
22
22
  "website": {
23
- "name": "Dynamic table"
23
+ "name": "Dynamic table",
24
+ "category": "Components"
24
25
  }
25
26
  },
26
27
  "dependencies": {
27
28
  "@atlaskit/analytics-next": "^8.0.0",
29
+ "@atlaskit/ds-lib": "^2.1.0",
28
30
  "@atlaskit/pagination": "^14.0.0",
29
31
  "@atlaskit/spinner": "^15.0.0",
30
32
  "@atlaskit/theme": "^12.1.0",
@@ -38,10 +40,10 @@
38
40
  "react-dom": "^16.8.0"
39
41
  },
40
42
  "devDependencies": {
41
- "@atlaskit/avatar": "^20.5.0",
43
+ "@atlaskit/avatar": "^21.0.0",
42
44
  "@atlaskit/button": "^16.3.0",
43
45
  "@atlaskit/docs": "*",
44
- "@atlaskit/dropdown-menu": "^11.1.0",
46
+ "@atlaskit/dropdown-menu": "^11.3.0",
45
47
  "@atlaskit/ssr": "*",
46
48
  "@atlaskit/toggle": "^12.4.0",
47
49
  "@atlaskit/visual-regression": "*",
@@ -60,6 +62,8 @@
60
62
  "import-structure": "atlassian-conventions"
61
63
  },
62
64
  "@repo/internal": {
65
+ "dom-events": "use-bind-event-listener",
66
+ "design-system": "v1",
63
67
  "theming": "tokens",
64
68
  "deprecation": "no-deprecated-imports",
65
69
  "styling": [
package/report.api.md ADDED
@@ -0,0 +1,508 @@
1
+ ## API Report File for "@atlaskit/dynamic-table"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ````ts
6
+ import { default as React_2 } from 'react';
7
+ import { Ref } from 'react';
8
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
9
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
10
+ import { WithContextProps } from '@atlaskit/analytics-next';
11
+
12
+ /**
13
+ * __Dynamic Table__
14
+ *
15
+ * A table displays rows of data with built-in pagination, sorting, and re-ordering functionality.
16
+ *
17
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
18
+ * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
19
+ *
20
+ * @example
21
+ * ```jsx
22
+ * import DynamicTable from '@atlaskit/dynamic-table';
23
+ *
24
+ * export default function TableUncontrolled() {
25
+ * return (
26
+ * <DynamicTable
27
+ * head={head}
28
+ * rows={rows}
29
+ * rowsPerPage={10}
30
+ * defaultPage={1}
31
+ * loadingSpinnerSize="large"
32
+ * isLoading={false}
33
+ * />
34
+ * );
35
+ * }
36
+ * ```
37
+ */
38
+ declare class DynamicTable extends React_2.Component<StatefulProps, State> {
39
+ static defaultProps: {
40
+ defaultPage: number;
41
+ isLoading: boolean;
42
+ isFixedSize: boolean;
43
+ isRankable: boolean;
44
+ onSetPage: () => void;
45
+ onSort: () => void;
46
+ rowsPerPage: number;
47
+ };
48
+ state: {
49
+ page: number | undefined;
50
+ sortKey: string | undefined;
51
+ sortOrder: SortOrderType | undefined;
52
+ rows: RowType[] | undefined;
53
+ };
54
+ UNSAFE_componentWillReceiveProps(newProps: StatefulProps): void;
55
+ onSetPage: (
56
+ page: number,
57
+ analyticsEvent?: UIAnalyticsEvent | undefined,
58
+ ) => void;
59
+ onSort: (
60
+ { key, item, sortOrder }: any,
61
+ analyticsEvent?: UIAnalyticsEvent | undefined,
62
+ ) => void;
63
+ onRankEndIfExists: (params: RankEnd) => void;
64
+ onRankEnd: (params: RankEnd) => void;
65
+ render(): JSX.Element;
66
+ }
67
+ export default DynamicTable;
68
+
69
+ export declare const DynamicTableStateless: React_2.ForwardRefExoticComponent<
70
+ Pick<
71
+ Pick<
72
+ Omit<StatelessProps, keyof WithAnalyticsEventsProps>,
73
+ | 'caption'
74
+ | 'head'
75
+ | 'label'
76
+ | 'rows'
77
+ | 'sortKey'
78
+ | 'sortOrder'
79
+ | 'onPageRowsUpdate'
80
+ | 'testId'
81
+ | 'highlightedRowIndex'
82
+ | 'emptyView'
83
+ | 'loadingSpinnerSize'
84
+ | 'totalRows'
85
+ > &
86
+ Partial<
87
+ Pick<
88
+ Omit<StatelessProps, keyof WithAnalyticsEventsProps>,
89
+ | 'isFixedSize'
90
+ | 'page'
91
+ | 'rowsPerPage'
92
+ | 'isLoading'
93
+ | 'isRankingDisabled'
94
+ | 'onRankStart'
95
+ | 'onRankEnd'
96
+ | 'onSort'
97
+ | 'isRankable'
98
+ | 'onSetPage'
99
+ | 'paginationi18n'
100
+ >
101
+ > &
102
+ Partial<
103
+ Pick<
104
+ {
105
+ isLoading: boolean;
106
+ isFixedSize: boolean;
107
+ rowsPerPage: number;
108
+ onSetPage: () => void;
109
+ onSort: () => void;
110
+ page: number;
111
+ isRankable: boolean;
112
+ isRankingDisabled: boolean;
113
+ onRankStart: () => void;
114
+ onRankEnd: () => void;
115
+ paginationi18n: {
116
+ prev: string;
117
+ next: string;
118
+ label: string;
119
+ };
120
+ },
121
+ never
122
+ >
123
+ > &
124
+ React_2.RefAttributes<any> &
125
+ WithContextProps,
126
+ | 'caption'
127
+ | 'head'
128
+ | 'label'
129
+ | 'key'
130
+ | 'isFixedSize'
131
+ | 'rows'
132
+ | 'page'
133
+ | 'rowsPerPage'
134
+ | 'sortKey'
135
+ | 'sortOrder'
136
+ | 'onPageRowsUpdate'
137
+ | 'testId'
138
+ | 'highlightedRowIndex'
139
+ | 'isLoading'
140
+ | 'isRankingDisabled'
141
+ | 'onRankStart'
142
+ | 'onRankEnd'
143
+ | 'onSort'
144
+ | 'isRankable'
145
+ | 'emptyView'
146
+ | 'loadingSpinnerSize'
147
+ | 'totalRows'
148
+ | 'onSetPage'
149
+ | 'paginationi18n'
150
+ | 'analyticsContext'
151
+ > &
152
+ React_2.RefAttributes<any>
153
+ >;
154
+
155
+ declare interface HeadCellType extends RowCellType {
156
+ /** Whether the column the cell sits above is sortable. */
157
+ isSortable?: boolean;
158
+ /** The pixel width of the cell. */
159
+ width?: number;
160
+ /** Whether the text in the cell will truncate or not if constrained. */
161
+ shouldTruncate?: boolean;
162
+ }
163
+
164
+ declare interface HeadType {
165
+ cells: Array<HeadCellType>;
166
+ }
167
+
168
+ declare interface I18nShape {
169
+ /**
170
+ * Accessible label applied to the previous page button in the pagination component.
171
+ */
172
+ prev: string;
173
+ /**
174
+ * Accessible label applied to the next page button in the pagination component.
175
+ */
176
+ next: string;
177
+ /**
178
+ * Accessible label applied to the current page button in the pagination component.
179
+ */
180
+ label: string;
181
+ }
182
+
183
+ declare type LoadingSpinnerSizeType = 'small' | 'large';
184
+
185
+ declare interface RankEnd {
186
+ sourceIndex: number;
187
+ sourceKey: string;
188
+ destination?: RankEndLocation;
189
+ }
190
+
191
+ declare interface RankEndLocation {
192
+ index: number;
193
+ afterKey?: string;
194
+ beforeKey?: string;
195
+ }
196
+
197
+ declare interface RankStart {
198
+ index: number;
199
+ key: string;
200
+ }
201
+
202
+ declare interface RowCellType {
203
+ /**
204
+ * Key to resolve sorting this cell in its column.
205
+ */
206
+ key?: string | number;
207
+ /**
208
+ * The number of columns a cell should span. Defaults to 1, and maxes out at the total column width of the table.
209
+ */
210
+ colSpan?: number;
211
+ /**
212
+ * The content of the cell.
213
+ */
214
+ content?: React_2.ReactNode | string;
215
+ /**
216
+ * Hook for automated testing.
217
+ */
218
+ testId?: string;
219
+ }
220
+
221
+ declare interface RowType extends React_2.ComponentPropsWithoutRef<'tr'> {
222
+ cells: Array<RowCellType>;
223
+ key?: string;
224
+ /**
225
+ * A mouse handler to support interaction of a row.
226
+ */
227
+ onClick?: React_2.MouseEventHandler;
228
+ /**
229
+ * A key event handler to support interaction of a row.
230
+ */
231
+ onKeyPress?: React_2.KeyboardEventHandler;
232
+ /**
233
+ * Highlights the row. Should be used to draw attention to a row; not to indicate selection.
234
+ */
235
+ isHighlighted?: boolean;
236
+ /**
237
+ * Hook for automated testing.
238
+ */
239
+ testId?: string;
240
+ ref?: Ref<HTMLTableRowElement>;
241
+ }
242
+
243
+ /**
244
+ * Enum style type to determine whether sort results are ascending or descending.
245
+ */
246
+ declare type SortOrderType = 'ASC' | 'DESC';
247
+
248
+ declare interface State {
249
+ page?: number;
250
+ sortKey?: string;
251
+ sortOrder?: SortOrderType;
252
+ rows?: RowType[];
253
+ }
254
+
255
+ declare interface StatefulProps extends WithAnalyticsEventsProps {
256
+ /**
257
+ * Caption for the table styled as a heading.
258
+ */
259
+ caption?: React_2.ReactNode;
260
+ /**
261
+ * Cells to be placed in the head of the table.
262
+ * Each element in the head creates a new column.
263
+ */
264
+ head?: HeadType;
265
+ /**
266
+ * Rows to be placed in the table.
267
+ * Each row contains cells which should map to the ones defined in the head.
268
+ * Rows accept standard HTML <tr> props in addition to those listed below.
269
+
270
+ * Ensure each cell has a unique `key` per column - this is used for both React's reconciliation of lists and column sorting.
271
+ */
272
+ rows?: Array<RowType>;
273
+ /**
274
+ * Shown when the table has no content.
275
+ */
276
+ emptyView?: React_2.ReactElement<any>;
277
+ /**
278
+ * Configuration of the loading spinner shown when `isLoading` is true.
279
+ * Defaults to `"large"` when a page has more than two rows, else `"small"`.
280
+ */
281
+ loadingSpinnerSize?: LoadingSpinnerSizeType;
282
+ /**
283
+ * Displays a loading spinner overlaid on top of the current page.
284
+ */
285
+ isLoading?: boolean;
286
+ /**
287
+ * Displays columns as their initial width regardless of the content that loads in.
288
+ */
289
+ isFixedSize?: boolean;
290
+ /**
291
+ * Controls how many rows should be diplayed per page.
292
+ */
293
+ rowsPerPage?: number;
294
+ /**
295
+ * Callback fired when the table page has changed,
296
+ * useful when wanting to control dynamic table.
297
+ */
298
+ onSetPage?: (page: number, UIAnalyticsEvent?: UIAnalyticsEvent) => void;
299
+ /**
300
+ * Callback fired when a column heading has been sorted,
301
+ * useful when wanting to control dynamic table.
302
+ */
303
+ onSort?: (data: any, UIAnalyticsEvent?: UIAnalyticsEvent) => void;
304
+ /**
305
+ * Callback fired when the rows displayed on a page have changed.
306
+ */
307
+ onPageRowsUpdate?: (pageRows: Array<RowType>) => void;
308
+ /**
309
+ * Page the table should show.
310
+ * Useful when wanting to control dynamic table.
311
+ */
312
+ page?: number;
313
+ /**
314
+ * Default page dynamic table should show when initially rendering.
315
+ */
316
+ defaultPage?: number;
317
+ /**
318
+ * Column key that the rows should be sorted by.
319
+ * Corresponds to the `key`'s defined in the `head` prop.
320
+ * Useful when wanting to control dynamic table.
321
+ */
322
+ sortKey?: string;
323
+ /**
324
+ * Default column sort key that the rows should be sorted by.
325
+ * Corresponds to the `key`'s defined in the `head` prop.
326
+ */
327
+ defaultSortKey?: string;
328
+ /**
329
+ * Column sort order.
330
+ * Useful when wanting to control dynamic table.
331
+ */
332
+ sortOrder?: SortOrderType;
333
+ /**
334
+ * Default column sort order used when initially rendering.
335
+ * Defaults to `"ASC"`.
336
+ */
337
+ defaultSortOrder?: SortOrderType;
338
+ /**
339
+ * Enables drag & drop sorting of table rows.
340
+ */
341
+ isRankable?: boolean;
342
+ /**
343
+ * Disables being able to drop rows on the table.
344
+ * Drag will still function.
345
+ */
346
+ isRankingDisabled?: boolean;
347
+ /**
348
+ * Callback fired when a drag of a row has started.
349
+ */
350
+ onRankStart?: (rankStart: RankStart) => void;
351
+ /**
352
+ * Callback fired when a drop of a row has completed.
353
+ */
354
+ onRankEnd?: (rankEnd: RankEnd) => void;
355
+ /**
356
+ * Labels for the previous and next buttons used in pagination.
357
+ * Defaults to `"previous"` and `"next"`.
358
+ */
359
+ paginationi18n?: I18nShape;
360
+ /**
361
+ * Will highlight a row(s) of the table.
362
+ */
363
+ highlightedRowIndex?: number | number[];
364
+ /**
365
+ A `testId` prop is provided for specified elements,
366
+ which is a unique string that appears as a data attribute
367
+ `data-testid` in the rendered code, serving as a hook for automated tests.
368
+
369
+ The value of `testId` is used to prefix `testId` props in given elements.
370
+ - `{testId}--table` - Table.
371
+ - `{testId}--head` - Table header.
372
+ - `{testId}--head--{content of the cell}` - Table header cell can be identified by their content.
373
+ - `{testId}--row--{index - content of the first cell}` - Table row.
374
+ - `{testId}--body` - Table body.
375
+ - `{testId}--body--{content of the cell}` - Table body cell can be identified by their content.
376
+ - `{testId}--loadingSpinner` - The spinner overlaid when loading.
377
+ - `{testId}--pagination` - The table pagination.
378
+ */
379
+ testId?: string;
380
+ /**
381
+ * Used to provide a better description of the table for users with assistive technologies.
382
+ * Rather than a screen reader speaking "Entering table", passing in an label
383
+ * allows a custom message like "Entering Sample Numerical Data table".
384
+ */
385
+ label?: string;
386
+ }
387
+
388
+ declare interface StatelessProps extends WithAnalyticsEventsProps {
389
+ /**
390
+ * Caption for the table styled as a heading.
391
+ */
392
+ caption?: React_2.ReactNode;
393
+ /**
394
+ * Cells to be placed in the head of the table.
395
+ * Each element in the head creates a new column.
396
+ */
397
+ head?: HeadType;
398
+ /**
399
+ * Rows to be placed in the table.
400
+ * Each row contains cells which should map to the ones defined in the head.
401
+
402
+ * Ensure each cell has a unique `key` per column - this is used for both Reacts reconcilation of lists and column sorting.
403
+ */
404
+ rows?: Array<RowType>;
405
+ /**
406
+ * Shown when the table has no content.
407
+ */
408
+ emptyView?: React_2.ReactElement<any>;
409
+ /**
410
+ * Configuration of the loading spinner shown when `isLoading` is true.
411
+ * Defaults to `"large"` when a page has more than two rows, else `"small"`.
412
+ */
413
+ loadingSpinnerSize?: LoadingSpinnerSizeType;
414
+ /**
415
+ * Displays a loading spinner overlaid on top of the current page.
416
+ */
417
+ isLoading?: boolean;
418
+ /**
419
+ * Displays columns as their initial width regardless of the content that loads in.
420
+ */
421
+ isFixedSize?: boolean;
422
+ /**
423
+ * Controls how many rows should be displayed per page.
424
+ */
425
+ rowsPerPage?: number;
426
+ /**
427
+ * Total number of rows, in case of paginated data.
428
+ */
429
+ totalRows?: number;
430
+ /**
431
+ * Callback fired when the table page has changed,
432
+ * useful when wanting to control the pagination of the table.
433
+ */
434
+ onSetPage?: (page: number, UIAnalyticsEvent?: UIAnalyticsEvent) => void;
435
+ /**
436
+ * Callback fired when a column heading has been sorted,
437
+ * useful when wanting to control the sort order of the table.
438
+ */
439
+ onSort?: (data: any, UIAnalyticsEvent?: UIAnalyticsEvent) => void;
440
+ /**
441
+ * Callback fired when the rows displayed on a page have changed.
442
+ */
443
+ onPageRowsUpdate?: (pageRows: Array<RowType>) => void;
444
+ /**
445
+ * Page the table should show.
446
+ */
447
+ page?: number;
448
+ /**
449
+ * Column key that the rows should be sorted by.
450
+ * Corresponds to the `key`'s defined in the `head` prop.
451
+ */
452
+ sortKey?: string;
453
+ /**
454
+ * Column sort order.
455
+ */
456
+ sortOrder?: SortOrderType;
457
+ /**
458
+ * Enables drag & drop sorting of table rows.
459
+ */
460
+ isRankable?: boolean;
461
+ /**
462
+ * Disables being able to drop rows on the table.
463
+ * Drag will still function.
464
+ */
465
+ isRankingDisabled?: boolean;
466
+ /**
467
+ * Callback fired when a drag of a row has started.
468
+ */
469
+ onRankStart?: (rankStart: RankStart) => void;
470
+ /**
471
+ * Callback fired when a drop of a row has completed.
472
+ */
473
+ onRankEnd?: (rankEnd: RankEnd, uiAnalyticsEvent?: UIAnalyticsEvent) => void;
474
+ /**
475
+ * Labels for the pagination wrapper, previous and next buttons used in pagination.
476
+ * Defaults to `"pagination"`, `"previous"` and `"next"`.
477
+ */
478
+ paginationi18n?: I18nShape;
479
+ /**
480
+ * Will highlight a row(s) of the table. Should be used to draw attention to a row; not to indicate selection.
481
+ */
482
+ highlightedRowIndex?: number | number[];
483
+ /**
484
+ A `testId` prop is provided for specified elements,
485
+ which is a unique string that appears as a data attribute
486
+ `data-testid` in the rendered code, serving as a hook for automated tests.
487
+
488
+ The value of `testId` is used to prefix `testId` props in given elements.
489
+ - `{testId}--table` - Table.
490
+ - `{testId}--head` - Table header.
491
+ - `{testId}--head--{content of the cell}` - Table header cell can be identified by their content.
492
+ - `{testId}--row--{index - content of the first cell}` - Table row.
493
+ - `{testId}--body` - Table body.
494
+ - `{testId}--body--{content of the cell}` - Table body cell can be identified by their content.
495
+ - `{testId}--loadingSpinner` - The spinner overlaid when loading.
496
+ - `{testId}--pagination` - The table pagination.
497
+ */
498
+ testId?: string;
499
+ /**
500
+ * Used to provide a better description of the table for users with assistive technologies.
501
+ * Rather than a screen reader speaking "Entering table", passing in an label
502
+ * allows a custom message like "Entering Sample Numerical Data table".
503
+ */
504
+ label?: string;
505
+ }
506
+
507
+ export {};
508
+ ````