@atlaskit/dynamic-table 14.4.0 → 14.4.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/dynamic-table
2
2
 
3
+ ## 14.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1601e51ab32`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1601e51ab32) - Fixes for internal types.
8
+
3
9
  ## 14.4.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -10,4 +10,4 @@ yarn add @atlaskit/dynamic-table
10
10
 
11
11
  ## Usage
12
12
 
13
- Detailed docs and example usage can be found [here](https://atlaskit.atlassian.com/packages/core/dynamic-table).
13
+ Detailed docs and example usage can be found [here](https://atlassian.design/components/dynamic-table/usage).
@@ -31,6 +31,32 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
31
31
 
32
32
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
33
33
 
34
+ /**
35
+ * __Dynamic Table__
36
+ *
37
+ * A table displays rows of data with built-in pagination, sorting, and re-ordering functionality.
38
+ *
39
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
40
+ * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
41
+ *
42
+ * @example
43
+ * ```jsx
44
+ * import DynamicTable from '@atlaskit/dynamic-table';
45
+ *
46
+ * export default function TableUncontrolled() {
47
+ * return (
48
+ * <DynamicTable
49
+ * head={head}
50
+ * rows={rows}
51
+ * rowsPerPage={10}
52
+ * defaultPage={1}
53
+ * loadingSpinnerSize="large"
54
+ * isLoading={false}
55
+ * />
56
+ * );
57
+ * }
58
+ * ```
59
+ */
34
60
  var DynamicTable = /*#__PURE__*/function (_React$Component) {
35
61
  (0, _inherits2.default)(DynamicTable, _React$Component);
36
62
 
@@ -41,7 +41,7 @@ var _LoadingContainer = _interopRequireDefault(require("./LoadingContainer"));
41
41
 
42
42
  var _LoadingContainerAdvanced = _interopRequireDefault(require("./LoadingContainerAdvanced"));
43
43
 
44
- var _managedPagination = _interopRequireDefault(require("./managedPagination"));
44
+ var _managedPagination = _interopRequireDefault(require("./managed-pagination"));
45
45
 
46
46
  var _Body2 = _interopRequireDefault(require("./rankable/Body"));
47
47
 
@@ -52,7 +52,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
52
52
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
53
53
 
54
54
  var packageName = "@atlaskit/dynamic-table";
55
- var packageVersion = "14.4.0";
55
+ var packageVersion = "14.4.1";
56
56
 
57
57
  function toggleSortOrder(currentSortOrder) {
58
58
  switch (currentSortOrder) {
@@ -3,18 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.LOADING_CONTENTS_OPACITY = exports.XLARGE = exports.LARGE = exports.MEDIUM = exports.SMALL = exports.DESC = exports.ASC = void 0;
6
+ exports.LOADING_CONTENTS_OPACITY = exports.LARGE = exports.SMALL = exports.DESC = exports.ASC = void 0;
7
7
  var ASC = 'ASC';
8
8
  exports.ASC = ASC;
9
9
  var DESC = 'DESC';
10
10
  exports.DESC = DESC;
11
11
  var SMALL = 'small';
12
12
  exports.SMALL = SMALL;
13
- var MEDIUM = 'medium';
14
- exports.MEDIUM = MEDIUM;
15
13
  var LARGE = 'large';
16
14
  exports.LARGE = LARGE;
17
- var XLARGE = 'xlarge';
18
- exports.XLARGE = XLARGE;
19
15
  var LOADING_CONTENTS_OPACITY = 0.22;
20
16
  exports.LOADING_CONTENTS_OPACITY = LOADING_CONTENTS_OPACITY;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "14.4.0",
3
+ "version": "14.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,6 +2,33 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { reorderRows } from '../internal/helpers';
4
4
  import DynamicTableStateless from './Stateless';
5
+
6
+ /**
7
+ * __Dynamic Table__
8
+ *
9
+ * A table displays rows of data with built-in pagination, sorting, and re-ordering functionality.
10
+ *
11
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
12
+ * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
13
+ *
14
+ * @example
15
+ * ```jsx
16
+ * import DynamicTable from '@atlaskit/dynamic-table';
17
+ *
18
+ * export default function TableUncontrolled() {
19
+ * return (
20
+ * <DynamicTable
21
+ * head={head}
22
+ * rows={rows}
23
+ * rowsPerPage={10}
24
+ * defaultPage={1}
25
+ * loadingSpinnerSize="large"
26
+ * isLoading={false}
27
+ * />
28
+ * );
29
+ * }
30
+ * ```
31
+ */
5
32
  export default class DynamicTable extends React.Component {
6
33
  constructor(...args) {
7
34
  super(...args);
@@ -9,11 +9,11 @@ import { EmptyViewContainer, EmptyViewWithFixedHeight } from '../styled/EmptyBod
9
9
  import Body from './Body';
10
10
  import LoadingContainer from './LoadingContainer';
11
11
  import LoadingContainerAdvanced from './LoadingContainerAdvanced';
12
- import ManagedPagination from './managedPagination';
12
+ import ManagedPagination from './managed-pagination';
13
13
  import RankableTableBody from './rankable/Body';
14
14
  import TableHead from './TableHead';
15
15
  const packageName = "@atlaskit/dynamic-table";
16
- const packageVersion = "14.4.0";
16
+ const packageVersion = "14.4.1";
17
17
 
18
18
  function toggleSortOrder(currentSortOrder) {
19
19
  switch (currentSortOrder) {
@@ -1,7 +1,5 @@
1
1
  export const ASC = 'ASC';
2
2
  export const DESC = 'DESC';
3
3
  export const SMALL = 'small';
4
- export const MEDIUM = 'medium';
5
4
  export const LARGE = 'large';
6
- export const XLARGE = 'xlarge';
7
5
  export const LOADING_CONTENTS_OPACITY = 0.22;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "14.4.0",
3
+ "version": "14.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -14,6 +14,32 @@ import React from 'react';
14
14
  import { reorderRows } from '../internal/helpers';
15
15
  import DynamicTableStateless from './Stateless';
16
16
 
17
+ /**
18
+ * __Dynamic Table__
19
+ *
20
+ * A table displays rows of data with built-in pagination, sorting, and re-ordering functionality.
21
+ *
22
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
23
+ * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
24
+ *
25
+ * @example
26
+ * ```jsx
27
+ * import DynamicTable from '@atlaskit/dynamic-table';
28
+ *
29
+ * export default function TableUncontrolled() {
30
+ * return (
31
+ * <DynamicTable
32
+ * head={head}
33
+ * rows={rows}
34
+ * rowsPerPage={10}
35
+ * defaultPage={1}
36
+ * loadingSpinnerSize="large"
37
+ * isLoading={false}
38
+ * />
39
+ * );
40
+ * }
41
+ * ```
42
+ */
17
43
  var DynamicTable = /*#__PURE__*/function (_React$Component) {
18
44
  _inherits(DynamicTable, _React$Component);
19
45
 
@@ -20,11 +20,11 @@ import { EmptyViewContainer, EmptyViewWithFixedHeight } from '../styled/EmptyBod
20
20
  import Body from './Body';
21
21
  import LoadingContainer from './LoadingContainer';
22
22
  import LoadingContainerAdvanced from './LoadingContainerAdvanced';
23
- import ManagedPagination from './managedPagination';
23
+ import ManagedPagination from './managed-pagination';
24
24
  import RankableTableBody from './rankable/Body';
25
25
  import TableHead from './TableHead';
26
26
  var packageName = "@atlaskit/dynamic-table";
27
- var packageVersion = "14.4.0";
27
+ var packageVersion = "14.4.1";
28
28
 
29
29
  function toggleSortOrder(currentSortOrder) {
30
30
  switch (currentSortOrder) {
@@ -1,7 +1,5 @@
1
1
  export var ASC = 'ASC';
2
2
  export var DESC = 'DESC';
3
3
  export var SMALL = 'small';
4
- export var MEDIUM = 'medium';
5
4
  export var LARGE = 'large';
6
- export var XLARGE = 'xlarge';
7
5
  export var LOADING_CONTENTS_OPACITY = 0.22;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "14.4.0",
3
+ "version": "14.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
- import { SpinnerSizeType } from '../types';
3
- interface Props {
2
+ import type { SpinnerSizeType } from '../types';
3
+ interface LoadingContainerProps {
4
4
  children: React.ReactNode;
5
5
  isLoading?: boolean;
6
6
  spinnerSize?: SpinnerSizeType;
7
7
  contentsOpacity: number;
8
8
  testId?: string;
9
9
  }
10
- export default class LoadingContainer extends React.Component<Props, {}> {
10
+ export default class LoadingContainer extends React.Component<LoadingContainerProps> {
11
11
  static defaultProps: {
12
12
  isLoading: boolean;
13
13
  spinnerSize: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SpinnerSizeType } from '../types';
2
+ import type { SpinnerSizeType } from '../types';
3
3
  export interface Props {
4
4
  children: React.ReactElement<any>;
5
5
  isLoading?: boolean;
@@ -7,6 +7,32 @@ interface State {
7
7
  sortOrder?: SortOrderType;
8
8
  rows?: RowType[];
9
9
  }
10
+ /**
11
+ * __Dynamic Table__
12
+ *
13
+ * A table displays rows of data with built-in pagination, sorting, and re-ordering functionality.
14
+ *
15
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/dynamic-table)
16
+ * - [Code](https://bitbucket.org/atlassian/atlassian-frontend/packages/design-system/dynamic-table)
17
+ *
18
+ * @example
19
+ * ```jsx
20
+ * import DynamicTable from '@atlaskit/dynamic-table';
21
+ *
22
+ * export default function TableUncontrolled() {
23
+ * return (
24
+ * <DynamicTable
25
+ * head={head}
26
+ * rows={rows}
27
+ * rowsPerPage={10}
28
+ * defaultPage={1}
29
+ * loadingSpinnerSize="large"
30
+ * isLoading={false}
31
+ * />
32
+ * );
33
+ * }
34
+ * ```
35
+ */
10
36
  export default class DynamicTable extends React.Component<StatefulProps, State> {
11
37
  static defaultProps: {
12
38
  defaultPage: number;
@@ -1,16 +1,13 @@
1
1
  import React from 'react';
2
2
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- interface Props {
3
+ import type { I18nShape } from '../types';
4
+ interface ManagedPaginationProps {
4
5
  value?: number;
5
6
  onChange: (newValue: any, analyticsEvent?: UIAnalyticsEvent) => void;
6
7
  total: number;
7
- i18n?: {
8
- next: string;
9
- prev: string;
10
- label: string;
11
- };
8
+ i18n?: I18nShape;
12
9
  }
13
- export default class ManagedPagination extends React.Component<Props> {
10
+ export default class ManagedPagination extends React.Component<ManagedPaginationProps> {
14
11
  onChange: (_event: any, newValue: any, analyticsEvent?: UIAnalyticsEvent | undefined) => void;
15
12
  render(): JSX.Element;
16
13
  }
@@ -1,7 +1,5 @@
1
1
  export declare const ASC = "ASC";
2
2
  export declare const DESC = "DESC";
3
3
  export declare const SMALL = "small";
4
- export declare const MEDIUM = "medium";
5
4
  export declare const LARGE = "large";
6
- export declare const XLARGE = "xlarge";
7
5
  export declare const LOADING_CONTENTS_OPACITY = 0.22;
@@ -1,14 +1,36 @@
1
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.
245
-
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
- **/
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.
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
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.4.0",
4
- "description": "A table displays rows of data with built-in pagination, sorting, and re-ordering functionality.",
3
+ "version": "14.4.1",
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,7 +21,7 @@
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": {