@atlaskit/dynamic-table 16.1.4 → 17.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.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/components/stateless.js +2 -2
- package/dist/cjs/components/table-head-cell.compiled.css +9 -0
- package/dist/cjs/components/table-head-cell.js +76 -8
- package/dist/cjs/components/table-head.js +26 -3
- package/dist/cjs/styled/table-head.js +20 -3
- package/dist/es2019/components/stateless.js +2 -2
- package/dist/es2019/components/table-head-cell.compiled.css +9 -0
- package/dist/es2019/components/table-head-cell.js +68 -7
- package/dist/es2019/components/table-head.js +26 -1
- package/dist/es2019/styled/table-head.js +20 -3
- package/dist/esm/components/stateless.js +2 -2
- package/dist/esm/components/table-head-cell.compiled.css +9 -0
- package/dist/esm/components/table-head-cell.js +73 -8
- package/dist/esm/components/table-head.js +26 -3
- package/dist/esm/styled/table-head.js +20 -3
- package/dist/types/components/table-head-cell.d.ts +2 -0
- package/dist/types/components/table-head.d.ts +4 -1
- package/dist/types-ts4.5/components/table-head-cell.d.ts +2 -0
- package/dist/types-ts4.5/components/table-head.d.ts +4 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/dynamic-table
|
|
2
2
|
|
|
3
|
+
## 17.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#177496](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177496)
|
|
8
|
+
[`3c97c348c655c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c97c348c655c) -
|
|
9
|
+
Migrated from `@emotion/react` to `@compiled/react` in order to improve performance, align with
|
|
10
|
+
the rest of the Atlaskit techstack, and support React 18 Streaming SSR. Please note, in order to
|
|
11
|
+
use this version of `@atlaskit/dynamic-table`, you will need to ensure that your bundler is
|
|
12
|
+
configured to handle `.css` imports correctly. Most bundlers come with built-in support for `.css`
|
|
13
|
+
imports, so you may not need to do anything. If you are using a different bundler, please refer to
|
|
14
|
+
the documentation for that bundler to understand how to handle `.css` imports. For more
|
|
15
|
+
information on the migration, please refer to
|
|
16
|
+
[RFC-73 Migrating our components to Compiled CSS-in-JS](https://community.developer.atlassian.com/t/rfc-73-migrating-our-components-to-compiled-css-in-js/85953).
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#177496](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177496)
|
|
21
|
+
[`3c97c348c655c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c97c348c655c) -
|
|
22
|
+
[ux] Visually refreshed sort button icon and styles for DynamicTableStateless
|
|
23
|
+
|
|
3
24
|
## 16.1.4
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -86,14 +86,14 @@ var DynamicTable = function DynamicTable(_ref) {
|
|
|
86
86
|
action: 'sorted',
|
|
87
87
|
componentName: 'dynamicTable',
|
|
88
88
|
packageName: "@atlaskit/dynamic-table",
|
|
89
|
-
packageVersion: "
|
|
89
|
+
packageVersion: "17.0.0"
|
|
90
90
|
});
|
|
91
91
|
var onRankEnd = (0, _analyticsNext.usePlatformLeafEventHandler)({
|
|
92
92
|
fn: providedOnRankEnd,
|
|
93
93
|
action: 'ranked',
|
|
94
94
|
componentName: 'dynamicTable',
|
|
95
95
|
packageName: "@atlaskit/dynamic-table",
|
|
96
|
-
packageVersion: "
|
|
96
|
+
packageVersion: "17.0.0"
|
|
97
97
|
});
|
|
98
98
|
(0, _react.useEffect)(function () {
|
|
99
99
|
(0, _helpers.validateSortKey)(sortKey, head);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
._1yt41b66{padding:var(--ds-space-050,4px)}._19bvu2gc{padding-left:var(--ds-space-100,8px)}
|
|
3
|
+
._1e0c1txw{display:flex}
|
|
4
|
+
._4cvr1h6o{align-items:center}
|
|
5
|
+
._bfhk18uv{background-color:initial}
|
|
6
|
+
._tzy4idpf{opacity:0}
|
|
7
|
+
._tzy4kb7n{opacity:1}
|
|
8
|
+
._1h7hkb7n:focus{opacity:1}
|
|
9
|
+
._d0altlke:hover{cursor:pointer}
|
|
@@ -1,15 +1,36 @@
|
|
|
1
|
+
/* table-head-cell.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
Object.defineProperty(exports, "__esModule", {
|
|
5
7
|
value: true
|
|
6
8
|
});
|
|
7
9
|
exports.default = void 0;
|
|
10
|
+
require("./table-head-cell.compiled.css");
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
8
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react =
|
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
16
|
+
var _arrowDown = _interopRequireDefault(require("@atlaskit/icon/core/arrow-down"));
|
|
17
|
+
var _arrowUp = _interopRequireDefault(require("@atlaskit/icon/core/arrow-up"));
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
21
|
+
var _constants = require("../internal/constants");
|
|
11
22
|
var _tableHead = require("../styled/table-head");
|
|
12
|
-
var _excluded = ["content", "inlineStyles", "testId", "isRanking", "innerRef", "isSortable", "onClick"];
|
|
23
|
+
var _excluded = ["content", "inlineStyles", "testId", "isRanking", "innerRef", "isSortable", "sortOrder", "onClick", "headCellId", "activeSortButtonId"];
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
+
var styles = {
|
|
27
|
+
buttonWrapper: "_19bvu2gc _d0altlke",
|
|
28
|
+
buttonHiddenWrapper: "_1e0c1txw _tzy4idpf _bfhk18uv _1yt41b66 _1h7hkb7n",
|
|
29
|
+
buttonVisibleWrapper: "_1e0c1txw _tzy4kb7n _bfhk18uv _1yt41b66"
|
|
30
|
+
};
|
|
31
|
+
var headCellStyles = {
|
|
32
|
+
headCellContainer: "_1e0c1txw _4cvr1h6o"
|
|
33
|
+
};
|
|
13
34
|
var TableHeadCell = function TableHeadCell(_ref) {
|
|
14
35
|
var content = _ref.content,
|
|
15
36
|
inlineStyles = _ref.inlineStyles,
|
|
@@ -17,8 +38,57 @@ var TableHeadCell = function TableHeadCell(_ref) {
|
|
|
17
38
|
isRanking = _ref.isRanking,
|
|
18
39
|
innerRef = _ref.innerRef,
|
|
19
40
|
isSortable = _ref.isSortable,
|
|
41
|
+
sortOrder = _ref.sortOrder,
|
|
20
42
|
onClick = _ref.onClick,
|
|
43
|
+
headCellId = _ref.headCellId,
|
|
44
|
+
activeSortButtonId = _ref.activeSortButtonId,
|
|
21
45
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
46
|
+
var _ref2 = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ?
|
|
47
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
48
|
+
(0, _react.useState)(false) : [undefined, undefined],
|
|
49
|
+
_ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
50
|
+
isHovered = _ref3[0],
|
|
51
|
+
setIsHovered = _ref3[1];
|
|
52
|
+
var isSortButtonVisible = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? isHovered || headCellId === activeSortButtonId || sortOrder !== undefined : undefined;
|
|
53
|
+
var handleMouseEnter = (0, _react.useCallback)(function () {
|
|
54
|
+
// Remove check for isHovered when cleaning up platform-component-visual-refresh
|
|
55
|
+
if (isHovered !== undefined && (0, _platformFeatureFlags.fg)('platform-component-visual-refresh')) {
|
|
56
|
+
setIsHovered(true);
|
|
57
|
+
}
|
|
58
|
+
}, [isHovered, setIsHovered]);
|
|
59
|
+
var handleMouseLeave = (0, _react.useCallback)(function () {
|
|
60
|
+
// Remove check for isHovered when cleaning up platform-component-visual-refresh
|
|
61
|
+
if (isHovered !== undefined && (0, _platformFeatureFlags.fg)('platform-component-visual-refresh')) {
|
|
62
|
+
setIsHovered(false);
|
|
63
|
+
}
|
|
64
|
+
}, [isHovered, setIsHovered]);
|
|
65
|
+
var visuallyRefreshedButton = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
66
|
+
xcss: headCellStyles.headCellContainer,
|
|
67
|
+
onMouseEnter: handleMouseEnter,
|
|
68
|
+
onMouseLeave: handleMouseLeave
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
70
|
+
size: "small",
|
|
71
|
+
color: "color.text.subtle",
|
|
72
|
+
weight: "bold",
|
|
73
|
+
maxLines: 1
|
|
74
|
+
}, content), /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
75
|
+
xcss: styles.buttonWrapper
|
|
76
|
+
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
77
|
+
content: sortOrder === _constants.ASC ? 'Sort ascending' : 'Sort descending'
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Pressable, {
|
|
79
|
+
onClick: onClick,
|
|
80
|
+
xcss: isSortButtonVisible ? styles.buttonVisibleWrapper : styles.buttonHiddenWrapper,
|
|
81
|
+
"aria-roledescription": "Sort button"
|
|
82
|
+
}, sortOrder === _constants.ASC ? /*#__PURE__*/_react.default.createElement(_arrowUp.default, {
|
|
83
|
+
label: "",
|
|
84
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
85
|
+
}) : /*#__PURE__*/_react.default.createElement(_arrowDown.default, {
|
|
86
|
+
label: "",
|
|
87
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
88
|
+
}))))) : /*#__PURE__*/_react.default.createElement("button", {
|
|
89
|
+
type: "button",
|
|
90
|
+
"aria-roledescription": "Sort button"
|
|
91
|
+
}, content);
|
|
22
92
|
return /*#__PURE__*/_react.default.createElement(_tableHead.HeadCell
|
|
23
93
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
24
94
|
, (0, _extends2.default)({
|
|
@@ -27,12 +97,10 @@ var TableHeadCell = function TableHeadCell(_ref) {
|
|
|
27
97
|
ref: typeof innerRef !== 'string' ? innerRef : null // string refs must be discarded as LegacyRefs are not compatible with FC forwardRefs
|
|
28
98
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
29
99
|
}, rest, {
|
|
30
|
-
onClick: onClick,
|
|
31
|
-
isSortable: isSortable
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"aria-roledescription": "Sort button"
|
|
35
|
-
}, content) : content);
|
|
100
|
+
onClick: (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? undefined : onClick,
|
|
101
|
+
isSortable: isSortable,
|
|
102
|
+
sortOrder: sortOrder
|
|
103
|
+
}), isSortable ? visuallyRefreshedButton : content);
|
|
36
104
|
};
|
|
37
105
|
|
|
38
106
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -13,6 +13,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
13
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _helpers = require("../internal/helpers");
|
|
17
18
|
var _tableHead = require("../styled/table-head");
|
|
18
19
|
var _tableHeadCell = _interopRequireDefault(require("./rankable/table-head-cell"));
|
|
@@ -22,9 +23,14 @@ var _excluded = ["cells"],
|
|
|
22
23
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
23
24
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
24
25
|
var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
25
|
-
function TableHead() {
|
|
26
|
+
function TableHead(props) {
|
|
27
|
+
var _this;
|
|
26
28
|
(0, _classCallCheck2.default)(this, TableHead);
|
|
27
|
-
|
|
29
|
+
_this = _callSuper(this, TableHead, [props]);
|
|
30
|
+
_this.state = {
|
|
31
|
+
activeSortButtonId: null
|
|
32
|
+
};
|
|
33
|
+
return _this;
|
|
28
34
|
}
|
|
29
35
|
(0, _inherits2.default)(TableHead, _React$Component);
|
|
30
36
|
return (0, _createClass2.default)(TableHead, [{
|
|
@@ -42,6 +48,7 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
42
48
|
}, {
|
|
43
49
|
key: "render",
|
|
44
50
|
value: function render() {
|
|
51
|
+
var _this2 = this;
|
|
45
52
|
var _this$props = this.props,
|
|
46
53
|
head = _this$props.head,
|
|
47
54
|
sortKey = _this$props.sortKey,
|
|
@@ -51,6 +58,7 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
51
58
|
isRanking = _this$props.isRanking,
|
|
52
59
|
isRankable = _this$props.isRankable,
|
|
53
60
|
testId = _this$props.testId;
|
|
61
|
+
var activeSortButtonId = this.state.activeSortButtonId;
|
|
54
62
|
if (!head) {
|
|
55
63
|
return null;
|
|
56
64
|
}
|
|
@@ -74,6 +82,19 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
74
82
|
cellTestId = cell.testId,
|
|
75
83
|
width = cell.width,
|
|
76
84
|
restCellProps = (0, _objectWithoutProperties2.default)(cell, _excluded2);
|
|
85
|
+
var headCellId = "head-cell-".concat(index);
|
|
86
|
+
var handleClick = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? function () {
|
|
87
|
+
_this2.setState({
|
|
88
|
+
activeSortButtonId: headCellId
|
|
89
|
+
});
|
|
90
|
+
if (isSortable) {
|
|
91
|
+
onSort(cell)();
|
|
92
|
+
}
|
|
93
|
+
} : function () {
|
|
94
|
+
if (isSortable) {
|
|
95
|
+
onSort(cell)();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
77
98
|
return /*#__PURE__*/_react.default.createElement(HeadCellComponent, (0, _extends2.default)({
|
|
78
99
|
colSpan: colSpan,
|
|
79
100
|
content: content,
|
|
@@ -81,7 +102,9 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
81
102
|
isSortable: !!isSortable,
|
|
82
103
|
isRanking: isRanking,
|
|
83
104
|
key: key || index,
|
|
84
|
-
|
|
105
|
+
headCellId: headCellId,
|
|
106
|
+
activeSortButtonId: activeSortButtonId,
|
|
107
|
+
onClick: handleClick,
|
|
85
108
|
testId: cellTestId || testId,
|
|
86
109
|
shouldTruncate: shouldTruncate,
|
|
87
110
|
sortOrder: key === sortKey ? sortOrder : undefined,
|
|
@@ -10,6 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _colors = require("@atlaskit/theme/colors");
|
|
14
15
|
var _constants = require("../internal/constants");
|
|
15
16
|
var _theme = require("../theme");
|
|
@@ -42,6 +43,21 @@ var Head = exports.Head = function Head(_ref) {
|
|
|
42
43
|
}, props));
|
|
43
44
|
};
|
|
44
45
|
var headCellBaseStyles = (0, _react2.css)({
|
|
46
|
+
boxSizing: 'border-box',
|
|
47
|
+
position: 'relative',
|
|
48
|
+
border: 'none',
|
|
49
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
50
|
+
borderBlockEnd: "2px solid ".concat(_theme.tableBorder.borderColor),
|
|
51
|
+
color: "var(--ds-text-subtle, ".concat("var(".concat(CSS_VAR_TEXT_COLOR, ")"), ")"),
|
|
52
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
53
|
+
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
54
|
+
textAlign: 'left',
|
|
55
|
+
verticalAlign: 'middle',
|
|
56
|
+
'&:focus-visible': {
|
|
57
|
+
outline: "solid 2px ".concat("var(--ds-border-focused, ".concat(_colors.B100, ")"))
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var headCellBaseStylesOld = (0, _react2.css)({
|
|
45
61
|
boxSizing: 'border-box',
|
|
46
62
|
position: 'relative',
|
|
47
63
|
border: 'none',
|
|
@@ -175,6 +191,7 @@ var HeadCell = exports.HeadCell = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
175
191
|
// If there is no content in the cell, it should be rendered as an empty `td`, not a `th`.
|
|
176
192
|
// https://dequeuniversity.com/rules/axe/4.7/empty-table-header
|
|
177
193
|
var Component = children ? 'th' : 'td';
|
|
194
|
+
var isVisuallyRefreshed = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh');
|
|
178
195
|
return (0, _react2.jsx)(Component, (0, _extends2.default)({
|
|
179
196
|
"aria-sort": getFormattedSortOrder()
|
|
180
197
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -182,14 +199,14 @@ var HeadCell = exports.HeadCell = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
182
199
|
style: mergedStyles,
|
|
183
200
|
css: [
|
|
184
201
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
185
|
-
_constants2.cellStyles, headCellBaseStyles, onClick && onClickStyles,
|
|
202
|
+
_constants2.cellStyles, isVisuallyRefreshed ? headCellBaseStyles : headCellBaseStylesOld, !isVisuallyRefreshed && onClick && onClickStyles,
|
|
186
203
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
187
204
|
_constants2.truncationWidthStyles,
|
|
188
205
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
189
206
|
isFixedSize && shouldTruncate && _constants2.fixedSizeTruncateStyles,
|
|
190
207
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
191
|
-
isFixedSize && _constants2.overflowTruncateStyles, isSortable && baseStyles, isASC && ascendingStyles, isDESC && descendingStyles],
|
|
192
|
-
onClick: onClick,
|
|
208
|
+
isFixedSize && _constants2.overflowTruncateStyles, !isVisuallyRefreshed && isSortable && baseStyles, !isVisuallyRefreshed && isASC && ascendingStyles, !isVisuallyRefreshed && isDESC && descendingStyles],
|
|
209
|
+
onClick: !isVisuallyRefreshed ? onClick : undefined,
|
|
193
210
|
ref: ref,
|
|
194
211
|
"data-testid": testId
|
|
195
212
|
}, rest), children);
|
|
@@ -60,14 +60,14 @@ const DynamicTable = ({
|
|
|
60
60
|
action: 'sorted',
|
|
61
61
|
componentName: 'dynamicTable',
|
|
62
62
|
packageName: "@atlaskit/dynamic-table",
|
|
63
|
-
packageVersion: "
|
|
63
|
+
packageVersion: "17.0.0"
|
|
64
64
|
});
|
|
65
65
|
const onRankEnd = usePlatformLeafEventHandler({
|
|
66
66
|
fn: providedOnRankEnd,
|
|
67
67
|
action: 'ranked',
|
|
68
68
|
componentName: 'dynamicTable',
|
|
69
69
|
packageName: "@atlaskit/dynamic-table",
|
|
70
|
-
packageVersion: "
|
|
70
|
+
packageVersion: "17.0.0"
|
|
71
71
|
});
|
|
72
72
|
useEffect(() => {
|
|
73
73
|
validateSortKey(sortKey, head);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
._1yt41b66{padding:var(--ds-space-050,4px)}._19bvu2gc{padding-left:var(--ds-space-100,8px)}
|
|
3
|
+
._1e0c1txw{display:flex}
|
|
4
|
+
._4cvr1h6o{align-items:center}
|
|
5
|
+
._bfhk18uv{background-color:initial}
|
|
6
|
+
._tzy4idpf{opacity:0}
|
|
7
|
+
._tzy4kb7n{opacity:1}
|
|
8
|
+
._1h7hkb7n:focus{opacity:1}
|
|
9
|
+
._d0altlke:hover{cursor:pointer}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
+
/* table-head-cell.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
+
import "./table-head-cell.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import React, { useCallback, useState } from 'react';
|
|
6
|
+
import ArrowDownIcon from '@atlaskit/icon/core/arrow-down';
|
|
7
|
+
import ArrowUpIcon from '@atlaskit/icon/core/arrow-up';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { Box, Flex, Pressable, Text } from '@atlaskit/primitives/compiled';
|
|
10
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
11
|
+
import { ASC } from '../internal/constants';
|
|
3
12
|
import { HeadCell } from '../styled/table-head';
|
|
13
|
+
const styles = {
|
|
14
|
+
buttonWrapper: "_19bvu2gc _d0altlke",
|
|
15
|
+
buttonHiddenWrapper: "_1e0c1txw _tzy4idpf _bfhk18uv _1yt41b66 _1h7hkb7n",
|
|
16
|
+
buttonVisibleWrapper: "_1e0c1txw _tzy4kb7n _bfhk18uv _1yt41b66"
|
|
17
|
+
};
|
|
18
|
+
const headCellStyles = {
|
|
19
|
+
headCellContainer: "_1e0c1txw _4cvr1h6o"
|
|
20
|
+
};
|
|
4
21
|
const TableHeadCell = ({
|
|
5
22
|
content,
|
|
6
23
|
inlineStyles,
|
|
@@ -8,9 +25,55 @@ const TableHeadCell = ({
|
|
|
8
25
|
isRanking,
|
|
9
26
|
innerRef,
|
|
10
27
|
isSortable,
|
|
28
|
+
sortOrder,
|
|
11
29
|
onClick,
|
|
30
|
+
headCellId,
|
|
31
|
+
activeSortButtonId,
|
|
12
32
|
...rest
|
|
13
33
|
}) => {
|
|
34
|
+
const [isHovered, setIsHovered] = fg('platform-component-visual-refresh') ?
|
|
35
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
36
|
+
useState(false) : [undefined, undefined];
|
|
37
|
+
const isSortButtonVisible = fg('platform-component-visual-refresh') ? isHovered || headCellId === activeSortButtonId || sortOrder !== undefined : undefined;
|
|
38
|
+
const handleMouseEnter = useCallback(() => {
|
|
39
|
+
// Remove check for isHovered when cleaning up platform-component-visual-refresh
|
|
40
|
+
if (isHovered !== undefined && fg('platform-component-visual-refresh')) {
|
|
41
|
+
setIsHovered(true);
|
|
42
|
+
}
|
|
43
|
+
}, [isHovered, setIsHovered]);
|
|
44
|
+
const handleMouseLeave = useCallback(() => {
|
|
45
|
+
// Remove check for isHovered when cleaning up platform-component-visual-refresh
|
|
46
|
+
if (isHovered !== undefined && fg('platform-component-visual-refresh')) {
|
|
47
|
+
setIsHovered(false);
|
|
48
|
+
}
|
|
49
|
+
}, [isHovered, setIsHovered]);
|
|
50
|
+
const visuallyRefreshedButton = fg('platform-component-visual-refresh') ? /*#__PURE__*/React.createElement(Box, {
|
|
51
|
+
xcss: headCellStyles.headCellContainer,
|
|
52
|
+
onMouseEnter: handleMouseEnter,
|
|
53
|
+
onMouseLeave: handleMouseLeave
|
|
54
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
55
|
+
size: "small",
|
|
56
|
+
color: "color.text.subtle",
|
|
57
|
+
weight: "bold",
|
|
58
|
+
maxLines: 1
|
|
59
|
+
}, content), /*#__PURE__*/React.createElement(Flex, {
|
|
60
|
+
xcss: styles.buttonWrapper
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
62
|
+
content: sortOrder === ASC ? 'Sort ascending' : 'Sort descending'
|
|
63
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
64
|
+
onClick: onClick,
|
|
65
|
+
xcss: isSortButtonVisible ? styles.buttonVisibleWrapper : styles.buttonHiddenWrapper,
|
|
66
|
+
"aria-roledescription": "Sort button"
|
|
67
|
+
}, sortOrder === ASC ? /*#__PURE__*/React.createElement(ArrowUpIcon, {
|
|
68
|
+
label: "",
|
|
69
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
70
|
+
}) : /*#__PURE__*/React.createElement(ArrowDownIcon, {
|
|
71
|
+
label: "",
|
|
72
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
73
|
+
}))))) : /*#__PURE__*/React.createElement("button", {
|
|
74
|
+
type: "button",
|
|
75
|
+
"aria-roledescription": "Sort button"
|
|
76
|
+
}, content);
|
|
14
77
|
return /*#__PURE__*/React.createElement(HeadCell
|
|
15
78
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
16
79
|
, _extends({
|
|
@@ -19,12 +82,10 @@ const TableHeadCell = ({
|
|
|
19
82
|
ref: typeof innerRef !== 'string' ? innerRef : null // string refs must be discarded as LegacyRefs are not compatible with FC forwardRefs
|
|
20
83
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
21
84
|
}, rest, {
|
|
22
|
-
onClick: onClick,
|
|
23
|
-
isSortable: isSortable
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"aria-roledescription": "Sort button"
|
|
27
|
-
}, content) : content);
|
|
85
|
+
onClick: fg('platform-component-visual-refresh') ? undefined : onClick,
|
|
86
|
+
isSortable: isSortable,
|
|
87
|
+
sortOrder: sortOrder
|
|
88
|
+
}), isSortable ? visuallyRefreshedButton : content);
|
|
28
89
|
};
|
|
29
90
|
|
|
30
91
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { validateSortKey } from '../internal/helpers';
|
|
4
5
|
import { Head } from '../styled/table-head';
|
|
5
6
|
import RankableHeadCell from './rankable/table-head-cell';
|
|
6
7
|
import HeadCell from './table-head-cell';
|
|
7
8
|
class TableHead extends React.Component {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
super(props);
|
|
11
|
+
this.state = {
|
|
12
|
+
activeSortButtonId: null
|
|
13
|
+
};
|
|
14
|
+
}
|
|
8
15
|
UNSAFE_componentWillMount() {
|
|
9
16
|
validateSortKey(this.props.sortKey, this.props.head);
|
|
10
17
|
}
|
|
@@ -24,6 +31,9 @@ class TableHead extends React.Component {
|
|
|
24
31
|
isRankable,
|
|
25
32
|
testId
|
|
26
33
|
} = this.props;
|
|
34
|
+
const {
|
|
35
|
+
activeSortButtonId
|
|
36
|
+
} = this.state;
|
|
27
37
|
if (!head) {
|
|
28
38
|
return null;
|
|
29
39
|
}
|
|
@@ -53,6 +63,19 @@ class TableHead extends React.Component {
|
|
|
53
63
|
// the API.
|
|
54
64
|
...restCellProps
|
|
55
65
|
} = cell;
|
|
66
|
+
const headCellId = `head-cell-${index}`;
|
|
67
|
+
const handleClick = fg('platform-component-visual-refresh') ? () => {
|
|
68
|
+
this.setState({
|
|
69
|
+
activeSortButtonId: headCellId
|
|
70
|
+
});
|
|
71
|
+
if (isSortable) {
|
|
72
|
+
onSort(cell)();
|
|
73
|
+
}
|
|
74
|
+
} : () => {
|
|
75
|
+
if (isSortable) {
|
|
76
|
+
onSort(cell)();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
56
79
|
return /*#__PURE__*/React.createElement(HeadCellComponent, _extends({
|
|
57
80
|
colSpan: colSpan,
|
|
58
81
|
content: content,
|
|
@@ -60,7 +83,9 @@ class TableHead extends React.Component {
|
|
|
60
83
|
isSortable: !!isSortable,
|
|
61
84
|
isRanking: isRanking,
|
|
62
85
|
key: key || index,
|
|
63
|
-
|
|
86
|
+
headCellId: headCellId,
|
|
87
|
+
activeSortButtonId: activeSortButtonId,
|
|
88
|
+
onClick: handleClick,
|
|
64
89
|
testId: cellTestId || testId,
|
|
65
90
|
shouldTruncate: shouldTruncate,
|
|
66
91
|
sortOrder: key === sortKey ? sortOrder : undefined,
|
|
@@ -8,6 +8,7 @@ import { forwardRef } from 'react';
|
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { B100, N30A } from '@atlaskit/theme/colors';
|
|
12
13
|
import { ASC, DESC } from '../internal/constants';
|
|
13
14
|
import { arrow, head, MSThemeColors, tableBorder } from '../theme';
|
|
@@ -31,6 +32,21 @@ export const Head = ({
|
|
|
31
32
|
}, props));
|
|
32
33
|
};
|
|
33
34
|
const headCellBaseStyles = css({
|
|
35
|
+
boxSizing: 'border-box',
|
|
36
|
+
position: 'relative',
|
|
37
|
+
border: 'none',
|
|
38
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
39
|
+
borderBlockEnd: `2px solid ${tableBorder.borderColor}`,
|
|
40
|
+
color: `var(--ds-text-subtle, ${`var(${CSS_VAR_TEXT_COLOR})`})`,
|
|
41
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
42
|
+
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
43
|
+
textAlign: 'left',
|
|
44
|
+
verticalAlign: 'middle',
|
|
45
|
+
'&:focus-visible': {
|
|
46
|
+
outline: `solid 2px ${`var(--ds-border-focused, ${B100})`}`
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const headCellBaseStylesOld = css({
|
|
34
50
|
boxSizing: 'border-box',
|
|
35
51
|
position: 'relative',
|
|
36
52
|
border: 'none',
|
|
@@ -169,6 +185,7 @@ export const HeadCell = /*#__PURE__*/forwardRef(({
|
|
|
169
185
|
// If there is no content in the cell, it should be rendered as an empty `td`, not a `th`.
|
|
170
186
|
// https://dequeuniversity.com/rules/axe/4.7/empty-table-header
|
|
171
187
|
const Component = children ? 'th' : 'td';
|
|
188
|
+
const isVisuallyRefreshed = fg('platform-component-visual-refresh');
|
|
172
189
|
return jsx(Component, _extends({
|
|
173
190
|
"aria-sort": getFormattedSortOrder()
|
|
174
191
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -176,14 +193,14 @@ export const HeadCell = /*#__PURE__*/forwardRef(({
|
|
|
176
193
|
style: mergedStyles,
|
|
177
194
|
css: [
|
|
178
195
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
179
|
-
cellStyles, headCellBaseStyles, onClick && onClickStyles,
|
|
196
|
+
cellStyles, isVisuallyRefreshed ? headCellBaseStyles : headCellBaseStylesOld, !isVisuallyRefreshed && onClick && onClickStyles,
|
|
180
197
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
181
198
|
truncationWidthStyles,
|
|
182
199
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
183
200
|
isFixedSize && shouldTruncate && fixedSizeTruncateStyles,
|
|
184
201
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
185
|
-
isFixedSize && overflowTruncateStyles, isSortable && baseStyles, isASC && ascendingStyles, isDESC && descendingStyles],
|
|
186
|
-
onClick: onClick,
|
|
202
|
+
isFixedSize && overflowTruncateStyles, !isVisuallyRefreshed && isSortable && baseStyles, !isVisuallyRefreshed && isASC && ascendingStyles, !isVisuallyRefreshed && isDESC && descendingStyles],
|
|
203
|
+
onClick: !isVisuallyRefreshed ? onClick : undefined,
|
|
187
204
|
ref: ref,
|
|
188
205
|
"data-testid": testId
|
|
189
206
|
}, rest), children);
|
|
@@ -76,14 +76,14 @@ var DynamicTable = function DynamicTable(_ref) {
|
|
|
76
76
|
action: 'sorted',
|
|
77
77
|
componentName: 'dynamicTable',
|
|
78
78
|
packageName: "@atlaskit/dynamic-table",
|
|
79
|
-
packageVersion: "
|
|
79
|
+
packageVersion: "17.0.0"
|
|
80
80
|
});
|
|
81
81
|
var onRankEnd = usePlatformLeafEventHandler({
|
|
82
82
|
fn: providedOnRankEnd,
|
|
83
83
|
action: 'ranked',
|
|
84
84
|
componentName: 'dynamicTable',
|
|
85
85
|
packageName: "@atlaskit/dynamic-table",
|
|
86
|
-
packageVersion: "
|
|
86
|
+
packageVersion: "17.0.0"
|
|
87
87
|
});
|
|
88
88
|
useEffect(function () {
|
|
89
89
|
validateSortKey(sortKey, head);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
._1yt41b66{padding:var(--ds-space-050,4px)}._19bvu2gc{padding-left:var(--ds-space-100,8px)}
|
|
3
|
+
._1e0c1txw{display:flex}
|
|
4
|
+
._4cvr1h6o{align-items:center}
|
|
5
|
+
._bfhk18uv{background-color:initial}
|
|
6
|
+
._tzy4idpf{opacity:0}
|
|
7
|
+
._tzy4kb7n{opacity:1}
|
|
8
|
+
._1h7hkb7n:focus{opacity:1}
|
|
9
|
+
._d0altlke:hover{cursor:pointer}
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
+
/* table-head-cell.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["content", "inlineStyles", "testId", "isRanking", "innerRef", "isSortable", "onClick"];
|
|
4
|
-
import
|
|
5
|
+
var _excluded = ["content", "inlineStyles", "testId", "isRanking", "innerRef", "isSortable", "sortOrder", "onClick", "headCellId", "activeSortButtonId"];
|
|
6
|
+
import "./table-head-cell.compiled.css";
|
|
7
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
|
+
import React, { useCallback, useState } from 'react';
|
|
9
|
+
import ArrowDownIcon from '@atlaskit/icon/core/arrow-down';
|
|
10
|
+
import ArrowUpIcon from '@atlaskit/icon/core/arrow-up';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { Box, Flex, Pressable, Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
14
|
+
import { ASC } from '../internal/constants';
|
|
5
15
|
import { HeadCell } from '../styled/table-head';
|
|
16
|
+
var styles = {
|
|
17
|
+
buttonWrapper: "_19bvu2gc _d0altlke",
|
|
18
|
+
buttonHiddenWrapper: "_1e0c1txw _tzy4idpf _bfhk18uv _1yt41b66 _1h7hkb7n",
|
|
19
|
+
buttonVisibleWrapper: "_1e0c1txw _tzy4kb7n _bfhk18uv _1yt41b66"
|
|
20
|
+
};
|
|
21
|
+
var headCellStyles = {
|
|
22
|
+
headCellContainer: "_1e0c1txw _4cvr1h6o"
|
|
23
|
+
};
|
|
6
24
|
var TableHeadCell = function TableHeadCell(_ref) {
|
|
7
25
|
var content = _ref.content,
|
|
8
26
|
inlineStyles = _ref.inlineStyles,
|
|
@@ -10,8 +28,57 @@ var TableHeadCell = function TableHeadCell(_ref) {
|
|
|
10
28
|
isRanking = _ref.isRanking,
|
|
11
29
|
innerRef = _ref.innerRef,
|
|
12
30
|
isSortable = _ref.isSortable,
|
|
31
|
+
sortOrder = _ref.sortOrder,
|
|
13
32
|
onClick = _ref.onClick,
|
|
33
|
+
headCellId = _ref.headCellId,
|
|
34
|
+
activeSortButtonId = _ref.activeSortButtonId,
|
|
14
35
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
+
var _ref2 = fg('platform-component-visual-refresh') ?
|
|
37
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
38
|
+
useState(false) : [undefined, undefined],
|
|
39
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
40
|
+
isHovered = _ref3[0],
|
|
41
|
+
setIsHovered = _ref3[1];
|
|
42
|
+
var isSortButtonVisible = fg('platform-component-visual-refresh') ? isHovered || headCellId === activeSortButtonId || sortOrder !== undefined : undefined;
|
|
43
|
+
var handleMouseEnter = useCallback(function () {
|
|
44
|
+
// Remove check for isHovered when cleaning up platform-component-visual-refresh
|
|
45
|
+
if (isHovered !== undefined && fg('platform-component-visual-refresh')) {
|
|
46
|
+
setIsHovered(true);
|
|
47
|
+
}
|
|
48
|
+
}, [isHovered, setIsHovered]);
|
|
49
|
+
var handleMouseLeave = useCallback(function () {
|
|
50
|
+
// Remove check for isHovered when cleaning up platform-component-visual-refresh
|
|
51
|
+
if (isHovered !== undefined && fg('platform-component-visual-refresh')) {
|
|
52
|
+
setIsHovered(false);
|
|
53
|
+
}
|
|
54
|
+
}, [isHovered, setIsHovered]);
|
|
55
|
+
var visuallyRefreshedButton = fg('platform-component-visual-refresh') ? /*#__PURE__*/React.createElement(Box, {
|
|
56
|
+
xcss: headCellStyles.headCellContainer,
|
|
57
|
+
onMouseEnter: handleMouseEnter,
|
|
58
|
+
onMouseLeave: handleMouseLeave
|
|
59
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
60
|
+
size: "small",
|
|
61
|
+
color: "color.text.subtle",
|
|
62
|
+
weight: "bold",
|
|
63
|
+
maxLines: 1
|
|
64
|
+
}, content), /*#__PURE__*/React.createElement(Flex, {
|
|
65
|
+
xcss: styles.buttonWrapper
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
67
|
+
content: sortOrder === ASC ? 'Sort ascending' : 'Sort descending'
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
69
|
+
onClick: onClick,
|
|
70
|
+
xcss: isSortButtonVisible ? styles.buttonVisibleWrapper : styles.buttonHiddenWrapper,
|
|
71
|
+
"aria-roledescription": "Sort button"
|
|
72
|
+
}, sortOrder === ASC ? /*#__PURE__*/React.createElement(ArrowUpIcon, {
|
|
73
|
+
label: "",
|
|
74
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
75
|
+
}) : /*#__PURE__*/React.createElement(ArrowDownIcon, {
|
|
76
|
+
label: "",
|
|
77
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
78
|
+
}))))) : /*#__PURE__*/React.createElement("button", {
|
|
79
|
+
type: "button",
|
|
80
|
+
"aria-roledescription": "Sort button"
|
|
81
|
+
}, content);
|
|
15
82
|
return /*#__PURE__*/React.createElement(HeadCell
|
|
16
83
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
17
84
|
, _extends({
|
|
@@ -20,12 +87,10 @@ var TableHeadCell = function TableHeadCell(_ref) {
|
|
|
20
87
|
ref: typeof innerRef !== 'string' ? innerRef : null // string refs must be discarded as LegacyRefs are not compatible with FC forwardRefs
|
|
21
88
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
22
89
|
}, rest, {
|
|
23
|
-
onClick: onClick,
|
|
24
|
-
isSortable: isSortable
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"aria-roledescription": "Sort button"
|
|
28
|
-
}, content) : content);
|
|
90
|
+
onClick: fg('platform-component-visual-refresh') ? undefined : onClick,
|
|
91
|
+
isSortable: isSortable,
|
|
92
|
+
sortOrder: sortOrder
|
|
93
|
+
}), isSortable ? visuallyRefreshedButton : content);
|
|
29
94
|
};
|
|
30
95
|
|
|
31
96
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -10,14 +10,20 @@ var _excluded = ["cells"],
|
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
12
|
import React from 'react';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { validateSortKey } from '../internal/helpers';
|
|
14
15
|
import { Head } from '../styled/table-head';
|
|
15
16
|
import RankableHeadCell from './rankable/table-head-cell';
|
|
16
17
|
import HeadCell from './table-head-cell';
|
|
17
18
|
var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
18
|
-
function TableHead() {
|
|
19
|
+
function TableHead(props) {
|
|
20
|
+
var _this;
|
|
19
21
|
_classCallCheck(this, TableHead);
|
|
20
|
-
|
|
22
|
+
_this = _callSuper(this, TableHead, [props]);
|
|
23
|
+
_this.state = {
|
|
24
|
+
activeSortButtonId: null
|
|
25
|
+
};
|
|
26
|
+
return _this;
|
|
21
27
|
}
|
|
22
28
|
_inherits(TableHead, _React$Component);
|
|
23
29
|
return _createClass(TableHead, [{
|
|
@@ -35,6 +41,7 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
35
41
|
}, {
|
|
36
42
|
key: "render",
|
|
37
43
|
value: function render() {
|
|
44
|
+
var _this2 = this;
|
|
38
45
|
var _this$props = this.props,
|
|
39
46
|
head = _this$props.head,
|
|
40
47
|
sortKey = _this$props.sortKey,
|
|
@@ -44,6 +51,7 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
44
51
|
isRanking = _this$props.isRanking,
|
|
45
52
|
isRankable = _this$props.isRankable,
|
|
46
53
|
testId = _this$props.testId;
|
|
54
|
+
var activeSortButtonId = this.state.activeSortButtonId;
|
|
47
55
|
if (!head) {
|
|
48
56
|
return null;
|
|
49
57
|
}
|
|
@@ -67,6 +75,19 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
67
75
|
cellTestId = cell.testId,
|
|
68
76
|
width = cell.width,
|
|
69
77
|
restCellProps = _objectWithoutProperties(cell, _excluded2);
|
|
78
|
+
var headCellId = "head-cell-".concat(index);
|
|
79
|
+
var handleClick = fg('platform-component-visual-refresh') ? function () {
|
|
80
|
+
_this2.setState({
|
|
81
|
+
activeSortButtonId: headCellId
|
|
82
|
+
});
|
|
83
|
+
if (isSortable) {
|
|
84
|
+
onSort(cell)();
|
|
85
|
+
}
|
|
86
|
+
} : function () {
|
|
87
|
+
if (isSortable) {
|
|
88
|
+
onSort(cell)();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
70
91
|
return /*#__PURE__*/React.createElement(HeadCellComponent, _extends({
|
|
71
92
|
colSpan: colSpan,
|
|
72
93
|
content: content,
|
|
@@ -74,7 +95,9 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
74
95
|
isSortable: !!isSortable,
|
|
75
96
|
isRanking: isRanking,
|
|
76
97
|
key: key || index,
|
|
77
|
-
|
|
98
|
+
headCellId: headCellId,
|
|
99
|
+
activeSortButtonId: activeSortButtonId,
|
|
100
|
+
onClick: handleClick,
|
|
78
101
|
testId: cellTestId || testId,
|
|
79
102
|
shouldTruncate: shouldTruncate,
|
|
80
103
|
sortOrder: key === sortKey ? sortOrder : undefined,
|
|
@@ -14,6 +14,7 @@ import { forwardRef } from 'react';
|
|
|
14
14
|
|
|
15
15
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
16
|
import { css, jsx } from '@emotion/react';
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { B100, N30A } from '@atlaskit/theme/colors';
|
|
18
19
|
import { ASC, DESC } from '../internal/constants';
|
|
19
20
|
import { arrow, head, MSThemeColors, tableBorder } from '../theme';
|
|
@@ -36,6 +37,21 @@ export var Head = function Head(_ref) {
|
|
|
36
37
|
}, props));
|
|
37
38
|
};
|
|
38
39
|
var headCellBaseStyles = css({
|
|
40
|
+
boxSizing: 'border-box',
|
|
41
|
+
position: 'relative',
|
|
42
|
+
border: 'none',
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
44
|
+
borderBlockEnd: "2px solid ".concat(tableBorder.borderColor),
|
|
45
|
+
color: "var(--ds-text-subtle, ".concat("var(".concat(CSS_VAR_TEXT_COLOR, ")"), ")"),
|
|
46
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
47
|
+
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
48
|
+
textAlign: 'left',
|
|
49
|
+
verticalAlign: 'middle',
|
|
50
|
+
'&:focus-visible': {
|
|
51
|
+
outline: "solid 2px ".concat("var(--ds-border-focused, ".concat(B100, ")"))
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var headCellBaseStylesOld = css({
|
|
39
55
|
boxSizing: 'border-box',
|
|
40
56
|
position: 'relative',
|
|
41
57
|
border: 'none',
|
|
@@ -169,6 +185,7 @@ export var HeadCell = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
169
185
|
// If there is no content in the cell, it should be rendered as an empty `td`, not a `th`.
|
|
170
186
|
// https://dequeuniversity.com/rules/axe/4.7/empty-table-header
|
|
171
187
|
var Component = children ? 'th' : 'td';
|
|
188
|
+
var isVisuallyRefreshed = fg('platform-component-visual-refresh');
|
|
172
189
|
return jsx(Component, _extends({
|
|
173
190
|
"aria-sort": getFormattedSortOrder()
|
|
174
191
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -176,14 +193,14 @@ export var HeadCell = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
176
193
|
style: mergedStyles,
|
|
177
194
|
css: [
|
|
178
195
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
179
|
-
cellStyles, headCellBaseStyles, onClick && onClickStyles,
|
|
196
|
+
cellStyles, isVisuallyRefreshed ? headCellBaseStyles : headCellBaseStylesOld, !isVisuallyRefreshed && onClick && onClickStyles,
|
|
180
197
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
181
198
|
truncationWidthStyles,
|
|
182
199
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
183
200
|
isFixedSize && shouldTruncate && fixedSizeTruncateStyles,
|
|
184
201
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
185
|
-
isFixedSize && overflowTruncateStyles, isSortable && baseStyles, isASC && ascendingStyles, isDESC && descendingStyles],
|
|
186
|
-
onClick: onClick,
|
|
202
|
+
isFixedSize && overflowTruncateStyles, !isVisuallyRefreshed && isSortable && baseStyles, !isVisuallyRefreshed && isASC && ascendingStyles, !isVisuallyRefreshed && isDESC && descendingStyles],
|
|
203
|
+
onClick: !isVisuallyRefreshed ? onClick : undefined,
|
|
187
204
|
ref: ref,
|
|
188
205
|
"data-testid": testId
|
|
189
206
|
}, rest), children);
|
|
@@ -10,7 +10,10 @@ interface TableHeadProps {
|
|
|
10
10
|
isRanking: boolean;
|
|
11
11
|
testId?: string;
|
|
12
12
|
}
|
|
13
|
-
declare class TableHead extends React.Component<TableHeadProps, {
|
|
13
|
+
declare class TableHead extends React.Component<TableHeadProps, {
|
|
14
|
+
activeSortButtonId: string | null;
|
|
15
|
+
}> {
|
|
16
|
+
constructor(props: TableHeadProps);
|
|
14
17
|
UNSAFE_componentWillMount(): void;
|
|
15
18
|
UNSAFE_componentWillReceiveProps(nextProps: TableHeadProps): void;
|
|
16
19
|
render(): JSX.Element | null;
|
|
@@ -10,7 +10,10 @@ interface TableHeadProps {
|
|
|
10
10
|
isRanking: boolean;
|
|
11
11
|
testId?: string;
|
|
12
12
|
}
|
|
13
|
-
declare class TableHead extends React.Component<TableHeadProps, {
|
|
13
|
+
declare class TableHead extends React.Component<TableHeadProps, {
|
|
14
|
+
activeSortButtonId: string | null;
|
|
15
|
+
}> {
|
|
16
|
+
constructor(props: TableHeadProps);
|
|
14
17
|
UNSAFE_componentWillMount(): void;
|
|
15
18
|
UNSAFE_componentWillReceiveProps(nextProps: TableHeadProps): void;
|
|
16
19
|
render(): JSX.Element | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/dynamic-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
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/"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@atlaskit/button": "*",
|
|
63
63
|
"@atlaskit/link": "*",
|
|
64
64
|
"@atlaskit/ssr": "*",
|
|
65
|
-
"@atlaskit/toggle": "^
|
|
65
|
+
"@atlaskit/toggle": "^14.0.0",
|
|
66
66
|
"@atlaskit/visual-regression": "*",
|
|
67
67
|
"@emotion/styled": "^11.0.0",
|
|
68
68
|
"@testing-library/react": "^12.1.5",
|
|
@@ -91,6 +91,9 @@
|
|
|
91
91
|
"platform-feature-flags": {
|
|
92
92
|
"platform_design_system_dynamic_table_row_role": {
|
|
93
93
|
"type": "boolean"
|
|
94
|
+
},
|
|
95
|
+
"platform-component-visual-refresh": {
|
|
96
|
+
"type": "boolean"
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
}
|