@sproutsocial/racine 7.0.2-beta-maurice.1 → 7.1.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.
- package/CHANGELOG.md +12 -0
- package/README.md +9 -38
- package/__flow__/Box/styles.js +5 -5
- package/__flow__/ChartLegend/styles.js +6 -6
- package/__flow__/Checkbox/index.js +4 -1
- package/__flow__/Checkbox/index.stories.js +16 -0
- package/__flow__/Checkbox/index.test.js +33 -0
- package/__flow__/Table/index.js +82 -54
- package/__flow__/Table/index.stories.js +41 -0
- package/__flow__/Table/index.test.js +14 -0
- package/__flow__/TableCell/index.js +17 -7
- package/__flow__/TableCell/index.test.js +8 -1
- package/__flow__/TableHeaderCell/index.js +26 -11
- package/__flow__/TableHeaderCell/index.test.js +16 -1
- package/__flow__/TableRowAccordion/index.js +1 -1
- package/__flow__/utils/theme.js +0 -1
- package/commonjs/Checkbox/index.js +6 -6
- package/commonjs/Table/index.js +80 -71
- package/commonjs/TableCell/index.js +4 -3
- package/commonjs/TableHeaderCell/index.js +35 -20
- package/commonjs/TableRowAccordion/index.js +2 -2
- package/lib/Checkbox/index.js +6 -6
- package/lib/Table/index.js +61 -64
- package/lib/TableCell/index.js +4 -3
- package/lib/TableHeaderCell/index.js +35 -20
- package/lib/TableRowAccordion/index.js +2 -2
- package/package.json +4 -9
- package/__flow__/.DS_Store +0 -0
package/__flow__/utils/theme.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
})))
|
|
134
|
-
disabled: disabled
|
|
135
|
-
}, label))
|
|
135
|
+
}))))
|
|
136
136
|
);
|
|
137
137
|
};
|
|
138
138
|
|
package/commonjs/Table/index.js
CHANGED
|
@@ -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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
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$
|
|
70
|
-
id = _this$
|
|
71
|
-
content = _this$
|
|
72
|
-
colSpan = _this$
|
|
73
|
-
width = _this$
|
|
74
|
-
align = _this$
|
|
75
|
-
isSortable = _this$
|
|
76
|
-
shouldTruncate = _this$
|
|
77
|
-
onSort = _this$
|
|
78
|
-
sortId = _this$
|
|
79
|
-
sortDirection = _this$
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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:
|
|
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
|
|
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
|
-
}
|
|
77
|
+
}));
|
|
78
78
|
}), /*#__PURE__*/React.createElement(_TableCell.default, {
|
|
79
79
|
id: "tableRowAccordion_trigger",
|
|
80
80
|
content: /*#__PURE__*/React.createElement(_styles.Trigger, {
|
package/lib/Checkbox/index.js
CHANGED
|
@@ -61,7 +61,9 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
|
|
|
61
61
|
_this$props$qa = _this$props.qa,
|
|
62
62
|
qa = _this$props$qa === void 0 ? {} : _this$props$qa,
|
|
63
63
|
tabIndex = _this$props.tabIndex,
|
|
64
|
-
|
|
64
|
+
_this$props$inputProp = _this$props.inputProps,
|
|
65
|
+
inputProps = _this$props$inputProp === void 0 ? {} : _this$props$inputProp,
|
|
66
|
+
rest = _objectWithoutPropertiesLoose(_this$props, ["id", "value", "name", "label", "checked", "disabled", "indeterminate", "onChange", "ariaLabel", "appearance", "qa", "tabIndex", "inputProps"]);
|
|
65
67
|
|
|
66
68
|
var isPill = appearance === "pill"; // TODO: Refactor pill checkboxes to use fewer elements for performance gains
|
|
67
69
|
|
|
@@ -88,7 +90,7 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
|
|
|
88
90
|
"data-qa-checkbox-ischecked": indeterminate ? "indeterminate" : checked === true,
|
|
89
91
|
"data-qa-checkbox-isdisabled": disabled === true,
|
|
90
92
|
tabIndex: tabIndex
|
|
91
|
-
}, qa)), label && /*#__PURE__*/React.createElement(LabelText, {
|
|
93
|
+
}, qa, inputProps)), label && /*#__PURE__*/React.createElement(LabelText, {
|
|
92
94
|
disabled: disabled
|
|
93
95
|
}, label));
|
|
94
96
|
}
|
|
@@ -116,13 +118,11 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
|
|
|
116
118
|
"data-qa-checkbox-ischecked": indeterminate ? "indeterminate" : checked === true,
|
|
117
119
|
"data-qa-checkbox-isdisabled": disabled === true,
|
|
118
120
|
tabIndex: tabIndex
|
|
119
|
-
}, qa)), /*#__PURE__*/React.createElement(CheckboxBox, null, /*#__PURE__*/React.createElement(CheckIcon, {
|
|
121
|
+
}, qa, inputProps)), /*#__PURE__*/React.createElement(CheckboxBox, null, /*#__PURE__*/React.createElement(CheckIcon, {
|
|
120
122
|
name: indeterminate ? "minus" : "check",
|
|
121
123
|
size: "mini",
|
|
122
124
|
fixedWidth: true
|
|
123
|
-
})))
|
|
124
|
-
disabled: disabled
|
|
125
|
-
}, label))
|
|
125
|
+
}))))
|
|
126
126
|
);
|
|
127
127
|
};
|
|
128
128
|
|
package/lib/Table/index.js
CHANGED
|
@@ -2,83 +2,80 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
4
|
|
|
5
|
-
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
6
|
-
|
|
7
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
8
|
-
|
|
9
5
|
import * as React from "react";
|
|
10
6
|
import TableCell from "../TableCell";
|
|
11
7
|
import TableHeaderCell from "../TableHeaderCell";
|
|
12
8
|
import Container from "./styles";
|
|
13
9
|
|
|
10
|
+
var renderTableRow = function renderTableRow(row) {
|
|
11
|
+
return /*#__PURE__*/React.createElement("tbody", {
|
|
12
|
+
key: row.id,
|
|
13
|
+
"data-qa-table-row": ""
|
|
14
|
+
}, /*#__PURE__*/React.createElement("tr", null, row.cells.map(function (td) {
|
|
15
|
+
return /*#__PURE__*/React.createElement(TableCell, _extends({}, td, {
|
|
16
|
+
key: td.id
|
|
17
|
+
}));
|
|
18
|
+
})));
|
|
19
|
+
};
|
|
14
20
|
/**
|
|
15
21
|
* The table component assist in rendering tablular data.
|
|
16
22
|
*/
|
|
17
|
-
var Table = /*#__PURE__*/function (_React$Component) {
|
|
18
|
-
_inheritsLoose(Table, _React$Component);
|
|
19
|
-
|
|
20
|
-
function Table() {
|
|
21
|
-
var _this;
|
|
22
|
-
|
|
23
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
|
-
args[_key] = arguments[_key];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
28
23
|
|
|
29
|
-
_this.renderTableRow = function (row) {
|
|
30
|
-
return /*#__PURE__*/React.createElement("tbody", {
|
|
31
|
-
key: row.id,
|
|
32
|
-
"data-qa-table-row": ""
|
|
33
|
-
}, /*#__PURE__*/React.createElement("tr", null, row.cells.map(function (td) {
|
|
34
|
-
return /*#__PURE__*/React.createElement(TableCell, _extends({
|
|
35
|
-
key: td.id
|
|
36
|
-
}, td));
|
|
37
|
-
})));
|
|
38
|
-
};
|
|
39
24
|
|
|
40
|
-
|
|
25
|
+
export var Table = function Table(_ref) {
|
|
26
|
+
var _ref$head = _ref.head,
|
|
27
|
+
head = _ref$head === void 0 ? [] : _ref$head,
|
|
28
|
+
_ref$rows = _ref.rows,
|
|
29
|
+
rows = _ref$rows === void 0 ? [] : _ref$rows,
|
|
30
|
+
onSort = _ref.onSort,
|
|
31
|
+
sortId = _ref.sortId,
|
|
32
|
+
sortDirection = _ref.sortDirection,
|
|
33
|
+
rowRender = _ref.rowRender,
|
|
34
|
+
children = _ref.children,
|
|
35
|
+
rest = _objectWithoutPropertiesLoose(_ref, ["head", "rows", "onSort", "sortId", "sortDirection", "rowRender", "children"]);
|
|
36
|
+
|
|
37
|
+
if (children) {
|
|
38
|
+
return /*#__PURE__*/React.createElement(Container, _extends({}, rest, {
|
|
39
|
+
"data-qa-table": ""
|
|
40
|
+
}), children);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
return /*#__PURE__*/React.createElement(Container, _extends({}, rest, {
|
|
44
|
+
"data-qa-table": ""
|
|
45
|
+
}), head.length > 0 && /*#__PURE__*/React.createElement("thead", {
|
|
46
|
+
"data-qa-table-header": ""
|
|
47
|
+
}, /*#__PURE__*/React.createElement("tr", null, head.map(function (th) {
|
|
48
|
+
return /*#__PURE__*/React.createElement(TableHeaderCell, _extends({}, th, {
|
|
49
|
+
key: th.id,
|
|
50
|
+
onSort: onSort,
|
|
51
|
+
sortId: sortId,
|
|
52
|
+
sortDirection: sortDirection
|
|
53
|
+
}));
|
|
54
|
+
}))), rows.map(function (row) {
|
|
55
|
+
return rowRender ? rowRender(row) : renderTableRow(row);
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
export var TableHead = function TableHead(_ref2) {
|
|
59
|
+
var children = _ref2.children,
|
|
60
|
+
props = _objectWithoutPropertiesLoose(_ref2, ["children"]);
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, rest), head.length > 0 && /*#__PURE__*/React.createElement("thead", {
|
|
63
|
-
"data-qa-table-header": ""
|
|
64
|
-
}, /*#__PURE__*/React.createElement("tr", null, head.map(function (th) {
|
|
65
|
-
return /*#__PURE__*/React.createElement(TableHeaderCell, _extends({}, th, {
|
|
66
|
-
key: th.id,
|
|
67
|
-
onSort: onSort,
|
|
68
|
-
sortId: sortId,
|
|
69
|
-
sortDirection: sortDirection
|
|
70
|
-
}));
|
|
71
|
-
}))), rows.map(function (row) {
|
|
72
|
-
return rowRender ? rowRender(row) : _this2.renderTableRow(row);
|
|
73
|
-
}))
|
|
74
|
-
);
|
|
75
|
-
};
|
|
62
|
+
return /*#__PURE__*/React.createElement("thead", props, children);
|
|
63
|
+
};
|
|
64
|
+
export var TableBody = function TableBody(_ref3) {
|
|
65
|
+
var children = _ref3.children,
|
|
66
|
+
props = _objectWithoutPropertiesLoose(_ref3, ["children"]);
|
|
76
67
|
|
|
77
|
-
return
|
|
78
|
-
}
|
|
68
|
+
return /*#__PURE__*/React.createElement("tbody", props, children);
|
|
69
|
+
};
|
|
70
|
+
export var TableRow = function TableRow(_ref4) {
|
|
71
|
+
var children = _ref4.children,
|
|
72
|
+
props = _objectWithoutPropertiesLoose(_ref4, ["children"]);
|
|
79
73
|
|
|
80
|
-
|
|
81
|
-
head: [],
|
|
82
|
-
rows: []
|
|
74
|
+
return /*#__PURE__*/React.createElement("tr", props, children);
|
|
83
75
|
};
|
|
84
|
-
|
|
76
|
+
Table.TableHead = TableHead;
|
|
77
|
+
Table.TableBody = TableBody;
|
|
78
|
+
Table.TableRow = TableRow;
|
|
79
|
+
Table.HeaderCell = TableHeaderCell;
|
|
80
|
+
Table.Cell = TableCell;
|
|
81
|
+
export default Table;
|
package/lib/TableCell/index.js
CHANGED
|
@@ -28,15 +28,16 @@ var TableCell = /*#__PURE__*/function (_React$Component) {
|
|
|
28
28
|
colSpan = _this$props.colSpan,
|
|
29
29
|
width = _this$props.width,
|
|
30
30
|
align = _this$props.align,
|
|
31
|
-
|
|
31
|
+
children = _this$props.children,
|
|
32
|
+
rest = _objectWithoutPropertiesLoose(_this$props, ["id", "content", "colSpan", "width", "align", "children"]);
|
|
32
33
|
|
|
33
|
-
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
34
|
+
return /*#__PURE__*/React.createElement(Container, _extends({}, rest, {
|
|
34
35
|
alignment: align || "left",
|
|
35
36
|
key: id,
|
|
36
37
|
colSpan: colSpan,
|
|
37
38
|
width: width,
|
|
38
39
|
"data-qa-table-cell": ""
|
|
39
|
-
}
|
|
40
|
+
}), children || content);
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
return TableCell;
|
|
@@ -45,39 +45,54 @@ var TableHeaderCell = /*#__PURE__*/function (_React$Component) {
|
|
|
45
45
|
}));
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
_this.handleClick = function (e) {
|
|
49
|
+
var _this$props = _this.props,
|
|
50
|
+
onClick = _this$props.onClick,
|
|
51
|
+
onSort = _this$props.onSort,
|
|
52
|
+
isSortable = _this$props.isSortable,
|
|
53
|
+
id = _this$props.id;
|
|
54
|
+
|
|
55
|
+
if (onClick) {
|
|
56
|
+
onClick(e);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!isSortable || !onSort) return;
|
|
61
|
+
onSort(id);
|
|
62
|
+
};
|
|
63
|
+
|
|
48
64
|
return _this;
|
|
49
65
|
}
|
|
50
66
|
|
|
51
67
|
var _proto = TableHeaderCell.prototype;
|
|
52
68
|
|
|
53
69
|
_proto.render = function render() {
|
|
54
|
-
var _this$
|
|
55
|
-
id = _this$
|
|
56
|
-
content = _this$
|
|
57
|
-
colSpan = _this$
|
|
58
|
-
width = _this$
|
|
59
|
-
align = _this$
|
|
60
|
-
isSortable = _this$
|
|
61
|
-
shouldTruncate = _this$
|
|
62
|
-
onSort = _this$
|
|
63
|
-
sortId = _this$
|
|
64
|
-
sortDirection = _this$
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
var _this$props2 = this.props,
|
|
71
|
+
id = _this$props2.id,
|
|
72
|
+
content = _this$props2.content,
|
|
73
|
+
colSpan = _this$props2.colSpan,
|
|
74
|
+
width = _this$props2.width,
|
|
75
|
+
align = _this$props2.align,
|
|
76
|
+
isSortable = _this$props2.isSortable,
|
|
77
|
+
shouldTruncate = _this$props2.shouldTruncate,
|
|
78
|
+
onSort = _this$props2.onSort,
|
|
79
|
+
sortId = _this$props2.sortId,
|
|
80
|
+
sortDirection = _this$props2.sortDirection,
|
|
81
|
+
children = _this$props2.children,
|
|
82
|
+
onClick = _this$props2.onClick,
|
|
83
|
+
rest = _objectWithoutPropertiesLoose(_this$props2, ["id", "content", "colSpan", "width", "align", "isSortable", "shouldTruncate", "onSort", "sortId", "sortDirection", "children", "onClick"]);
|
|
84
|
+
|
|
85
|
+
return /*#__PURE__*/React.createElement(Container, _extends({}, rest, {
|
|
68
86
|
key: id,
|
|
69
87
|
alignment: align || "left",
|
|
70
88
|
sortable: isSortable,
|
|
71
89
|
colSpan: colSpan,
|
|
72
90
|
width: width,
|
|
73
|
-
onClick:
|
|
74
|
-
return onSort(id);
|
|
75
|
-
} : undefined,
|
|
91
|
+
onClick: this.handleClick,
|
|
76
92
|
"data-tableheadercell-sortable": isSortable,
|
|
77
93
|
"data-qa-table-header-cell": "",
|
|
78
|
-
"data-qa-table-header-cell-sortdirection": sortDirection
|
|
79
|
-
|
|
80
|
-
}, rest), content, isSortable && this.getSortIcon(id === sortId));
|
|
94
|
+
"data-qa-table-header-cell-sortdirection": sortDirection
|
|
95
|
+
}), children || content, isSortable && !children && this.getSortIcon(id === sortId));
|
|
81
96
|
};
|
|
82
97
|
|
|
83
98
|
return TableHeaderCell;
|
|
@@ -58,9 +58,9 @@ var TableRowAccordion = /*#__PURE__*/function (_React$Component) {
|
|
|
58
58
|
"data-tablerowaccordion-summary": true,
|
|
59
59
|
onClick: this.handleToggle
|
|
60
60
|
}, cells.map(function (td) {
|
|
61
|
-
return /*#__PURE__*/React.createElement(TableCell, _extends({
|
|
61
|
+
return /*#__PURE__*/React.createElement(TableCell, _extends({}, td, {
|
|
62
62
|
key: td.id
|
|
63
|
-
}
|
|
63
|
+
}));
|
|
64
64
|
}), /*#__PURE__*/React.createElement(TableCell, {
|
|
65
65
|
id: "tableRowAccordion_trigger",
|
|
66
66
|
content: /*#__PURE__*/React.createElement(Trigger, {
|