@atlaskit/table-tree 9.1.8 → 9.2.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 (35) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/components/header.js +10 -4
  3. package/dist/cjs/components/headers.js +10 -4
  4. package/dist/cjs/components/internal/common-cell.js +11 -5
  5. package/dist/cjs/components/internal/item.js +3 -3
  6. package/dist/cjs/components/internal/overflow-container.js +14 -5
  7. package/dist/cjs/components/internal/styled.js +37 -20
  8. package/dist/cjs/components/row.js +1 -1
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/components/header.js +8 -3
  11. package/dist/es2019/components/headers.js +10 -3
  12. package/dist/es2019/components/internal/common-cell.js +9 -6
  13. package/dist/es2019/components/internal/item.js +1 -1
  14. package/dist/es2019/components/internal/overflow-container.js +10 -6
  15. package/dist/es2019/components/internal/styled.js +28 -16
  16. package/dist/es2019/components/row.js +1 -1
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/components/header.js +8 -3
  19. package/dist/esm/components/headers.js +8 -3
  20. package/dist/esm/components/internal/common-cell.js +9 -6
  21. package/dist/esm/components/internal/item.js +1 -1
  22. package/dist/esm/components/internal/overflow-container.js +12 -6
  23. package/dist/esm/components/internal/styled.js +31 -17
  24. package/dist/esm/components/row.js +1 -1
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/components/cell.d.ts +12 -0
  27. package/dist/types/components/headers.d.ts +2 -1
  28. package/dist/types/components/internal/item.d.ts +2 -1
  29. package/extract-react-types/table-tree-cell.tsx +7 -0
  30. package/extract-react-types/table-tree-header.tsx +20 -0
  31. package/extract-react-types/table-tree-row.tsx +85 -0
  32. package/extract-react-types/table-tree-rows.tsx +34 -0
  33. package/extract-react-types/table-tree.tsx +6 -5
  34. package/package.json +12 -9
  35. package/report.api.md +369 -0
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _styled from "styled-components";
6
7
 
7
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
9
 
@@ -12,12 +13,17 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
13
 
13
14
  /* eslint-disable @repo/internal/react/no-clone-element */
14
15
  import { Children, cloneElement, Component } from 'react';
15
- import { css, jsx } from '@emotion/core';
16
+ import { css, jsx } from '@emotion/react';
16
17
  var containerStyles = css({
17
18
  display: 'flex',
18
19
  borderBottom: "solid 2px ".concat("var(--ds-border, #dfe1e6)")
19
20
  });
20
21
 
22
+ var _StyledDiv = _styled("div").withConfig({
23
+ displayName: "headers___StyledDiv",
24
+ componentId: "h5d3f7-0"
25
+ })(["", ""], containerStyles);
26
+
21
27
  var Headers = /*#__PURE__*/function (_Component) {
22
28
  _inherits(Headers, _Component);
23
29
 
@@ -32,8 +38,7 @@ var Headers = /*#__PURE__*/function (_Component) {
32
38
  _createClass(Headers, [{
33
39
  key: "render",
34
40
  value: function render() {
35
- return jsx("div", {
36
- css: containerStyles,
41
+ return jsx(_StyledDiv, {
37
42
  role: "row"
38
43
  }, Children.map(this.props.children, function (header, index) {
39
44
  return (
@@ -1,9 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _styled from "styled-components";
3
4
  var _excluded = ["indent", "width"];
4
-
5
- /** @jsx jsx */
6
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
7
6
  import { N800 } from '@atlaskit/theme/colors';
8
7
  var commonStyles = css({
9
8
  display: 'flex',
@@ -16,6 +15,11 @@ var commonStyles = css({
16
15
  lineHeight: '20px'
17
16
  });
18
17
 
18
+ var _StyledDiv = _styled("div").withConfig({
19
+ displayName: "common-cell___StyledDiv",
20
+ componentId: "t3yvaw-0"
21
+ })(["", ""], commonStyles);
22
+
19
23
  /**
20
24
  * __Common cell__
21
25
  */
@@ -24,12 +28,11 @@ var CommonCell = function CommonCell(_ref) {
24
28
  width = _ref.width,
25
29
  props = _objectWithoutProperties(_ref, _excluded);
26
30
 
27
- return jsx("div", _extends({}, props, {
31
+ return jsx(_StyledDiv, _extends({}, props, {
28
32
  style: {
29
33
  '--indent': indent,
30
34
  width: width
31
- },
32
- css: commonStyles
35
+ }
33
36
  }));
34
37
  };
35
38
 
@@ -13,7 +13,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
13
13
 
14
14
  /* eslint-disable @repo/internal/react/no-clone-element */
15
15
  import { cloneElement, Component } from 'react';
16
- import { jsx } from '@emotion/core';
16
+ import { jsx } from '@emotion/react';
17
17
  import toItemId from '../../utils/to-item-id';
18
18
  import Items from './items';
19
19
 
@@ -1,9 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _styled from "styled-components";
3
4
  var _excluded = ["isSingleLine"];
4
-
5
- /** @jsx jsx */
6
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
7
6
  var overflowContainerStyles = css({
8
7
  overflow: 'hidden',
9
8
  textOverflow: 'ellipsis',
@@ -13,14 +12,21 @@ var overflowContainerStyles = css({
13
12
  * __Overflow container__
14
13
  */
15
14
 
15
+ var _StyledSpan = _styled("span").withConfig({
16
+ displayName: "overflow-container___StyledSpan",
17
+ componentId: "sc-1m74akj-0"
18
+ })(["", ""], function (p) {
19
+ return p._css;
20
+ });
21
+
16
22
  var OverflowContainer = function OverflowContainer(_ref) {
17
23
  var isSingleLine = _ref.isSingleLine,
18
24
  props = _objectWithoutProperties(_ref, _excluded);
19
25
 
20
26
  return (// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
21
- jsx("span", _extends({
22
- css: isSingleLine && overflowContainerStyles
23
- }, props))
27
+ jsx(_StyledSpan, _extends({}, props, {
28
+ _css: isSingleLine && overflowContainerStyles
29
+ }))
24
30
  );
25
31
  };
26
32
 
@@ -1,9 +1,8 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _styled from "styled-components";
3
4
  var _excluded = ["isRoot"];
4
-
5
- /** @jsx jsx */
6
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
7
6
  import { N30, N800 } from '@atlaskit/theme/colors';
8
7
  export var iconColor = "var(--ds-text, ".concat(N800, ")");
9
8
  var treeRowContainerStyles = css({
@@ -14,11 +13,14 @@ var treeRowContainerStyles = css({
14
13
  * __Tree row container__
15
14
  */
16
15
 
16
+ var _StyledDiv = _styled("div").withConfig({
17
+ displayName: "styled___StyledDiv",
18
+ componentId: "sc-8rz2kg-0"
19
+ })(["", ""], treeRowContainerStyles);
20
+
17
21
  export var TreeRowContainer = function TreeRowContainer(props) {
18
22
  return (// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
19
- jsx("div", _extends({
20
- css: treeRowContainerStyles
21
- }, props))
23
+ jsx(_StyledDiv, props)
22
24
  );
23
25
  };
24
26
  var commonChevronContainerStyles = css({
@@ -32,11 +34,14 @@ var commonChevronContainerStyles = css({
32
34
  * __Chevron container__
33
35
  */
34
36
 
37
+ var _StyledSpan = _styled("span").withConfig({
38
+ displayName: "styled___StyledSpan",
39
+ componentId: "sc-8rz2kg-1"
40
+ })(["", ""], commonChevronContainerStyles);
41
+
35
42
  export var ChevronContainer = function ChevronContainer(props // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
36
43
  ) {
37
- return jsx("span", _extends({}, props, {
38
- css: commonChevronContainerStyles
39
- }));
44
+ return jsx(_StyledSpan, props);
40
45
  };
41
46
  var chevronIconContainerStyles = css({
42
47
  position: 'relative',
@@ -48,11 +53,14 @@ var chevronIconContainerStyles = css({
48
53
  * A chevron icon container.
49
54
  */
50
55
 
56
+ var _StyledSpan2 = _styled("span").withConfig({
57
+ displayName: "styled___StyledSpan2",
58
+ componentId: "sc-8rz2kg-2"
59
+ })(["", ""], chevronIconContainerStyles);
60
+
51
61
  export var ChevronIconContainer = function ChevronIconContainer(props // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
52
62
  ) {
53
- return jsx("span", _extends({}, props, {
54
- css: chevronIconContainerStyles
55
- }));
63
+ return jsx(_StyledSpan2, props);
56
64
  };
57
65
  var loadingItemContainerStyles = css({
58
66
  width: '100%',
@@ -67,12 +75,18 @@ var paddingLeftStyles = css({
67
75
  * A loader item container.
68
76
  */
69
77
 
78
+ var _StyledSpan3 = _styled("span").withConfig({
79
+ displayName: "styled___StyledSpan3",
80
+ componentId: "sc-8rz2kg-3"
81
+ })(["", ""], function (p) {
82
+ return p._css;
83
+ });
84
+
70
85
  export var LoaderItemContainer = function LoaderItemContainer(_ref) {
71
86
  var isRoot = _ref.isRoot,
72
87
  props = _objectWithoutProperties(_ref, _excluded);
73
88
 
74
- return jsx("span", _extends({
75
- css: [commonChevronContainerStyles, loadingItemContainerStyles, isRoot && paddingLeftStyles] // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
76
-
77
- }, props));
89
+ return jsx(_StyledSpan3, _extends({}, props, {
90
+ _css: [commonChevronContainerStyles, loadingItemContainerStyles, isRoot && paddingLeftStyles]
91
+ }));
78
92
  };
@@ -18,7 +18,7 @@ import toItemId from '../utils/to-item-id';
18
18
  import Chevron from './internal/chevron';
19
19
  import { TreeRowContainer } from './internal/styled';
20
20
  var packageName = "@atlaskit/table-tree";
21
- var packageVersion = "9.1.8";
21
+ var packageVersion = "9.2.0";
22
22
 
23
23
  var Row = /*#__PURE__*/function (_Component) {
24
24
  _inherits(Row, _Component);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/table-tree",
3
- "version": "9.1.8",
3
+ "version": "9.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,20 @@
1
1
  import React from 'react';
2
2
  export interface CellProps {
3
+ /**
4
+ * Whether the cell contents should wrap or display on a single line and be concatenated.
5
+ */
3
6
  singleLine?: boolean;
7
+ /**
8
+ * Indent level for the cell. Each indent level adds 25px to the left padding.
9
+ */
4
10
  indentLevel?: number;
11
+ /**
12
+ * Width of the header item. Takes a string or a number representing the width in pixels.
13
+ */
5
14
  width?: number | string;
15
+ /**
16
+ * Class name to apply to cell.
17
+ */
6
18
  className?: string;
7
19
  }
8
20
  declare const _default: {
@@ -1,5 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { Component } from 'react';
3
+ import { jsx } from '@emotion/react';
3
4
  export default class Headers extends Component<any> {
4
- render(): JSX.Element;
5
+ render(): jsx.JSX.Element;
5
6
  }
@@ -1,5 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { Component } from 'react';
3
+ import { jsx } from '@emotion/react';
3
4
  export default class Item extends Component<any> {
4
5
  static defaultProps: {
5
6
  depth: number;
@@ -7,6 +8,6 @@ export default class Item extends Component<any> {
7
8
  render(): import("react").FunctionComponentElement<{
8
9
  depth: any;
9
10
  data: any;
10
- renderChildren: () => JSX.Element;
11
+ renderChildren: () => jsx.JSX.Element;
11
12
  }> | null;
12
13
  }
@@ -0,0 +1,7 @@
1
+ import { CellProps } from '../src/components/cell';
2
+
3
+ const TableRows = function (props: CellProps) {
4
+ return null;
5
+ };
6
+
7
+ export default TableRows;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This is hard-coded here because our actual <Header /> has no typings
3
+ * for its props.
4
+ *
5
+ * Adding types for real *might* break things so will need a little care.
6
+ *
7
+ * Defining it here for now lets us provide *something* without much headache.
8
+ */
9
+ type HeaderProps = {
10
+ /**
11
+ * Width of the header item. Takes a string, or a number representing the width in pixels.
12
+ */
13
+ width?: string | number;
14
+ };
15
+
16
+ const TableHeader = function (props: HeaderProps) {
17
+ return null;
18
+ };
19
+
20
+ export default TableHeader;
@@ -0,0 +1,85 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ import { Item } from './table-tree';
4
+
5
+ /**
6
+ * This is hard-coded here because our actual <TableTree /> has no typings
7
+ * for its props.
8
+ *
9
+ * Adding types for real *might* break things so will need a little care.
10
+ *
11
+ * Defining it here for now lets us provide *something* without much headache.
12
+ */
13
+ type RowProps = {
14
+ /**
15
+ * Whether the row has children
16
+ */
17
+ hasChildren?: boolean;
18
+ /**
19
+ * Children contained in the row. Should be one or more Cell components.
20
+ */
21
+ children?: React.ReactNode;
22
+ /**
23
+ * ID for the row item
24
+ */
25
+ itemId?: string;
26
+ // eslint-disable-next-line jsdoc/require-asterisk-prefix, jsdoc/check-alignment
27
+ /**
28
+ The data used to render the row and descendants. Pass down from `children` render prop.
29
+
30
+ In addition to these props, any other data can be added to the object, and it will
31
+ be provided as props when rendering each cell.
32
+ */
33
+ // eslint-disable-next-line @repo/internal/react/consistent-props-definitions
34
+ items?: Item[] | null;
35
+ /**
36
+ * Controls the expanded state of the row.
37
+ */
38
+ isExpanded?: ReactNode;
39
+ /**
40
+ * Sets the default expanded state of the row.
41
+ */
42
+ isDefaultExpanded?: ReactNode;
43
+ /**
44
+ * `aria-label` attached to the expand chevron button
45
+ */
46
+ expandLabel?: string;
47
+ /**
48
+ * `aria-label` attached to the collapse chevron button
49
+ */
50
+ collapseLabel?: string;
51
+ /**
52
+ * Callback called when row collapses.
53
+ */
54
+ onCollapse?: (data: Item) => void;
55
+ /**
56
+ * Callback called when row expands.
57
+ */
58
+ onExpand?: (data: Item) => void;
59
+ /**
60
+ * Children to render under row.
61
+ * Normally set by parent Item component and does not need to be configured.
62
+ */
63
+ renderChildren?: () => React.ReactNode;
64
+ /**
65
+ * Data to render. Passed down by Item and passed into onExpand and onCollapse callbacks.
66
+ * Normally set by parent Item component and does not need to be configured.
67
+ */
68
+ // eslint-disable-next-line @repo/internal/react/consistent-props-definitions
69
+ data?: Item;
70
+ /**
71
+ * Depth used for rendering indent.
72
+ * Normally set by parent Item component and does not need to be configured.
73
+ */
74
+ depth?: number;
75
+ };
76
+
77
+ const TableRow = function (props: RowProps) {
78
+ return null;
79
+ };
80
+
81
+ TableRow.defaultProps = {
82
+ isDefaultExpanded: false,
83
+ };
84
+
85
+ export default TableRow;
@@ -0,0 +1,34 @@
1
+ import { Item } from './table-tree';
2
+
3
+ /**
4
+ * This is hard-coded here because our actual <Rows /> has no typings
5
+ * for its props.
6
+ *
7
+ * Adding types for real *might* break things so will need a little care.
8
+ *
9
+ * Defining it here for now lets us provide *something* without much headache.
10
+ */
11
+ type RowsProps = {
12
+ // eslint-disable-next-line jsdoc/require-asterisk-prefix, jsdoc/check-alignment
13
+ /**
14
+ The data used to render the set of rows. Will be passed down via the `children` render prop.
15
+
16
+ In addition to these props, any other data can be added to the object, and it will
17
+ be provided as props when rendering each cell.
18
+ */
19
+ // eslint-disable-next-line @repo/internal/react/consistent-props-definitions
20
+ items?: Item[] | null;
21
+ /**
22
+ * Render function for child rows. Render props will contain an item from the
23
+ * `items` prop above.
24
+ */
25
+ render?: (item: Item) => React.ReactNode;
26
+ };
27
+
28
+ const TableRows = function (props: RowsProps) {
29
+ return null;
30
+ };
31
+
32
+ TableRows.defaultProps = {};
33
+
34
+ export default TableRows;
@@ -2,9 +2,8 @@ import { ElementType, ReactNode } from 'react';
2
2
 
3
3
  class Content extends Object {}
4
4
 
5
- type Item = {
5
+ export type Item = {
6
6
  id: string;
7
- content: Content;
8
7
  hasChildren: boolean;
9
8
  children?: Item[];
10
9
  };
@@ -37,10 +36,12 @@ type TableTreeProps = {
37
36
  * The header text of the respective columns of the table.
38
37
  */
39
38
  headers?: string[];
39
+ // eslint-disable-next-line jsdoc/require-asterisk-prefix, jsdoc/check-alignment
40
40
  /**
41
- * The data used to render the table.
42
- * The type of `content` can be whatever you would like, and its value will be
43
- * provided as props when rendering each cell.
41
+ The data used to render the table.
42
+
43
+ In addition to these props, any other data can be added, and it will
44
+ be provided as props when rendering each cell.
44
45
  */
45
46
  // eslint-disable-next-line @repo/internal/react/consistent-props-definitions
46
47
  items?: Item[] | null;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/table-tree",
3
- "version": "9.1.8",
3
+ "version": "9.2.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/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -19,7 +19,8 @@
19
19
  "team": "Design System Team",
20
20
  "releaseModel": "scheduled",
21
21
  "website": {
22
- "name": "Table tree"
22
+ "name": "Table tree",
23
+ "category": "Components"
23
24
  }
24
25
  },
25
26
  "af:exports": {
@@ -30,10 +31,10 @@
30
31
  "@atlaskit/button": "^16.3.0",
31
32
  "@atlaskit/icon": "^21.10.0",
32
33
  "@atlaskit/spinner": "^15.0.0",
33
- "@atlaskit/theme": "^12.1.0",
34
+ "@atlaskit/theme": "^12.2.0",
34
35
  "@atlaskit/tokens": "^0.10.0",
35
36
  "@babel/runtime": "^7.0.0",
36
- "@emotion/core": "^10.0.9",
37
+ "@emotion/react": "^11.7.1",
37
38
  "lodash": "^4.17.21",
38
39
  "prop-types": "^15.5.10"
39
40
  },
@@ -42,13 +43,14 @@
42
43
  },
43
44
  "devDependencies": {
44
45
  "@atlaskit/docs": "*",
45
- "@atlaskit/empty-state": "^7.3.0",
46
- "@atlaskit/section-message": "^6.0.0",
47
- "@atlaskit/select": "^15.0.0",
46
+ "@atlaskit/ds-lib": "^2.0.1",
47
+ "@atlaskit/empty-state": "^7.4.0",
48
+ "@atlaskit/section-message": "^6.2.0",
49
+ "@atlaskit/select": "^15.7.0",
48
50
  "@atlaskit/ssr": "*",
49
51
  "@atlaskit/visual-regression": "*",
50
52
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
51
- "@emotion/styled": "^10.0.7",
53
+ "@emotion/styled": "^11.0.0",
52
54
  "enzyme": "^3.10.0",
53
55
  "exenv": "^1.2.2",
54
56
  "react-dom": "^16.8.0",
@@ -68,6 +70,7 @@
68
70
  "circular-dependencies": "file-and-folder-level"
69
71
  },
70
72
  "@repo/internal": {
73
+ "dom-events": "use-bind-event-listener",
71
74
  "design-system": "v1",
72
75
  "styling": [
73
76
  "static",