@atlaskit/dynamic-table 14.3.1 → 14.4.2

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 (95) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/components/LoadingContainerAdvanced.js +3 -3
  4. package/dist/cjs/components/Stateful.js +26 -0
  5. package/dist/cjs/components/Stateless.js +2 -2
  6. package/dist/cjs/components/TableHeadCell.js +18 -48
  7. package/dist/cjs/components/{managedPagination.js → managed-pagination.js} +0 -0
  8. package/dist/cjs/components/rankable/TableCell.js +4 -4
  9. package/dist/cjs/components/rankable/TableHeadCell.js +2 -4
  10. package/dist/cjs/components/rankable/TableRow.js +3 -3
  11. package/dist/cjs/internal/constants.js +1 -5
  12. package/dist/cjs/styled/DynamicTable.js +80 -16
  13. package/dist/cjs/styled/EmptyBody.js +23 -10
  14. package/dist/cjs/styled/LoadingContainer.js +41 -8
  15. package/dist/cjs/styled/LoadingContainerAdvanced.js +42 -8
  16. package/dist/cjs/styled/TableCell.js +21 -7
  17. package/dist/cjs/styled/TableHead.js +161 -25
  18. package/dist/cjs/styled/TableRow.js +36 -18
  19. package/dist/cjs/styled/constants.js +33 -40
  20. package/dist/cjs/styled/rankable/RowPlaceholder.js +11 -4
  21. package/dist/cjs/styled/rankable/TableCell.js +18 -13
  22. package/dist/cjs/styled/rankable/TableRow.js +32 -20
  23. package/dist/cjs/theme.js +20 -18
  24. package/dist/cjs/version.json +1 -1
  25. package/dist/es2019/components/LoadingContainerAdvanced.js +2 -4
  26. package/dist/es2019/components/Stateful.js +27 -0
  27. package/dist/es2019/components/Stateless.js +2 -2
  28. package/dist/es2019/components/TableHeadCell.js +18 -22
  29. package/dist/es2019/components/{managedPagination.js → managed-pagination.js} +0 -0
  30. package/dist/es2019/components/rankable/TableCell.js +4 -4
  31. package/dist/es2019/components/rankable/TableHeadCell.js +1 -3
  32. package/dist/es2019/components/rankable/TableRow.js +3 -3
  33. package/dist/es2019/internal/constants.js +0 -2
  34. package/dist/es2019/styled/DynamicTable.js +75 -27
  35. package/dist/es2019/styled/EmptyBody.js +21 -11
  36. package/dist/es2019/styled/LoadingContainer.js +39 -18
  37. package/dist/es2019/styled/LoadingContainerAdvanced.js +38 -20
  38. package/dist/es2019/styled/TableCell.js +20 -5
  39. package/dist/es2019/styled/TableHead.js +160 -33
  40. package/dist/es2019/styled/TableRow.js +34 -20
  41. package/dist/es2019/styled/constants.js +30 -116
  42. package/dist/es2019/styled/rankable/RowPlaceholder.js +10 -4
  43. package/dist/es2019/styled/rankable/TableCell.js +16 -9
  44. package/dist/es2019/styled/rankable/TableRow.js +32 -24
  45. package/dist/es2019/theme.js +19 -18
  46. package/dist/es2019/version.json +1 -1
  47. package/dist/esm/components/LoadingContainerAdvanced.js +3 -3
  48. package/dist/esm/components/Stateful.js +26 -0
  49. package/dist/esm/components/Stateless.js +2 -2
  50. package/dist/esm/components/TableHeadCell.js +19 -47
  51. package/dist/esm/components/{managedPagination.js → managed-pagination.js} +0 -0
  52. package/dist/esm/components/rankable/TableCell.js +4 -4
  53. package/dist/esm/components/rankable/TableHeadCell.js +2 -4
  54. package/dist/esm/components/rankable/TableRow.js +3 -3
  55. package/dist/esm/internal/constants.js +0 -2
  56. package/dist/esm/styled/DynamicTable.js +77 -10
  57. package/dist/esm/styled/EmptyBody.js +23 -8
  58. package/dist/esm/styled/LoadingContainer.js +40 -8
  59. package/dist/esm/styled/LoadingContainerAdvanced.js +41 -7
  60. package/dist/esm/styled/TableCell.js +21 -7
  61. package/dist/esm/styled/TableHead.js +160 -21
  62. package/dist/esm/styled/TableRow.js +36 -12
  63. package/dist/esm/styled/constants.js +28 -30
  64. package/dist/esm/styled/rankable/RowPlaceholder.js +11 -5
  65. package/dist/esm/styled/rankable/TableCell.js +18 -9
  66. package/dist/esm/styled/rankable/TableRow.js +31 -14
  67. package/dist/esm/theme.js +19 -18
  68. package/dist/esm/version.json +1 -1
  69. package/dist/types/components/Body.d.ts +21 -21
  70. package/dist/types/components/LoadingContainer.d.ts +3 -3
  71. package/dist/types/components/LoadingContainerAdvanced.d.ts +3 -3
  72. package/dist/types/components/Stateful.d.ts +26 -0
  73. package/dist/types/components/Stateless.d.ts +3 -3
  74. package/dist/types/components/TableHeadCell.d.ts +4 -9
  75. package/dist/types/components/{managedPagination.d.ts → managed-pagination.d.ts} +4 -7
  76. package/dist/types/components/rankable/Body.d.ts +21 -21
  77. package/dist/types/components/rankable/TableHeadCell.d.ts +1 -1
  78. package/dist/types/components/rankable/TableRow.d.ts +3 -3
  79. package/dist/types/hoc/withDimensions.d.ts +2 -2
  80. package/dist/types/hoc/withSortedPageRows.d.ts +20 -20
  81. package/dist/types/internal/constants.d.ts +0 -2
  82. package/dist/types/styled/DynamicTable.d.ts +13 -6
  83. package/dist/types/styled/EmptyBody.d.ts +4 -3
  84. package/dist/types/styled/LoadingContainer.d.ts +8 -7
  85. package/dist/types/styled/LoadingContainerAdvanced.d.ts +5 -4
  86. package/dist/types/styled/TableCell.d.ts +3 -2
  87. package/dist/types/styled/TableHead.d.ts +8 -5
  88. package/dist/types/styled/TableRow.d.ts +7 -4
  89. package/dist/types/styled/constants.d.ts +13 -10
  90. package/dist/types/styled/rankable/RowPlaceholder.d.ts +3 -2
  91. package/dist/types/styled/rankable/TableCell.d.ts +8 -6
  92. package/dist/types/styled/rankable/TableRow.d.ts +9 -6
  93. package/dist/types/theme.d.ts +9 -9
  94. package/dist/types/types.d.ts +76 -37
  95. package/package.json +16 -9
@@ -1,14 +1,36 @@
1
- import React, { RefObject } from 'react';
1
+ import React, { Ref } from 'react';
2
2
  import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import type { Size as SizeType } from '@atlaskit/spinner';
3
4
  export interface RowCellType {
5
+ /**
6
+ * Key to resolve sorting this cell in its column.
7
+ */
4
8
  key?: string | number;
9
+ /**
10
+ * The number of columns a cell should span. Defaults to 1, and maxes out at the total column width of the table.
11
+ */
5
12
  colSpan?: number;
13
+ /**
14
+ * The content of the cell.
15
+ */
6
16
  content?: React.ReactNode | string;
17
+ /**
18
+ * Hook for automated testing.
19
+ */
7
20
  testId?: string;
8
21
  }
9
22
  export interface I18nShape {
23
+ /**
24
+ * Accessible label applied to the previous page button in the pagination component.
25
+ */
10
26
  prev: string;
27
+ /**
28
+ * Accessible label applied to the next page button in the pagination component.
29
+ */
11
30
  next: string;
31
+ /**
32
+ * Accessible label applied to the current page button in the pagination component.
33
+ */
12
34
  label: string;
13
35
  }
14
36
  export interface StatelessProps extends WithAnalyticsEventsProps {
@@ -49,16 +71,18 @@ export interface StatelessProps extends WithAnalyticsEventsProps {
49
71
  * Controls how many rows should be displayed per page.
50
72
  */
51
73
  rowsPerPage?: number;
52
- /** Total number of rows, in case of paginated data. Optional */
74
+ /**
75
+ * Total number of rows, in case of paginated data.
76
+ */
53
77
  totalRows?: number;
54
78
  /**
55
79
  * Callback fired when the table page has changed,
56
- * useful when wanting to control dynamic table.
80
+ * useful when wanting to control the pagination of the table.
57
81
  */
58
82
  onSetPage?: (page: number, UIAnalyticsEvent?: UIAnalyticsEvent) => void;
59
83
  /**
60
84
  * Callback fired when a column heading has been sorted,
61
- * useful when wanting to control dynamic table.
85
+ * useful when wanting to control the sort order of the table.
62
86
  */
63
87
  onSort?: (data: any, UIAnalyticsEvent?: UIAnalyticsEvent) => void;
64
88
  /**
@@ -101,31 +125,29 @@ export interface StatelessProps extends WithAnalyticsEventsProps {
101
125
  */
102
126
  paginationi18n?: I18nShape;
103
127
  /**
104
- * Will highlight a row(s) of the table.
128
+ * Will highlight a row(s) of the table. Should be used to draw attention to a row; not to indicate selection.
105
129
  */
106
130
  highlightedRowIndex?: number | number[];
107
131
  /**
108
- A `testId` prop is provided for specified elements,
109
- which is a unique string that appears as a data attribute
110
- `data-testid` in the rendered code,
111
- serving as a hook for automated tests.
112
-
113
- The value of `testId` is used to prefix `testId` props in given elements.
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.
114
135
 
115
- * `${testId}--table` - Table.
116
- * `${testId}--head` - Table header.
117
- * `${testId}--head--{content of the cell}` - Table header cell can be identified by their content.
118
- * `${testId}--row--{index - content of the first cell}` - Table row.
119
- * `${testId}--body` - Table body.
120
- * `${testId}--body--{content of the cell}` - Table body cell can be identified by their content.
121
- * `${testId}--loadingSpinner` - The spinner overlaid when loading.
122
- **/
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
+ */
123
145
  testId?: string;
124
146
  /**
125
147
  * Used to provide a better description of the table for users with assistive technologies.
126
148
  * Rather than a screen reader speaking "Entering table", passing in an label
127
149
  * allows a custom message like "Entering Sample Numerical Data table".
128
- **/
150
+ */
129
151
  label?: string;
130
152
  }
131
153
  export interface StatefulProps extends WithAnalyticsEventsProps {
@@ -238,43 +260,60 @@ export interface StatefulProps extends WithAnalyticsEventsProps {
238
260
  */
239
261
  highlightedRowIndex?: number | number[];
240
262
  /**
241
- A `testId` prop is provided for specified elements,
242
- which is a unique string that appears as a data attribute
243
- `data-testid` in the rendered code,
244
- serving as a hook for automated tests.
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.
245
266
 
246
- The value of `testId` is used to prefix `testId` props in given elements.
247
-
248
- * `${testId}--table` - Table.
249
- * `${testId}--head` - Table header.
250
- * `${testId}--head--{content of the cell}` - Table header cell can be identified by their content.
251
- * `${testId}--row--{index - content of the first cell}` - Table row.
252
- * `${testId}--body` - Table body.
253
- * `${testId}--body--{content of the cell}` - Table body cell can be identified by their content.
254
- * `${testId}--loadingSpinner` - The spinner overlaid when loading.
255
- **/
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.
275
+ */
256
276
  testId?: string;
257
277
  /**
258
278
  * Used to provide a better description of the table for users with assistive technologies.
259
279
  * Rather than a screen reader speaking "Entering table", passing in an label
260
280
  * allows a custom message like "Entering Sample Numerical Data table".
261
- **/
281
+ */
262
282
  label?: string;
263
283
  }
264
284
  export interface RowType extends React.ComponentPropsWithoutRef<'tr'> {
265
285
  cells: Array<RowCellType>;
266
286
  key?: string;
287
+ /**
288
+ * A mouse handler to support interaction of a row.
289
+ */
267
290
  onClick?: React.MouseEventHandler;
291
+ /**
292
+ * A key event handler to support interaction of a row.
293
+ */
268
294
  onKeyPress?: React.KeyboardEventHandler;
295
+ /**
296
+ * Hook for automated testing.
297
+ */
269
298
  testId?: string;
270
- innerRef?: RefObject<HTMLElement>;
299
+ ref?: Ref<HTMLTableRowElement>;
271
300
  }
301
+ /**
302
+ * Enum style type to determine whether sort results are ascending or descending.
303
+ */
272
304
  export declare type SortOrderType = 'ASC' | 'DESC';
273
- export declare type SpinnerSizeType = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
305
+ /**
306
+ * Determines the size of the table loading spinner.
307
+ * This matches the underlying `Size` type in `@atlaskit/spinner`
308
+ */
309
+ export declare type SpinnerSizeType = SizeType;
274
310
  export declare type LoadingSpinnerSizeType = 'small' | 'large';
275
311
  export interface HeadCellType extends RowCellType {
312
+ /** Whether the column the cell sits above is sortable. */
276
313
  isSortable?: boolean;
314
+ /** The pixel width of the cell. */
277
315
  width?: number;
316
+ /** Whether the text in the cell will truncate or not if constrained. */
278
317
  shouldTruncate?: boolean;
279
318
  }
280
319
  export interface RankEndLocation {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "14.3.1",
4
- "description": "A table displays rows of data with built-in pagination, sorting, and re-ordering functionality.",
3
+ "version": "14.4.2",
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
+ "homepage": "https://atlassian.design/components/dynamic-table/",
8
9
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
9
10
  "author": "Atlassian Pty Ltd",
10
11
  "license": "Apache-2.0",
@@ -20,42 +21,48 @@
20
21
  "inPublicMirror": true,
21
22
  "releaseModel": "scheduled",
22
23
  "website": {
23
- "name": "Dynamic Table"
24
+ "name": "Dynamic table"
24
25
  }
25
26
  },
26
27
  "dependencies": {
27
28
  "@atlaskit/analytics-next": "^8.0.0",
28
29
  "@atlaskit/pagination": "^14.0.0",
29
30
  "@atlaskit/spinner": "^15.0.0",
30
- "@atlaskit/theme": "^11.3.0",
31
+ "@atlaskit/theme": "^12.0.0",
32
+ "@atlaskit/tokens": "^0.3.0",
31
33
  "@babel/runtime": "^7.0.0",
34
+ "@emotion/core": "^10.0.9",
32
35
  "react-beautiful-dnd": "^12.1.1"
33
36
  },
34
37
  "peerDependencies": {
35
38
  "react": "^16.8.0",
36
- "react-dom": "^16.8.0",
37
- "styled-components": "^3.2.6"
39
+ "react-dom": "^16.8.0"
38
40
  },
39
41
  "devDependencies": {
40
- "@atlaskit/avatar": "^20.0.0",
42
+ "@atlaskit/avatar": "^20.5.0",
41
43
  "@atlaskit/build-utils": "*",
42
- "@atlaskit/button": "^15.1.0",
44
+ "@atlaskit/button": "^16.0.0",
43
45
  "@atlaskit/docs": "*",
44
46
  "@atlaskit/dropdown-menu": "^10.1.0",
45
47
  "@atlaskit/ssr": "*",
46
- "@atlaskit/toggle": "^12.2.0",
48
+ "@atlaskit/toggle": "^12.3.0",
47
49
  "@atlaskit/visual-regression": "*",
48
50
  "@atlaskit/webdriver-runner": "*",
49
51
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
52
+ "@emotion/styled": "^10.0.7",
50
53
  "@testing-library/react": "^8.0.1",
51
54
  "enzyme": "^3.10.0",
52
55
  "react-dom": "^16.8.0",
56
+ "styled-components": "^3.2.6",
53
57
  "typescript": "3.9.6",
54
58
  "uuid": "^3.1.0"
55
59
  },
56
60
  "techstack": {
57
61
  "@atlassian/frontend": {
58
62
  "import-structure": "atlassian-conventions"
63
+ },
64
+ "@repo/internal": {
65
+ "theming": "tokens"
59
66
  }
60
67
  },
61
68
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"