@sproutsocial/racine 7.1.0-beta-maurice.0 → 7.2.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +9 -38
  3. package/__flow__/Box/styles.js +5 -5
  4. package/__flow__/ChartLegend/styles.js +6 -6
  5. package/__flow__/Checkbox/index.js +4 -1
  6. package/__flow__/Checkbox/index.stories.js +16 -0
  7. package/__flow__/Checkbox/index.test.js +33 -0
  8. package/__flow__/Table/index.js +82 -54
  9. package/__flow__/Table/index.stories.js +41 -0
  10. package/__flow__/Table/index.test.js +14 -0
  11. package/__flow__/TableCell/index.js +17 -7
  12. package/__flow__/TableCell/index.test.js +8 -1
  13. package/__flow__/TableHeaderCell/index.js +26 -11
  14. package/__flow__/TableHeaderCell/index.test.js +16 -1
  15. package/__flow__/TableRowAccordion/index.js +1 -1
  16. package/__flow__/Text/index.js +47 -3
  17. package/__flow__/Text/index.stories.js +39 -118
  18. package/__flow__/Text/index.test.js +16 -0
  19. package/__flow__/Text/styles.js +1 -0
  20. package/__flow__/utils/theme.js +0 -1
  21. package/commonjs/Checkbox/index.js +6 -6
  22. package/commonjs/Table/index.js +80 -71
  23. package/commonjs/TableCell/index.js +4 -3
  24. package/commonjs/TableHeaderCell/index.js +35 -20
  25. package/commonjs/TableRowAccordion/index.js +2 -2
  26. package/commonjs/Text/index.js +72 -3
  27. package/commonjs/Text/styles.js +3 -1
  28. package/lib/Checkbox/index.js +6 -6
  29. package/lib/Table/index.js +61 -64
  30. package/lib/TableCell/index.js +4 -3
  31. package/lib/TableHeaderCell/index.js +35 -20
  32. package/lib/TableRowAccordion/index.js +2 -2
  33. package/lib/Text/index.js +70 -3
  34. package/lib/Text/styles.js +3 -1
  35. package/package.json +4 -9
  36. package/__flow__/.DS_Store +0 -0
@@ -35,7 +35,7 @@ export default class TableRowAccordion extends React.Component<TypeProps> {
35
35
  <Container {...rest} data-qa-table-row-accordion={isExpanded} key={id}>
36
36
  <tr data-tablerowaccordion-summary onClick={this.handleToggle}>
37
37
  {cells.map((td) => {
38
- return <TableCell key={td.id} {...td} />;
38
+ return <TableCell {...td} key={td.id} />;
39
39
  })}
40
40
  <TableCell
41
41
  id="tableRowAccordion_trigger"
@@ -1,6 +1,7 @@
1
1
  //@flow
2
2
  import * as React from "react";
3
3
  import Container from "./styles";
4
+ import styled from "styled-components";
4
5
 
5
6
  type TypeProps = {
6
7
  /** Maps to the typeScale system prop, sets font size and line height using Seeds values */
@@ -25,9 +26,44 @@ type TypeProps = {
25
26
  qa?: Object,
26
27
  };
27
28
 
28
- /**
29
- * The Text Component is used to render textual content in various presentations.
30
- */
29
+ const Headline = styled(Container)`
30
+ color: ${(props) => props.theme.colors.text.headline};
31
+ font-weight: ${(props) => props.theme.fontWeights.bold};
32
+ ${(props) => props.theme.typography[400]}
33
+ `;
34
+
35
+ const SubHeadline = styled(Container)`
36
+ color: ${(props) => props.theme.colors.text.headline};
37
+ font-weight: ${(props) => props.theme.fontWeights.bold};
38
+ ${(props) => props.theme.typography[300]}
39
+ `;
40
+
41
+ const SmallSubHeadline = styled(Container)`
42
+ color: ${(props) => props.theme.colors.text.headline};
43
+ font-weight: ${(props) => props.theme.fontWeights.bold};
44
+ ${(props) => props.theme.typography[200]}
45
+ `;
46
+
47
+ const Byline = styled(Container)`
48
+ color: ${(props) => props.theme.colors.text.subtext};
49
+ ${(props) => props.theme.typography[200]}
50
+ `;
51
+
52
+ const SmallByline = styled(Container)`
53
+ color: ${(props) => props.theme.colors.text.subtext};
54
+ ${(props) => props.theme.typography[100]}
55
+ `;
56
+
57
+ const BodyCopy = styled(Container)`
58
+ color: ${(props) => props.theme.colors.text.body};
59
+ ${(props) => props.theme.typography[300]}
60
+ `;
61
+
62
+ const SmallBodyCopy = styled(Container)`
63
+ color: ${(props) => props.theme.colors.text.body};
64
+ ${(props) => props.theme.typography[200]}
65
+ `;
66
+
31
67
  const Text = ({ fontSize, children, qa, ...rest }: TypeProps) => {
32
68
  const qaText = typeof children === "string" ? children : undefined;
33
69
 
@@ -39,4 +75,12 @@ const Text = ({ fontSize, children, qa, ...rest }: TypeProps) => {
39
75
  );
40
76
  };
41
77
 
78
+ Text.Headline = Headline;
79
+ Text.SubHeadline = SubHeadline;
80
+ Text.SmallSubHeadline = SmallSubHeadline;
81
+ Text.Byline = Byline;
82
+ Text.SmallByline = SmallByline;
83
+ Text.BodyCopy = BodyCopy;
84
+ Text.SmallBodyCopy = SmallBodyCopy;
85
+
42
86
  export default Text;
@@ -15,164 +15,85 @@ defaultStory.story = {
15
15
  name: "Default",
16
16
  };
17
17
 
18
- export const size100 = () => (
19
- <Text fontSize={number("fontSize", 100)}>
20
- {text("children", "Some default content here.")}
21
- </Text>
22
- );
23
-
24
- size100.story = {
25
- name: "Size 100",
26
- };
27
-
28
- export const size200 = () => (
29
- <Text fontSize={number("fontSize", 200)}>
30
- {text("children", "Some default content here.")}
31
- </Text>
32
- );
33
-
34
- size200.story = {
35
- name: "Size 200",
36
- };
37
-
38
- export const size300 = () => (
39
- <Text fontSize={number("fontSize", 300)}>
40
- {text("children", "Some default content here.")}
41
- </Text>
42
- );
43
-
44
- size300.story = {
45
- name: "Size 300",
46
- };
47
-
48
- export const size400 = () => (
49
- <Text fontSize={number("fontSize", 400)}>
50
- {text("children", "Some default content here.")}
51
- </Text>
52
- );
53
-
54
- size400.story = {
55
- name: "Size 400",
56
- };
57
-
58
- export const size500 = () => (
59
- <Text fontSize={number("fontSize", 500)}>
60
- {text("children", "Some default content here.")}
61
- </Text>
62
- );
63
-
64
- size500.story = {
65
- name: "Size 500",
66
- };
67
-
68
- export const size600 = () => (
69
- <Text fontSize={number("fontSize", 600)}>
70
- {text("children", "Some default content here.")}
71
- </Text>
72
- );
73
-
74
- size600.story = {
75
- name: "Size 600",
76
- };
77
-
78
- export const size700 = () => (
79
- <Text fontSize={number("fontSize", 700)}>
80
- {text("children", "Some default content here.")}
81
- </Text>
82
- );
83
-
84
- size700.story = {
85
- name: "Size 700",
86
- };
87
-
88
- export const size800 = () => (
89
- <Text fontSize={number("fontSize", 800)}>
90
- {text("children", "Some default content here.")}
91
- </Text>
92
- );
93
-
94
- size800.story = {
95
- name: "Size 800",
96
- };
97
-
98
- export const size900 = () => (
99
- <Text fontSize={number("fontSize", 900)}>
18
+ export const bold = () => (
19
+ <Text fontWeight={text("fontWeight", "bold")}>
100
20
  {text("children", "Some default content here.")}
101
21
  </Text>
102
22
  );
103
23
 
104
- size900.story = {
105
- name: "Size 900",
24
+ bold.story = {
25
+ name: "Bold",
106
26
  };
107
27
 
108
- export const size1000 = () => (
109
- <Text fontSize={number("fontSize", 1000)}>
28
+ export const italicized = () => (
29
+ <Text isItalicized={boolean("isItalicized", true)}>
110
30
  {text("children", "Some default content here.")}
111
31
  </Text>
112
32
  );
113
33
 
114
- size1000.story = {
115
- name: "Size 1000",
34
+ italicized.story = {
35
+ name: "Italicized",
116
36
  };
117
37
 
118
- export const bold = () => (
119
- <Text fontWeight={text("fontWeight", "bold")}>
38
+ export const headline = () => (
39
+ <Text.Headline as={text("as", "h1")}>
120
40
  {text("children", "Some default content here.")}
121
- </Text>
41
+ </Text.Headline>
122
42
  );
123
43
 
124
- bold.story = {
125
- name: "Bold",
44
+ headline.story = {
45
+ name: "Headline",
126
46
  };
127
47
 
128
- export const italicized = () => (
129
- <Text isItalicized={boolean("isItalicized", true)}>
48
+ export const subheadline = () => (
49
+ <Text.SubHeadline as={text("as", "h2")}>
130
50
  {text("children", "Some default content here.")}
131
- </Text>
51
+ </Text.SubHeadline>
132
52
  );
133
53
 
134
- italicized.story = {
135
- name: "Italicized",
54
+ subheadline.story = {
55
+ name: "Subheadline",
136
56
  };
137
57
 
138
- export const h1Tag = () => (
139
- <Text as={text("as", "h1")}>
58
+ export const smallSubheadline = () => (
59
+ <Text.SmallSubHeadline as={text("as", "h3")}>
140
60
  {text("children", "Some default content here.")}
141
- </Text>
61
+ </Text.SmallSubHeadline>
142
62
  );
143
63
 
144
- h1Tag.story = {
145
- name: "H1 tag",
64
+ smallSubheadline.story = {
65
+ name: "Small subheadline",
146
66
  };
147
67
 
148
- export const h2Tag = () => (
149
- <Text as={text("as", "h2")}>
68
+ export const bodyCopy = () => (
69
+ <Text.BodyCopy as={text("as", "p")}>
150
70
  {text("children", "Some default content here.")}
151
- </Text>
71
+ </Text.BodyCopy>
152
72
  );
153
73
 
154
- h2Tag.story = {
155
- name: "H2 tag",
74
+ bodyCopy.story = {
75
+ name: "Body copy",
156
76
  };
157
77
 
158
- export const pTag = () => (
159
- <Text as={text("as", "p")}>
78
+ export const smallBodyCopy = () => (
79
+ <Text.SmallBodyCopy as={text("as", "p")}>
160
80
  {text("children", "Some default content here.")}
161
- </Text>
81
+ </Text.SmallBodyCopy>
162
82
  );
163
83
 
164
- pTag.story = {
165
- name: "P tag",
84
+ smallBodyCopy.story = {
85
+ name: "Small body copy",
166
86
  };
167
87
 
168
- export const spanTag = () => (
169
- <Text as={text("as", "span")}>
170
- {text("children", "Some default content here.")}
88
+ export const customSize = () => (
89
+ <Text as={text("as", "span")} fontSize={number("fontSize", 1000)}>
90
+ {text("children", "")}
91
+ Custom sized text!
171
92
  </Text>
172
93
  );
173
94
 
174
- spanTag.story = {
175
- name: "Span tag",
95
+ customSize.story = {
96
+ name: "Custom size",
176
97
  };
177
98
 
178
99
  export const noWordBreak = () => (
@@ -27,10 +27,26 @@ describe("Text", () => {
27
27
  expect(component).toHaveStyleRule("text-overflow", "ellipsis");
28
28
  });
29
29
 
30
+ it("is italic when isItalicized is true", () => {
31
+ const { getByDataQaLabel } = render(
32
+ <Text isItalicized children="Italicized" />
33
+ );
34
+ const component = getByDataQaLabel({ text: "Italicized" });
35
+ expect(component).toHaveStyleRule("font-style", "italic");
36
+ });
37
+
30
38
  it("outputs the correct string/content", () => {
31
39
  const { getByText } = render(
32
40
  <Text children="Supercalifragilisticexpialidocious" />
33
41
  );
34
42
  expect(getByText("Supercalifragilisticexpialidocious")).toBeTruthy();
35
43
  });
44
+
45
+ it("displays a custom size if using fontSize", () => {
46
+ const { getByText } = render(
47
+ <Text children="Custom sized text!" fontSize={1000} />
48
+ );
49
+ const component = getByText("Custom sized text!");
50
+ expect(component).toHaveStyleRule("font-size", "76px");
51
+ });
36
52
  });
@@ -9,6 +9,7 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.span`
9
9
  padding-left: 0;
10
10
  padding-right: 0;
11
11
  font-family: ${(props) => props.theme.fontFamily};
12
+ font-style: ${(props) => props.isItalicized && "italic"};
12
13
 
13
14
  ${(props) =>
14
15
  props.truncated &&
@@ -310,7 +310,6 @@ const colors = {
310
310
  hubspot: NETWORKCOLORS.NETWORK_COLOR_HUBSPOT,
311
311
  microsoft_dynamics: NETWORKCOLORS.NETWORK_COLOR_MICROSOFT_DYNAMICS,
312
312
  yelp: NETWORKCOLORS.NETWORK_COLOR_YELP,
313
-
314
313
  },
315
314
  };
316
315
 
@@ -71,7 +71,9 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
71
71
  _this$props$qa = _this$props.qa,
72
72
  qa = _this$props$qa === void 0 ? {} : _this$props$qa,
73
73
  tabIndex = _this$props.tabIndex,
74
- rest = _objectWithoutPropertiesLoose(_this$props, ["id", "value", "name", "label", "checked", "disabled", "indeterminate", "onChange", "ariaLabel", "appearance", "qa", "tabIndex"]);
74
+ _this$props$inputProp = _this$props.inputProps,
75
+ inputProps = _this$props$inputProp === void 0 ? {} : _this$props$inputProp,
76
+ rest = _objectWithoutPropertiesLoose(_this$props, ["id", "value", "name", "label", "checked", "disabled", "indeterminate", "onChange", "ariaLabel", "appearance", "qa", "tabIndex", "inputProps"]);
75
77
 
76
78
  var isPill = appearance === "pill"; // TODO: Refactor pill checkboxes to use fewer elements for performance gains
77
79
 
@@ -98,7 +100,7 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
98
100
  "data-qa-checkbox-ischecked": indeterminate ? "indeterminate" : checked === true,
99
101
  "data-qa-checkbox-isdisabled": disabled === true,
100
102
  tabIndex: tabIndex
101
- }, qa)), label && /*#__PURE__*/React.createElement(_styles.LabelText, {
103
+ }, qa, inputProps)), label && /*#__PURE__*/React.createElement(_styles.LabelText, {
102
104
  disabled: disabled
103
105
  }, label));
104
106
  }
@@ -126,13 +128,11 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
126
128
  "data-qa-checkbox-ischecked": indeterminate ? "indeterminate" : checked === true,
127
129
  "data-qa-checkbox-isdisabled": disabled === true,
128
130
  tabIndex: tabIndex
129
- }, qa)), /*#__PURE__*/React.createElement(_styles.CheckboxBox, null, /*#__PURE__*/React.createElement(_styles.CheckIcon, {
131
+ }, qa, inputProps)), /*#__PURE__*/React.createElement(_styles.CheckboxBox, null, /*#__PURE__*/React.createElement(_styles.CheckIcon, {
130
132
  name: indeterminate ? "minus" : "check",
131
133
  size: "mini",
132
134
  fixedWidth: true
133
- }))), label && !isPill && /*#__PURE__*/React.createElement(_styles.LabelText, {
134
- disabled: disabled
135
- }, label))
135
+ }))))
136
136
  );
137
137
  };
138
138
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.default = void 0;
4
+ exports.default = exports.TableRow = exports.TableBody = exports.TableHead = exports.Table = void 0;
5
5
 
6
6
  var React = _interopRequireWildcard(require("react"));
7
7
 
@@ -21,78 +21,87 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
21
21
 
22
22
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
23
 
24
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
25
-
26
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
27
-
24
+ var renderTableRow = function renderTableRow(row) {
25
+ return /*#__PURE__*/React.createElement("tbody", {
26
+ key: row.id,
27
+ "data-qa-table-row": ""
28
+ }, /*#__PURE__*/React.createElement("tr", null, row.cells.map(function (td) {
29
+ return /*#__PURE__*/React.createElement(_TableCell.default, _extends({}, td, {
30
+ key: td.id
31
+ }));
32
+ })));
33
+ };
28
34
  /**
29
35
  * The table component assist in rendering tablular data.
30
36
  */
31
- var Table = /*#__PURE__*/function (_React$Component) {
32
- _inheritsLoose(Table, _React$Component);
33
-
34
- function Table() {
35
- var _this;
36
-
37
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
38
- args[_key] = arguments[_key];
39
- }
40
-
41
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
42
-
43
- _this.renderTableRow = function (row) {
44
- return /*#__PURE__*/React.createElement("tbody", {
45
- key: row.id,
46
- "data-qa-table-row": ""
47
- }, /*#__PURE__*/React.createElement("tr", null, row.cells.map(function (td) {
48
- return /*#__PURE__*/React.createElement(_TableCell.default, _extends({
49
- key: td.id
50
- }, td));
51
- })));
52
- };
53
-
54
- return _this;
37
+
38
+
39
+ var Table = function Table(_ref) {
40
+ var _ref$head = _ref.head,
41
+ head = _ref$head === void 0 ? [] : _ref$head,
42
+ _ref$rows = _ref.rows,
43
+ rows = _ref$rows === void 0 ? [] : _ref$rows,
44
+ onSort = _ref.onSort,
45
+ sortId = _ref.sortId,
46
+ sortDirection = _ref.sortDirection,
47
+ rowRender = _ref.rowRender,
48
+ children = _ref.children,
49
+ rest = _objectWithoutPropertiesLoose(_ref, ["head", "rows", "onSort", "sortId", "sortDirection", "rowRender", "children"]);
50
+
51
+ if (children) {
52
+ return /*#__PURE__*/React.createElement(_styles.default, _extends({}, rest, {
53
+ "data-qa-table": ""
54
+ }), children);
55
55
  }
56
56
 
57
- var _proto = Table.prototype;
58
-
59
- _proto.render = function render() {
60
- var _this2 = this;
61
-
62
- var _this$props = this.props,
63
- head = _this$props.head,
64
- rows = _this$props.rows,
65
- onSort = _this$props.onSort,
66
- sortId = _this$props.sortId,
67
- sortDirection = _this$props.sortDirection,
68
- rowRender = _this$props.rowRender,
69
- rest = _objectWithoutPropertiesLoose(_this$props, ["head", "rows", "onSort", "sortId", "sortDirection", "rowRender"]);
70
-
71
- return (
72
- /*#__PURE__*/
73
- // $FlowIssue - upgrade v0.112.0
74
- React.createElement(_styles.default, _extends({
75
- "data-qa-table": ""
76
- }, rest), head.length > 0 && /*#__PURE__*/React.createElement("thead", {
77
- "data-qa-table-header": ""
78
- }, /*#__PURE__*/React.createElement("tr", null, head.map(function (th) {
79
- return /*#__PURE__*/React.createElement(_TableHeaderCell.default, _extends({}, th, {
80
- key: th.id,
81
- onSort: onSort,
82
- sortId: sortId,
83
- sortDirection: sortDirection
84
- }));
85
- }))), rows.map(function (row) {
86
- return rowRender ? rowRender(row) : _this2.renderTableRow(row);
87
- }))
88
- );
89
- };
90
-
91
- return Table;
92
- }(React.Component);
93
-
94
- exports.default = Table;
95
- Table.defaultProps = {
96
- head: [],
97
- rows: []
98
- };
57
+ return /*#__PURE__*/React.createElement(_styles.default, _extends({}, rest, {
58
+ "data-qa-table": ""
59
+ }), head.length > 0 && /*#__PURE__*/React.createElement("thead", {
60
+ "data-qa-table-header": ""
61
+ }, /*#__PURE__*/React.createElement("tr", null, head.map(function (th) {
62
+ return /*#__PURE__*/React.createElement(_TableHeaderCell.default, _extends({}, th, {
63
+ key: th.id,
64
+ onSort: onSort,
65
+ sortId: sortId,
66
+ sortDirection: sortDirection
67
+ }));
68
+ }))), rows.map(function (row) {
69
+ return rowRender ? rowRender(row) : renderTableRow(row);
70
+ }));
71
+ };
72
+
73
+ exports.Table = Table;
74
+
75
+ var TableHead = function TableHead(_ref2) {
76
+ var children = _ref2.children,
77
+ props = _objectWithoutPropertiesLoose(_ref2, ["children"]);
78
+
79
+ return /*#__PURE__*/React.createElement("thead", props, children);
80
+ };
81
+
82
+ exports.TableHead = TableHead;
83
+
84
+ var TableBody = function TableBody(_ref3) {
85
+ var children = _ref3.children,
86
+ props = _objectWithoutPropertiesLoose(_ref3, ["children"]);
87
+
88
+ return /*#__PURE__*/React.createElement("tbody", props, children);
89
+ };
90
+
91
+ exports.TableBody = TableBody;
92
+
93
+ var TableRow = function TableRow(_ref4) {
94
+ var children = _ref4.children,
95
+ props = _objectWithoutPropertiesLoose(_ref4, ["children"]);
96
+
97
+ return /*#__PURE__*/React.createElement("tr", props, children);
98
+ };
99
+
100
+ exports.TableRow = TableRow;
101
+ Table.TableHead = TableHead;
102
+ Table.TableBody = TableBody;
103
+ Table.TableRow = TableRow;
104
+ Table.HeaderCell = _TableHeaderCell.default;
105
+ Table.Cell = _TableCell.default;
106
+ var _default = Table;
107
+ exports.default = _default;
@@ -40,15 +40,16 @@ var TableCell = /*#__PURE__*/function (_React$Component) {
40
40
  colSpan = _this$props.colSpan,
41
41
  width = _this$props.width,
42
42
  align = _this$props.align,
43
- rest = _objectWithoutPropertiesLoose(_this$props, ["id", "content", "colSpan", "width", "align"]);
43
+ children = _this$props.children,
44
+ rest = _objectWithoutPropertiesLoose(_this$props, ["id", "content", "colSpan", "width", "align", "children"]);
44
45
 
45
- return /*#__PURE__*/React.createElement(_styles.default, _extends({
46
+ return /*#__PURE__*/React.createElement(_styles.default, _extends({}, rest, {
46
47
  alignment: align || "left",
47
48
  key: id,
48
49
  colSpan: colSpan,
49
50
  width: width,
50
51
  "data-qa-table-cell": ""
51
- }, rest), content);
52
+ }), children || content);
52
53
  };
53
54
 
54
55
  return TableCell;
@@ -60,39 +60,54 @@ var TableHeaderCell = /*#__PURE__*/function (_React$Component) {
60
60
  }));
61
61
  };
62
62
 
63
+ _this.handleClick = function (e) {
64
+ var _this$props = _this.props,
65
+ onClick = _this$props.onClick,
66
+ onSort = _this$props.onSort,
67
+ isSortable = _this$props.isSortable,
68
+ id = _this$props.id;
69
+
70
+ if (onClick) {
71
+ onClick(e);
72
+ return;
73
+ }
74
+
75
+ if (!isSortable || !onSort) return;
76
+ onSort(id);
77
+ };
78
+
63
79
  return _this;
64
80
  }
65
81
 
66
82
  var _proto = TableHeaderCell.prototype;
67
83
 
68
84
  _proto.render = function render() {
69
- var _this$props = this.props,
70
- id = _this$props.id,
71
- content = _this$props.content,
72
- colSpan = _this$props.colSpan,
73
- width = _this$props.width,
74
- align = _this$props.align,
75
- isSortable = _this$props.isSortable,
76
- shouldTruncate = _this$props.shouldTruncate,
77
- onSort = _this$props.onSort,
78
- sortId = _this$props.sortId,
79
- sortDirection = _this$props.sortDirection,
80
- rest = _objectWithoutPropertiesLoose(_this$props, ["id", "content", "colSpan", "width", "align", "isSortable", "shouldTruncate", "onSort", "sortId", "sortDirection"]);
81
-
82
- return /*#__PURE__*/React.createElement(_styles.default, _extends({
85
+ var _this$props2 = this.props,
86
+ id = _this$props2.id,
87
+ content = _this$props2.content,
88
+ colSpan = _this$props2.colSpan,
89
+ width = _this$props2.width,
90
+ align = _this$props2.align,
91
+ isSortable = _this$props2.isSortable,
92
+ shouldTruncate = _this$props2.shouldTruncate,
93
+ onSort = _this$props2.onSort,
94
+ sortId = _this$props2.sortId,
95
+ sortDirection = _this$props2.sortDirection,
96
+ children = _this$props2.children,
97
+ onClick = _this$props2.onClick,
98
+ rest = _objectWithoutPropertiesLoose(_this$props2, ["id", "content", "colSpan", "width", "align", "isSortable", "shouldTruncate", "onSort", "sortId", "sortDirection", "children", "onClick"]);
99
+
100
+ return /*#__PURE__*/React.createElement(_styles.default, _extends({}, rest, {
83
101
  key: id,
84
102
  alignment: align || "left",
85
103
  sortable: isSortable,
86
104
  colSpan: colSpan,
87
105
  width: width,
88
- onClick: isSortable && onSort ? function () {
89
- return onSort(id);
90
- } : undefined,
106
+ onClick: this.handleClick,
91
107
  "data-tableheadercell-sortable": isSortable,
92
108
  "data-qa-table-header-cell": "",
93
- "data-qa-table-header-cell-sortdirection": sortDirection // $FlowIssue - upgrade v0.112.0
94
-
95
- }, rest), content, isSortable && this.getSortIcon(id === sortId));
109
+ "data-qa-table-header-cell-sortdirection": sortDirection
110
+ }), children || content, isSortable && !children && this.getSortIcon(id === sortId));
96
111
  };
97
112
 
98
113
  return TableHeaderCell;
@@ -72,9 +72,9 @@ var TableRowAccordion = /*#__PURE__*/function (_React$Component) {
72
72
  "data-tablerowaccordion-summary": true,
73
73
  onClick: this.handleToggle
74
74
  }, cells.map(function (td) {
75
- return /*#__PURE__*/React.createElement(_TableCell.default, _extends({
75
+ return /*#__PURE__*/React.createElement(_TableCell.default, _extends({}, td, {
76
76
  key: td.id
77
- }, td));
77
+ }));
78
78
  }), /*#__PURE__*/React.createElement(_TableCell.default, {
79
79
  id: "tableRowAccordion_trigger",
80
80
  content: /*#__PURE__*/React.createElement(_styles.Trigger, {