@atlaskit/dynamic-table 16.1.4 → 17.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @atlaskit/dynamic-table
2
2
 
3
+ ## 17.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#99494](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99494)
8
+ [`71da0c3911d56`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/71da0c3911d56) -
9
+ [ux] Added customisable sort button labels
10
+
11
+ ## 17.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - [#177496](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177496)
16
+ [`3c97c348c655c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c97c348c655c) -
17
+ Migrated from `@emotion/react` to `@compiled/react` in order to improve performance, align with
18
+ the rest of the Atlaskit techstack, and support React 18 Streaming SSR. Please note, in order to
19
+ use this version of `@atlaskit/dynamic-table`, you will need to ensure that your bundler is
20
+ configured to handle `.css` imports correctly. Most bundlers come with built-in support for `.css`
21
+ imports, so you may not need to do anything. If you are using a different bundler, please refer to
22
+ the documentation for that bundler to understand how to handle `.css` imports. For more
23
+ information on the migration, please refer to
24
+ [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).
25
+
26
+ ### Patch Changes
27
+
28
+ - [#177496](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177496)
29
+ [`3c97c348c655c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c97c348c655c) -
30
+ [ux] Visually refreshed sort button icon and styles for DynamicTableStateless
31
+
3
32
  ## 16.1.4
4
33
 
5
34
  ### 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: "16.1.4"
89
+ packageVersion: "17.0.1"
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: "16.1.4"
96
+ packageVersion: "17.0.1"
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.35.0 */
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 = _interopRequireDefault(require("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", "ascendingSortTooltip", "descendingSortTooltip", "buttonAriaRoleDescription"];
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: "_1yt41b66 _1e0c1txw _tzy4idpf _bfhk18uv _1h7hkb7n",
29
+ buttonVisibleWrapper: "_1yt41b66 _1e0c1txw _tzy4kb7n _bfhk18uv"
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,63 @@ 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,
45
+ _ref$ascendingSortToo = _ref.ascendingSortTooltip,
46
+ ascendingSortTooltip = _ref$ascendingSortToo === void 0 ? 'Sort ascending' : _ref$ascendingSortToo,
47
+ _ref$descendingSortTo = _ref.descendingSortTooltip,
48
+ descendingSortTooltip = _ref$descendingSortTo === void 0 ? 'Sort descending' : _ref$descendingSortTo,
49
+ _ref$buttonAriaRoleDe = _ref.buttonAriaRoleDescription,
50
+ buttonAriaRoleDescription = _ref$buttonAriaRoleDe === void 0 ? 'Sort button' : _ref$buttonAriaRoleDe,
21
51
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
52
+ var _ref2 = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ?
53
+ // eslint-disable-next-line react-hooks/rules-of-hooks
54
+ (0, _react.useState)(false) : [undefined, undefined],
55
+ _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
56
+ isHovered = _ref3[0],
57
+ setIsHovered = _ref3[1];
58
+ var isSortButtonVisible = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? isHovered || headCellId === activeSortButtonId || sortOrder !== undefined : undefined;
59
+ var handleMouseEnter = (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(true);
63
+ }
64
+ }, [isHovered, setIsHovered]);
65
+ var handleMouseLeave = (0, _react.useCallback)(function () {
66
+ // Remove check for isHovered when cleaning up platform-component-visual-refresh
67
+ if (isHovered !== undefined && (0, _platformFeatureFlags.fg)('platform-component-visual-refresh')) {
68
+ setIsHovered(false);
69
+ }
70
+ }, [isHovered, setIsHovered]);
71
+ var visuallyRefreshedButton = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
72
+ xcss: headCellStyles.headCellContainer,
73
+ onMouseEnter: handleMouseEnter,
74
+ onMouseLeave: handleMouseLeave
75
+ }, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
76
+ size: "small",
77
+ color: "color.text.subtle",
78
+ weight: "bold",
79
+ maxLines: 1
80
+ }, content), /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
81
+ xcss: styles.buttonWrapper
82
+ }, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
83
+ content: sortOrder === _constants.ASC ? ascendingSortTooltip : descendingSortTooltip
84
+ }, /*#__PURE__*/_react.default.createElement(_compiled.Pressable, {
85
+ onClick: onClick,
86
+ xcss: isSortButtonVisible ? styles.buttonVisibleWrapper : styles.buttonHiddenWrapper,
87
+ "aria-roledescription": buttonAriaRoleDescription
88
+ }, sortOrder === _constants.ASC ? /*#__PURE__*/_react.default.createElement(_arrowUp.default, {
89
+ label: "",
90
+ color: "var(--ds-text-subtle, #44546F)"
91
+ }) : /*#__PURE__*/_react.default.createElement(_arrowDown.default, {
92
+ label: "",
93
+ color: "var(--ds-text-subtle, #44546F)"
94
+ }))))) : /*#__PURE__*/_react.default.createElement("button", {
95
+ type: "button",
96
+ "aria-roledescription": "Sort button"
97
+ }, content);
22
98
  return /*#__PURE__*/_react.default.createElement(_tableHead.HeadCell
23
99
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
24
100
  , (0, _extends2.default)({
@@ -27,12 +103,10 @@ var TableHeadCell = function TableHeadCell(_ref) {
27
103
  ref: typeof innerRef !== 'string' ? innerRef : null // string refs must be discarded as LegacyRefs are not compatible with FC forwardRefs
28
104
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
29
105
  }, rest, {
30
- onClick: onClick,
31
- isSortable: isSortable
32
- }), isSortable ? /*#__PURE__*/_react.default.createElement("button", {
33
- type: "button",
34
- "aria-roledescription": "Sort button"
35
- }, content) : content);
106
+ onClick: (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? undefined : onClick,
107
+ isSortable: isSortable,
108
+ sortOrder: sortOrder
109
+ }), isSortable ? visuallyRefreshedButton : content);
36
110
  };
37
111
 
38
112
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
@@ -13,18 +13,24 @@ 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"));
19
20
  var _tableHeadCell2 = _interopRequireDefault(require("./table-head-cell"));
20
21
  var _excluded = ["cells"],
21
- _excluded2 = ["colSpan", "content", "isSortable", "key", "shouldTruncate", "testId", "width"];
22
+ _excluded2 = ["ascendingSortTooltip", "buttonAriaRoleDescription", "colSpan", "content", "descendingSortTooltip", "isSortable", "key", "shouldTruncate", "testId", "width"];
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
- return _callSuper(this, TableHead, arguments);
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
  }
@@ -66,14 +74,30 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
66
74
  isRanking: isRanking,
67
75
  testId: testId && "".concat(testId, "--head")
68
76
  }), /*#__PURE__*/_react.default.createElement("tr", null, cells.map(function (cell, index) {
69
- var colSpan = cell.colSpan,
77
+ var ascendingSortTooltip = cell.ascendingSortTooltip,
78
+ buttonAriaRoleDescription = cell.buttonAriaRoleDescription,
79
+ colSpan = cell.colSpan,
70
80
  content = cell.content,
81
+ descendingSortTooltip = cell.descendingSortTooltip,
71
82
  isSortable = cell.isSortable,
72
83
  key = cell.key,
73
84
  shouldTruncate = cell.shouldTruncate,
74
85
  cellTestId = cell.testId,
75
86
  width = cell.width,
76
87
  restCellProps = (0, _objectWithoutProperties2.default)(cell, _excluded2);
88
+ var headCellId = "head-cell-".concat(index);
89
+ var handleClick = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? function () {
90
+ _this2.setState({
91
+ activeSortButtonId: headCellId
92
+ });
93
+ if (isSortable) {
94
+ onSort(cell)();
95
+ }
96
+ } : function () {
97
+ if (isSortable) {
98
+ onSort(cell)();
99
+ }
100
+ };
77
101
  return /*#__PURE__*/_react.default.createElement(HeadCellComponent, (0, _extends2.default)({
78
102
  colSpan: colSpan,
79
103
  content: content,
@@ -81,11 +105,16 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
81
105
  isSortable: !!isSortable,
82
106
  isRanking: isRanking,
83
107
  key: key || index,
84
- onClick: isSortable ? onSort(cell) : undefined,
108
+ headCellId: headCellId,
109
+ activeSortButtonId: activeSortButtonId,
110
+ onClick: handleClick,
85
111
  testId: cellTestId || testId,
86
112
  shouldTruncate: shouldTruncate,
87
113
  sortOrder: key === sortKey ? sortOrder : undefined,
88
- width: width
114
+ width: width,
115
+ ascendingSortTooltip: ascendingSortTooltip,
116
+ descendingSortTooltip: descendingSortTooltip,
117
+ buttonAriaRoleDescription: buttonAriaRoleDescription
89
118
  }, restCellProps));
90
119
  })));
91
120
  }
@@ -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',
@@ -72,7 +88,9 @@ var baseStyles = (0, _react2.css)({
72
88
  border: 'none',
73
89
  color: 'inherit',
74
90
  cursor: 'inherit',
91
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
75
92
  fontSize: 'inherit',
93
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
76
94
  fontWeight: 'inherit',
77
95
  '&::before, &::after': {
78
96
  display: 'block',
@@ -175,6 +193,7 @@ var HeadCell = exports.HeadCell = /*#__PURE__*/(0, _react.forwardRef)(function (
175
193
  // If there is no content in the cell, it should be rendered as an empty `td`, not a `th`.
176
194
  // https://dequeuniversity.com/rules/axe/4.7/empty-table-header
177
195
  var Component = children ? 'th' : 'td';
196
+ var isVisuallyRefreshed = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh');
178
197
  return (0, _react2.jsx)(Component, (0, _extends2.default)({
179
198
  "aria-sort": getFormattedSortOrder()
180
199
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
@@ -182,14 +201,14 @@ var HeadCell = exports.HeadCell = /*#__PURE__*/(0, _react.forwardRef)(function (
182
201
  style: mergedStyles,
183
202
  css: [
184
203
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
185
- _constants2.cellStyles, headCellBaseStyles, onClick && onClickStyles,
204
+ _constants2.cellStyles, isVisuallyRefreshed ? headCellBaseStyles : headCellBaseStylesOld, !isVisuallyRefreshed && onClick && onClickStyles,
186
205
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
187
206
  _constants2.truncationWidthStyles,
188
207
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
189
208
  isFixedSize && shouldTruncate && _constants2.fixedSizeTruncateStyles,
190
209
  // 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,
210
+ isFixedSize && _constants2.overflowTruncateStyles, !isVisuallyRefreshed && isSortable && baseStyles, !isVisuallyRefreshed && isASC && ascendingStyles, !isVisuallyRefreshed && isDESC && descendingStyles],
211
+ onClick: !isVisuallyRefreshed ? onClick : undefined,
193
212
  ref: ref,
194
213
  "data-testid": testId
195
214
  }, rest), children);
@@ -60,14 +60,14 @@ const DynamicTable = ({
60
60
  action: 'sorted',
61
61
  componentName: 'dynamicTable',
62
62
  packageName: "@atlaskit/dynamic-table",
63
- packageVersion: "16.1.4"
63
+ packageVersion: "17.0.1"
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: "16.1.4"
70
+ packageVersion: "17.0.1"
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.35.0 */
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
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: "_1yt41b66 _1e0c1txw _tzy4idpf _bfhk18uv _1h7hkb7n",
16
+ buttonVisibleWrapper: "_1yt41b66 _1e0c1txw _tzy4kb7n _bfhk18uv"
17
+ };
18
+ const headCellStyles = {
19
+ headCellContainer: "_1e0c1txw _4cvr1h6o"
20
+ };
4
21
  const TableHeadCell = ({
5
22
  content,
6
23
  inlineStyles,
@@ -8,9 +25,58 @@ const TableHeadCell = ({
8
25
  isRanking,
9
26
  innerRef,
10
27
  isSortable,
28
+ sortOrder,
11
29
  onClick,
30
+ headCellId,
31
+ activeSortButtonId,
32
+ ascendingSortTooltip = 'Sort ascending',
33
+ descendingSortTooltip = 'Sort descending',
34
+ buttonAriaRoleDescription = 'Sort button',
12
35
  ...rest
13
36
  }) => {
37
+ const [isHovered, setIsHovered] = fg('platform-component-visual-refresh') ?
38
+ // eslint-disable-next-line react-hooks/rules-of-hooks
39
+ useState(false) : [undefined, undefined];
40
+ const isSortButtonVisible = fg('platform-component-visual-refresh') ? isHovered || headCellId === activeSortButtonId || sortOrder !== undefined : undefined;
41
+ const handleMouseEnter = useCallback(() => {
42
+ // Remove check for isHovered when cleaning up platform-component-visual-refresh
43
+ if (isHovered !== undefined && fg('platform-component-visual-refresh')) {
44
+ setIsHovered(true);
45
+ }
46
+ }, [isHovered, setIsHovered]);
47
+ const handleMouseLeave = useCallback(() => {
48
+ // Remove check for isHovered when cleaning up platform-component-visual-refresh
49
+ if (isHovered !== undefined && fg('platform-component-visual-refresh')) {
50
+ setIsHovered(false);
51
+ }
52
+ }, [isHovered, setIsHovered]);
53
+ const visuallyRefreshedButton = fg('platform-component-visual-refresh') ? /*#__PURE__*/React.createElement(Box, {
54
+ xcss: headCellStyles.headCellContainer,
55
+ onMouseEnter: handleMouseEnter,
56
+ onMouseLeave: handleMouseLeave
57
+ }, /*#__PURE__*/React.createElement(Text, {
58
+ size: "small",
59
+ color: "color.text.subtle",
60
+ weight: "bold",
61
+ maxLines: 1
62
+ }, content), /*#__PURE__*/React.createElement(Flex, {
63
+ xcss: styles.buttonWrapper
64
+ }, /*#__PURE__*/React.createElement(Tooltip, {
65
+ content: sortOrder === ASC ? ascendingSortTooltip : descendingSortTooltip
66
+ }, /*#__PURE__*/React.createElement(Pressable, {
67
+ onClick: onClick,
68
+ xcss: isSortButtonVisible ? styles.buttonVisibleWrapper : styles.buttonHiddenWrapper,
69
+ "aria-roledescription": buttonAriaRoleDescription
70
+ }, sortOrder === ASC ? /*#__PURE__*/React.createElement(ArrowUpIcon, {
71
+ label: "",
72
+ color: "var(--ds-text-subtle, #44546F)"
73
+ }) : /*#__PURE__*/React.createElement(ArrowDownIcon, {
74
+ label: "",
75
+ color: "var(--ds-text-subtle, #44546F)"
76
+ }))))) : /*#__PURE__*/React.createElement("button", {
77
+ type: "button",
78
+ "aria-roledescription": "Sort button"
79
+ }, content);
14
80
  return /*#__PURE__*/React.createElement(HeadCell
15
81
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
16
82
  , _extends({
@@ -19,12 +85,10 @@ const TableHeadCell = ({
19
85
  ref: typeof innerRef !== 'string' ? innerRef : null // string refs must be discarded as LegacyRefs are not compatible with FC forwardRefs
20
86
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
21
87
  }, rest, {
22
- onClick: onClick,
23
- isSortable: isSortable
24
- }), isSortable ? /*#__PURE__*/React.createElement("button", {
25
- type: "button",
26
- "aria-roledescription": "Sort button"
27
- }, content) : content);
88
+ onClick: fg('platform-component-visual-refresh') ? undefined : onClick,
89
+ isSortable: isSortable,
90
+ sortOrder: sortOrder
91
+ }), isSortable ? visuallyRefreshedButton : content);
28
92
  };
29
93
 
30
94
  // 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
  }
@@ -42,8 +52,11 @@ class TableHead extends React.Component {
42
52
  testId: testId && `${testId}--head`
43
53
  }), /*#__PURE__*/React.createElement("tr", null, cells.map((cell, index) => {
44
54
  const {
55
+ ascendingSortTooltip,
56
+ buttonAriaRoleDescription,
45
57
  colSpan,
46
58
  content,
59
+ descendingSortTooltip,
47
60
  isSortable,
48
61
  key,
49
62
  shouldTruncate,
@@ -53,6 +66,19 @@ class TableHead extends React.Component {
53
66
  // the API.
54
67
  ...restCellProps
55
68
  } = cell;
69
+ const headCellId = `head-cell-${index}`;
70
+ const handleClick = fg('platform-component-visual-refresh') ? () => {
71
+ this.setState({
72
+ activeSortButtonId: headCellId
73
+ });
74
+ if (isSortable) {
75
+ onSort(cell)();
76
+ }
77
+ } : () => {
78
+ if (isSortable) {
79
+ onSort(cell)();
80
+ }
81
+ };
56
82
  return /*#__PURE__*/React.createElement(HeadCellComponent, _extends({
57
83
  colSpan: colSpan,
58
84
  content: content,
@@ -60,11 +86,16 @@ class TableHead extends React.Component {
60
86
  isSortable: !!isSortable,
61
87
  isRanking: isRanking,
62
88
  key: key || index,
63
- onClick: isSortable ? onSort(cell) : undefined,
89
+ headCellId: headCellId,
90
+ activeSortButtonId: activeSortButtonId,
91
+ onClick: handleClick,
64
92
  testId: cellTestId || testId,
65
93
  shouldTruncate: shouldTruncate,
66
94
  sortOrder: key === sortKey ? sortOrder : undefined,
67
- width: width
95
+ width: width,
96
+ ascendingSortTooltip: ascendingSortTooltip,
97
+ descendingSortTooltip: descendingSortTooltip,
98
+ buttonAriaRoleDescription: buttonAriaRoleDescription
68
99
  }, restCellProps));
69
100
  })));
70
101
  }
@@ -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',
@@ -61,7 +77,9 @@ const baseStyles = css({
61
77
  border: 'none',
62
78
  color: 'inherit',
63
79
  cursor: 'inherit',
80
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
64
81
  fontSize: 'inherit',
82
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
65
83
  fontWeight: 'inherit',
66
84
  '&::before, &::after': {
67
85
  display: 'block',
@@ -169,6 +187,7 @@ export const HeadCell = /*#__PURE__*/forwardRef(({
169
187
  // If there is no content in the cell, it should be rendered as an empty `td`, not a `th`.
170
188
  // https://dequeuniversity.com/rules/axe/4.7/empty-table-header
171
189
  const Component = children ? 'th' : 'td';
190
+ const isVisuallyRefreshed = fg('platform-component-visual-refresh');
172
191
  return jsx(Component, _extends({
173
192
  "aria-sort": getFormattedSortOrder()
174
193
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
@@ -176,14 +195,14 @@ export const HeadCell = /*#__PURE__*/forwardRef(({
176
195
  style: mergedStyles,
177
196
  css: [
178
197
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
179
- cellStyles, headCellBaseStyles, onClick && onClickStyles,
198
+ cellStyles, isVisuallyRefreshed ? headCellBaseStyles : headCellBaseStylesOld, !isVisuallyRefreshed && onClick && onClickStyles,
180
199
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
181
200
  truncationWidthStyles,
182
201
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
183
202
  isFixedSize && shouldTruncate && fixedSizeTruncateStyles,
184
203
  // 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,
204
+ isFixedSize && overflowTruncateStyles, !isVisuallyRefreshed && isSortable && baseStyles, !isVisuallyRefreshed && isASC && ascendingStyles, !isVisuallyRefreshed && isDESC && descendingStyles],
205
+ onClick: !isVisuallyRefreshed ? onClick : undefined,
187
206
  ref: ref,
188
207
  "data-testid": testId
189
208
  }, 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: "16.1.4"
79
+ packageVersion: "17.0.1"
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: "16.1.4"
86
+ packageVersion: "17.0.1"
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.35.0 */
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 React from 'react';
5
+ var _excluded = ["content", "inlineStyles", "testId", "isRanking", "innerRef", "isSortable", "sortOrder", "onClick", "headCellId", "activeSortButtonId", "ascendingSortTooltip", "descendingSortTooltip", "buttonAriaRoleDescription"];
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: "_1yt41b66 _1e0c1txw _tzy4idpf _bfhk18uv _1h7hkb7n",
19
+ buttonVisibleWrapper: "_1yt41b66 _1e0c1txw _tzy4kb7n _bfhk18uv"
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,63 @@ 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,
35
+ _ref$ascendingSortToo = _ref.ascendingSortTooltip,
36
+ ascendingSortTooltip = _ref$ascendingSortToo === void 0 ? 'Sort ascending' : _ref$ascendingSortToo,
37
+ _ref$descendingSortTo = _ref.descendingSortTooltip,
38
+ descendingSortTooltip = _ref$descendingSortTo === void 0 ? 'Sort descending' : _ref$descendingSortTo,
39
+ _ref$buttonAriaRoleDe = _ref.buttonAriaRoleDescription,
40
+ buttonAriaRoleDescription = _ref$buttonAriaRoleDe === void 0 ? 'Sort button' : _ref$buttonAriaRoleDe,
14
41
  rest = _objectWithoutProperties(_ref, _excluded);
42
+ var _ref2 = fg('platform-component-visual-refresh') ?
43
+ // eslint-disable-next-line react-hooks/rules-of-hooks
44
+ useState(false) : [undefined, undefined],
45
+ _ref3 = _slicedToArray(_ref2, 2),
46
+ isHovered = _ref3[0],
47
+ setIsHovered = _ref3[1];
48
+ var isSortButtonVisible = fg('platform-component-visual-refresh') ? isHovered || headCellId === activeSortButtonId || sortOrder !== undefined : undefined;
49
+ var handleMouseEnter = 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(true);
53
+ }
54
+ }, [isHovered, setIsHovered]);
55
+ var handleMouseLeave = useCallback(function () {
56
+ // Remove check for isHovered when cleaning up platform-component-visual-refresh
57
+ if (isHovered !== undefined && fg('platform-component-visual-refresh')) {
58
+ setIsHovered(false);
59
+ }
60
+ }, [isHovered, setIsHovered]);
61
+ var visuallyRefreshedButton = fg('platform-component-visual-refresh') ? /*#__PURE__*/React.createElement(Box, {
62
+ xcss: headCellStyles.headCellContainer,
63
+ onMouseEnter: handleMouseEnter,
64
+ onMouseLeave: handleMouseLeave
65
+ }, /*#__PURE__*/React.createElement(Text, {
66
+ size: "small",
67
+ color: "color.text.subtle",
68
+ weight: "bold",
69
+ maxLines: 1
70
+ }, content), /*#__PURE__*/React.createElement(Flex, {
71
+ xcss: styles.buttonWrapper
72
+ }, /*#__PURE__*/React.createElement(Tooltip, {
73
+ content: sortOrder === ASC ? ascendingSortTooltip : descendingSortTooltip
74
+ }, /*#__PURE__*/React.createElement(Pressable, {
75
+ onClick: onClick,
76
+ xcss: isSortButtonVisible ? styles.buttonVisibleWrapper : styles.buttonHiddenWrapper,
77
+ "aria-roledescription": buttonAriaRoleDescription
78
+ }, sortOrder === ASC ? /*#__PURE__*/React.createElement(ArrowUpIcon, {
79
+ label: "",
80
+ color: "var(--ds-text-subtle, #44546F)"
81
+ }) : /*#__PURE__*/React.createElement(ArrowDownIcon, {
82
+ label: "",
83
+ color: "var(--ds-text-subtle, #44546F)"
84
+ }))))) : /*#__PURE__*/React.createElement("button", {
85
+ type: "button",
86
+ "aria-roledescription": "Sort button"
87
+ }, content);
15
88
  return /*#__PURE__*/React.createElement(HeadCell
16
89
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
17
90
  , _extends({
@@ -20,12 +93,10 @@ var TableHeadCell = function TableHeadCell(_ref) {
20
93
  ref: typeof innerRef !== 'string' ? innerRef : null // string refs must be discarded as LegacyRefs are not compatible with FC forwardRefs
21
94
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
22
95
  }, rest, {
23
- onClick: onClick,
24
- isSortable: isSortable
25
- }), isSortable ? /*#__PURE__*/React.createElement("button", {
26
- type: "button",
27
- "aria-roledescription": "Sort button"
28
- }, content) : content);
96
+ onClick: fg('platform-component-visual-refresh') ? undefined : onClick,
97
+ isSortable: isSortable,
98
+ sortOrder: sortOrder
99
+ }), isSortable ? visuallyRefreshedButton : content);
29
100
  };
30
101
 
31
102
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
@@ -6,18 +6,24 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _inherits from "@babel/runtime/helpers/inherits";
8
8
  var _excluded = ["cells"],
9
- _excluded2 = ["colSpan", "content", "isSortable", "key", "shouldTruncate", "testId", "width"];
9
+ _excluded2 = ["ascendingSortTooltip", "buttonAriaRoleDescription", "colSpan", "content", "descendingSortTooltip", "isSortable", "key", "shouldTruncate", "testId", "width"];
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
- return _callSuper(this, TableHead, arguments);
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
  }
@@ -59,14 +67,30 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
59
67
  isRanking: isRanking,
60
68
  testId: testId && "".concat(testId, "--head")
61
69
  }), /*#__PURE__*/React.createElement("tr", null, cells.map(function (cell, index) {
62
- var colSpan = cell.colSpan,
70
+ var ascendingSortTooltip = cell.ascendingSortTooltip,
71
+ buttonAriaRoleDescription = cell.buttonAriaRoleDescription,
72
+ colSpan = cell.colSpan,
63
73
  content = cell.content,
74
+ descendingSortTooltip = cell.descendingSortTooltip,
64
75
  isSortable = cell.isSortable,
65
76
  key = cell.key,
66
77
  shouldTruncate = cell.shouldTruncate,
67
78
  cellTestId = cell.testId,
68
79
  width = cell.width,
69
80
  restCellProps = _objectWithoutProperties(cell, _excluded2);
81
+ var headCellId = "head-cell-".concat(index);
82
+ var handleClick = fg('platform-component-visual-refresh') ? function () {
83
+ _this2.setState({
84
+ activeSortButtonId: headCellId
85
+ });
86
+ if (isSortable) {
87
+ onSort(cell)();
88
+ }
89
+ } : function () {
90
+ if (isSortable) {
91
+ onSort(cell)();
92
+ }
93
+ };
70
94
  return /*#__PURE__*/React.createElement(HeadCellComponent, _extends({
71
95
  colSpan: colSpan,
72
96
  content: content,
@@ -74,11 +98,16 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
74
98
  isSortable: !!isSortable,
75
99
  isRanking: isRanking,
76
100
  key: key || index,
77
- onClick: isSortable ? onSort(cell) : undefined,
101
+ headCellId: headCellId,
102
+ activeSortButtonId: activeSortButtonId,
103
+ onClick: handleClick,
78
104
  testId: cellTestId || testId,
79
105
  shouldTruncate: shouldTruncate,
80
106
  sortOrder: key === sortKey ? sortOrder : undefined,
81
- width: width
107
+ width: width,
108
+ ascendingSortTooltip: ascendingSortTooltip,
109
+ descendingSortTooltip: descendingSortTooltip,
110
+ buttonAriaRoleDescription: buttonAriaRoleDescription
82
111
  }, restCellProps));
83
112
  })));
84
113
  }
@@ -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',
@@ -66,7 +82,9 @@ var baseStyles = css({
66
82
  border: 'none',
67
83
  color: 'inherit',
68
84
  cursor: 'inherit',
85
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
69
86
  fontSize: 'inherit',
87
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
70
88
  fontWeight: 'inherit',
71
89
  '&::before, &::after': {
72
90
  display: 'block',
@@ -169,6 +187,7 @@ export var HeadCell = /*#__PURE__*/forwardRef(function (_ref2, ref) {
169
187
  // If there is no content in the cell, it should be rendered as an empty `td`, not a `th`.
170
188
  // https://dequeuniversity.com/rules/axe/4.7/empty-table-header
171
189
  var Component = children ? 'th' : 'td';
190
+ var isVisuallyRefreshed = fg('platform-component-visual-refresh');
172
191
  return jsx(Component, _extends({
173
192
  "aria-sort": getFormattedSortOrder()
174
193
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
@@ -176,14 +195,14 @@ export var HeadCell = /*#__PURE__*/forwardRef(function (_ref2, ref) {
176
195
  style: mergedStyles,
177
196
  css: [
178
197
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
179
- cellStyles, headCellBaseStyles, onClick && onClickStyles,
198
+ cellStyles, isVisuallyRefreshed ? headCellBaseStyles : headCellBaseStylesOld, !isVisuallyRefreshed && onClick && onClickStyles,
180
199
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
181
200
  truncationWidthStyles,
182
201
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
183
202
  isFixedSize && shouldTruncate && fixedSizeTruncateStyles,
184
203
  // 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,
204
+ isFixedSize && overflowTruncateStyles, !isVisuallyRefreshed && isSortable && baseStyles, !isVisuallyRefreshed && isASC && ascendingStyles, !isVisuallyRefreshed && isDESC && descendingStyles],
205
+ onClick: !isVisuallyRefreshed ? onClick : undefined,
187
206
  ref: ref,
188
207
  "data-testid": testId
189
208
  }, rest), children);
@@ -14,6 +14,11 @@ export interface TableHeadCellProps {
14
14
  testId?: string;
15
15
  width?: number;
16
16
  isRanking?: boolean;
17
+ headCellId: string;
18
+ activeSortButtonId?: string | null;
19
+ ascendingSortTooltip?: string;
20
+ descendingSortTooltip?: string;
21
+ buttonAriaRoleDescription?: string;
17
22
  }
18
23
  declare const TableHeadCell: FC<TableHeadCellProps>;
19
24
  export default TableHeadCell;
@@ -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;
@@ -338,6 +338,21 @@ export interface HeadCellType extends RowCellType {
338
338
  * Whether the text in the cell will truncate or not if constrained. Avoid truncating content wherever possible.
339
339
  */
340
340
  shouldTruncate?: boolean;
341
+ /**
342
+ * Accessible tooltip applied to the ascending sort button.
343
+ * Defaults to "Sort ascending".
344
+ */
345
+ ascendingSortTooltip?: string;
346
+ /**
347
+ * Accessible tooltip applied to the descending sort button.
348
+ * Defaults to "Sort descending".
349
+ */
350
+ descendingSortTooltip?: string;
351
+ /**
352
+ * Accessible aria role description applied to the sort button.
353
+ * Defaults to "Sort button".
354
+ */
355
+ buttonAriaRoleDescription?: string;
341
356
  }
342
357
  export interface RankEndLocation {
343
358
  index: number;
@@ -14,6 +14,11 @@ export interface TableHeadCellProps {
14
14
  testId?: string;
15
15
  width?: number;
16
16
  isRanking?: boolean;
17
+ headCellId: string;
18
+ activeSortButtonId?: string | null;
19
+ ascendingSortTooltip?: string;
20
+ descendingSortTooltip?: string;
21
+ buttonAriaRoleDescription?: string;
17
22
  }
18
23
  declare const TableHeadCell: FC<TableHeadCellProps>;
19
24
  export default TableHeadCell;
@@ -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;
@@ -338,6 +338,21 @@ export interface HeadCellType extends RowCellType {
338
338
  * Whether the text in the cell will truncate or not if constrained. Avoid truncating content wherever possible.
339
339
  */
340
340
  shouldTruncate?: boolean;
341
+ /**
342
+ * Accessible tooltip applied to the ascending sort button.
343
+ * Defaults to "Sort ascending".
344
+ */
345
+ ascendingSortTooltip?: string;
346
+ /**
347
+ * Accessible tooltip applied to the descending sort button.
348
+ * Defaults to "Sort descending".
349
+ */
350
+ descendingSortTooltip?: string;
351
+ /**
352
+ * Accessible aria role description applied to the sort button.
353
+ * Defaults to "Sort button".
354
+ */
355
+ buttonAriaRoleDescription?: string;
341
356
  }
342
357
  export interface RankEndLocation {
343
358
  index: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dynamic-table",
3
- "version": "16.1.4",
3
+ "version": "17.0.1",
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/"
@@ -46,7 +46,7 @@
46
46
  "@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-migration": "^1.3.0",
47
47
  "@atlaskit/spinner": "^16.3.0",
48
48
  "@atlaskit/theme": "^14.0.0",
49
- "@atlaskit/tokens": "^2.4.0",
49
+ "@atlaskit/tokens": "^2.5.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1",
52
52
  "react-beautiful-dnd": "^12.2.0"
@@ -62,7 +62,7 @@
62
62
  "@atlaskit/button": "*",
63
63
  "@atlaskit/link": "*",
64
64
  "@atlaskit/ssr": "*",
65
- "@atlaskit/toggle": "^13.4.0",
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
  }