@atlaskit/table-tree 9.12.2 → 10.0.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 (53) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/components/cell.js +19 -41
  3. package/dist/cjs/components/header.js +23 -38
  4. package/dist/cjs/components/headers.js +31 -40
  5. package/dist/cjs/components/internal/chevron.js +32 -59
  6. package/dist/cjs/components/internal/item.js +38 -52
  7. package/dist/cjs/components/internal/items.js +31 -83
  8. package/dist/cjs/components/internal/loader-item.js +34 -66
  9. package/dist/cjs/components/internal/with-column-width.js +2 -4
  10. package/dist/cjs/components/row.js +120 -177
  11. package/dist/cjs/components/rows.js +17 -37
  12. package/dist/cjs/components/table-tree.js +75 -119
  13. package/dist/es2019/components/cell.js +18 -22
  14. package/dist/es2019/components/header.js +17 -21
  15. package/dist/es2019/components/headers.js +22 -19
  16. package/dist/es2019/components/internal/chevron.js +25 -35
  17. package/dist/es2019/components/internal/item.js +32 -36
  18. package/dist/es2019/components/internal/items.js +24 -60
  19. package/dist/es2019/components/internal/loader-item.js +29 -46
  20. package/dist/es2019/components/internal/with-column-width.js +2 -4
  21. package/dist/es2019/components/row.js +95 -147
  22. package/dist/es2019/components/rows.js +17 -17
  23. package/dist/es2019/components/table-tree.js +66 -90
  24. package/dist/esm/components/cell.js +19 -38
  25. package/dist/esm/components/header.js +17 -36
  26. package/dist/esm/components/headers.js +26 -40
  27. package/dist/esm/components/internal/chevron.js +29 -57
  28. package/dist/esm/components/internal/item.js +33 -53
  29. package/dist/esm/components/internal/items.js +32 -86
  30. package/dist/esm/components/internal/loader-item.js +33 -68
  31. package/dist/esm/components/internal/with-column-width.js +2 -4
  32. package/dist/esm/components/row.js +116 -179
  33. package/dist/esm/components/rows.js +17 -35
  34. package/dist/esm/components/table-tree.js +75 -121
  35. package/dist/types/components/header.d.ts +11 -1
  36. package/dist/types/components/headers.d.ts +13 -3
  37. package/dist/types/components/internal/chevron.d.ts +15 -13
  38. package/dist/types/components/internal/item.d.ts +24 -12
  39. package/dist/types/components/internal/items.d.ts +12 -23
  40. package/dist/types/components/internal/loader-item.d.ts +7 -16
  41. package/dist/types/components/row.d.ts +11 -39
  42. package/dist/types/components/rows.d.ts +15 -10
  43. package/dist/types/components/table-tree.d.ts +10 -20
  44. package/dist/types-ts4.5/components/header.d.ts +11 -1
  45. package/dist/types-ts4.5/components/headers.d.ts +13 -3
  46. package/dist/types-ts4.5/components/internal/chevron.d.ts +15 -13
  47. package/dist/types-ts4.5/components/internal/item.d.ts +24 -12
  48. package/dist/types-ts4.5/components/internal/items.d.ts +12 -23
  49. package/dist/types-ts4.5/components/internal/loader-item.d.ts +7 -16
  50. package/dist/types-ts4.5/components/row.d.ts +11 -39
  51. package/dist/types-ts4.5/components/rows.d.ts +15 -10
  52. package/dist/types-ts4.5/components/table-tree.d.ts +10 -20
  53. package/package.json +5 -9
@@ -1,27 +1,32 @@
1
- import React, { Component } from 'react';
2
- type WithChildren<T> = T & {
3
- children?: T[] | null;
1
+ import { type ReactElement } from 'react';
2
+ import { type RowProps } from './row';
3
+ type Content = {
4
+ title: string;
5
+ description: string;
4
6
  };
5
- export interface RowsProps<T> {
7
+ export interface RowsProps<Item> {
6
8
  /**
7
9
  * The data used to render the set of rows. Will be passed down via the `children` render prop.
8
10
  *
9
11
  * In addition to these props, any other data can be added to the object, and it will
10
12
  * be provided as props when rendering each cell.
11
13
  */
12
- items?: WithChildren<T>[];
14
+ items?: Item[];
13
15
  /**
14
16
  * Render function for child rows. Render props will contain an item from the
15
17
  * `items` prop above.
16
18
  */
17
- render: (args: WithChildren<T>) => React.ReactNode;
19
+ render: (args: Item & {
20
+ children?: Item[];
21
+ content?: Content;
22
+ }) => ReactElement<RowProps<Item>> | null;
18
23
  /**
19
24
  * This is an accessible name for the loading state's spinner.
20
25
  * The default text is "Loading".
21
26
  */
22
27
  loadingLabel?: string;
23
28
  }
24
- export default class Rows<T> extends Component<RowsProps<T>> {
25
- render(): JSX.Element;
26
- }
27
- export {};
29
+ declare function Rows<T extends {
30
+ id: string;
31
+ }>({ items, render, loadingLabel }: RowsProps<T>): JSX.Element;
32
+ export default Rows;
@@ -1,8 +1,5 @@
1
- import { Component, type ElementType, type ReactNode } from 'react';
1
+ import { type ElementType, type ReactNode } from 'react';
2
2
  import { type ColumnWidth } from './internal/context';
3
- import type Item from './internal/item';
4
- declare class Content extends Object {
5
- }
6
3
  /**
7
4
  * This is hard-coded here because our actual <TableTree /> has no typings
8
5
  * for its props.
@@ -11,7 +8,7 @@ declare class Content extends Object {
11
8
  *
12
9
  * Defining it here for now lets us provide *something* without much headache.
13
10
  */
14
- export type TableTreeProps = {
11
+ export interface TableTreeProps<Item> {
15
12
  /**
16
13
  * The contents of the table.
17
14
  * Use this when composing `Cell`, `Header`, `Headers`, `Row`, and `Rows` components.
@@ -22,11 +19,11 @@ export type TableTreeProps = {
22
19
  * Each column component is used to render the cells in that column.
23
20
  * A cell's `content` value, specified in the data passed to `items`, is provided as props.
24
21
  */
25
- columns?: ElementType<Content>[];
22
+ columns?: ElementType[];
26
23
  /**
27
24
  * The widths of the columns in the table.
28
25
  */
29
- columnWidths?: (string | number)[];
26
+ columnWidths?: ColumnWidth[];
30
27
  /**
31
28
  * The header text of the columns of the table.
32
29
  */
@@ -36,11 +33,11 @@ export type TableTreeProps = {
36
33
 
37
34
  If your cells contain interactive elements, always set this to `false` to avoid unexpected expanding or collapsing.
38
35
 
39
- If you arent using the `items` prop, `shouldExpandOnClick` should be used on the row component instead.
36
+ If you aren't using the `items` prop, `shouldExpandOnClick` should be used on the row component instead.
40
37
  */
41
38
  shouldExpandOnClick?: boolean;
42
39
  /**
43
- The data used to render the table. If youre creating a basic table, use this prop instead of composing cell, header, headers, row, and rows components.
40
+ The data used to render the table. If you're creating a basic table, use this prop instead of composing cell, header, headers, row, and rows components.
44
41
 
45
42
  In addition to the `items` props, any other data can be added, and it will
46
43
  be provided as props when rendering each cell.
@@ -62,15 +59,8 @@ export type TableTreeProps = {
62
59
  * Usage of either this, or the `label` attribute is strongly recommended.
63
60
  */
64
61
  referencedLabel?: string;
65
- };
66
- interface State {
67
- columnWidths: ColumnWidth[];
68
- }
69
- export default class TableTree extends Component<any, State> {
70
- state: State;
71
- componentDidMount(): void;
72
- setColumnWidth: (columnIndex: number, width: ColumnWidth) => void;
73
- getColumnWidth: (columnIndex: any) => ColumnWidth | null;
74
- render(): JSX.Element;
75
62
  }
76
- export {};
63
+ declare function TableTree<Item extends {
64
+ id: string;
65
+ }>({ children, columns, columnWidths: defaultColumnWidths, headers, shouldExpandOnClick, items, mainColumnForExpandCollapseLabel, label, referencedLabel, }: TableTreeProps<Item>): JSX.Element;
66
+ export default TableTree;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/table-tree",
3
- "version": "9.12.2",
3
+ "version": "10.0.0",
4
4
  "description": "A table tree is an expandable table for showing nested hierarchies of information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -16,10 +16,6 @@
16
16
  "atlaskit:src": "src/index.tsx",
17
17
  "atlassian": {
18
18
  "team": "Design System Team",
19
- "releaseModel": "continuous",
20
- "productPushConsumption": [
21
- "jira"
22
- ],
23
19
  "website": {
24
20
  "name": "Table tree",
25
21
  "category": "Components"
@@ -28,11 +24,12 @@
28
24
  },
29
25
  "dependencies": {
30
26
  "@atlaskit/analytics-next": "^10.1.0",
31
- "@atlaskit/button": "^20.0.0",
32
- "@atlaskit/icon": "^22.13.0",
27
+ "@atlaskit/button": "^20.1.0",
28
+ "@atlaskit/ds-lib": "^2.5.0",
29
+ "@atlaskit/icon": "^22.16.0",
33
30
  "@atlaskit/spinner": "^16.3.0",
34
31
  "@atlaskit/theme": "^13.0.0",
35
- "@atlaskit/tokens": "^1.58.0",
32
+ "@atlaskit/tokens": "^1.59.0",
36
33
  "@babel/runtime": "^7.0.0",
37
34
  "@emotion/react": "^11.7.1",
38
35
  "lodash": "^4.17.21"
@@ -43,7 +40,6 @@
43
40
  "devDependencies": {
44
41
  "@af/accessibility-testing": "*",
45
42
  "@af/visual-regression": "*",
46
- "@atlaskit/ds-lib": "^2.4.0",
47
43
  "@atlaskit/ssr": "*",
48
44
  "@atlaskit/visual-regression": "*",
49
45
  "@atlaskit/visually-hidden": "^1.5.0",