@atlaskit/renderer 108.15.13 → 108.15.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/i18n/da.js +6 -1
  3. package/dist/cjs/i18n/de.js +6 -1
  4. package/dist/cjs/i18n/es.js +6 -1
  5. package/dist/cjs/i18n/fr.js +6 -1
  6. package/dist/cjs/i18n/hu.js +6 -1
  7. package/dist/cjs/i18n/it.js +6 -1
  8. package/dist/cjs/i18n/ko.js +6 -1
  9. package/dist/cjs/i18n/nb.js +6 -1
  10. package/dist/cjs/i18n/nl.js +6 -1
  11. package/dist/cjs/i18n/pl.js +6 -1
  12. package/dist/cjs/i18n/sv.js +6 -1
  13. package/dist/cjs/i18n/th.js +6 -1
  14. package/dist/cjs/i18n/tr.js +6 -1
  15. package/dist/cjs/i18n/uk.js +1 -1
  16. package/dist/cjs/i18n/vi.js +6 -1
  17. package/dist/cjs/i18n/zh.js +6 -1
  18. package/dist/cjs/i18n/zh_TW.js +6 -1
  19. package/dist/cjs/react/marks/textColor.js +64 -1
  20. package/dist/cjs/react/nodes/tableCell.js +175 -133
  21. package/dist/cjs/ui/Renderer/index.js +1 -1
  22. package/dist/cjs/ui/Renderer/style.js +1 -1
  23. package/dist/es2019/i18n/da.js +6 -1
  24. package/dist/es2019/i18n/de.js +6 -1
  25. package/dist/es2019/i18n/es.js +6 -1
  26. package/dist/es2019/i18n/fr.js +6 -1
  27. package/dist/es2019/i18n/hu.js +6 -1
  28. package/dist/es2019/i18n/it.js +6 -1
  29. package/dist/es2019/i18n/ko.js +6 -1
  30. package/dist/es2019/i18n/nb.js +6 -1
  31. package/dist/es2019/i18n/nl.js +6 -1
  32. package/dist/es2019/i18n/pl.js +6 -1
  33. package/dist/es2019/i18n/sv.js +6 -1
  34. package/dist/es2019/i18n/th.js +6 -1
  35. package/dist/es2019/i18n/tr.js +6 -1
  36. package/dist/es2019/i18n/uk.js +1 -1
  37. package/dist/es2019/i18n/vi.js +6 -1
  38. package/dist/es2019/i18n/zh.js +6 -1
  39. package/dist/es2019/i18n/zh_TW.js +6 -1
  40. package/dist/es2019/react/marks/textColor.js +65 -1
  41. package/dist/es2019/react/nodes/tableCell.js +180 -106
  42. package/dist/es2019/ui/Renderer/index.js +1 -1
  43. package/dist/es2019/ui/Renderer/style.js +2 -2
  44. package/dist/esm/i18n/da.js +6 -1
  45. package/dist/esm/i18n/de.js +6 -1
  46. package/dist/esm/i18n/es.js +6 -1
  47. package/dist/esm/i18n/fr.js +6 -1
  48. package/dist/esm/i18n/hu.js +6 -1
  49. package/dist/esm/i18n/it.js +6 -1
  50. package/dist/esm/i18n/ko.js +6 -1
  51. package/dist/esm/i18n/nb.js +6 -1
  52. package/dist/esm/i18n/nl.js +6 -1
  53. package/dist/esm/i18n/pl.js +6 -1
  54. package/dist/esm/i18n/sv.js +6 -1
  55. package/dist/esm/i18n/th.js +6 -1
  56. package/dist/esm/i18n/tr.js +6 -1
  57. package/dist/esm/i18n/uk.js +1 -1
  58. package/dist/esm/i18n/vi.js +6 -1
  59. package/dist/esm/i18n/zh.js +6 -1
  60. package/dist/esm/i18n/zh_TW.js +6 -1
  61. package/dist/esm/react/marks/textColor.js +64 -1
  62. package/dist/esm/react/nodes/tableCell.js +177 -135
  63. package/dist/esm/ui/Renderer/index.js +1 -1
  64. package/dist/esm/ui/Renderer/style.js +1 -1
  65. package/dist/types/i18n/da.d.ts +5 -0
  66. package/dist/types/i18n/de.d.ts +5 -0
  67. package/dist/types/i18n/es.d.ts +5 -0
  68. package/dist/types/i18n/fr.d.ts +5 -0
  69. package/dist/types/i18n/hu.d.ts +5 -0
  70. package/dist/types/i18n/it.d.ts +5 -0
  71. package/dist/types/i18n/ko.d.ts +5 -0
  72. package/dist/types/i18n/nb.d.ts +5 -0
  73. package/dist/types/i18n/nl.d.ts +5 -0
  74. package/dist/types/i18n/pl.d.ts +5 -0
  75. package/dist/types/i18n/sv.d.ts +5 -0
  76. package/dist/types/i18n/th.d.ts +5 -0
  77. package/dist/types/i18n/tr.d.ts +5 -0
  78. package/dist/types/i18n/vi.d.ts +5 -0
  79. package/dist/types/i18n/zh.d.ts +5 -0
  80. package/dist/types/i18n/zh_TW.d.ts +5 -0
  81. package/dist/types/react/marks/textColor.d.ts +2 -2
  82. package/dist/types/react/nodes/tableCell.d.ts +5 -62
  83. package/dist/types-ts4.5/i18n/da.d.ts +5 -0
  84. package/dist/types-ts4.5/i18n/de.d.ts +5 -0
  85. package/dist/types-ts4.5/i18n/es.d.ts +5 -0
  86. package/dist/types-ts4.5/i18n/fr.d.ts +5 -0
  87. package/dist/types-ts4.5/i18n/hu.d.ts +5 -0
  88. package/dist/types-ts4.5/i18n/it.d.ts +5 -0
  89. package/dist/types-ts4.5/i18n/ko.d.ts +5 -0
  90. package/dist/types-ts4.5/i18n/nb.d.ts +5 -0
  91. package/dist/types-ts4.5/i18n/nl.d.ts +5 -0
  92. package/dist/types-ts4.5/i18n/pl.d.ts +5 -0
  93. package/dist/types-ts4.5/i18n/sv.d.ts +5 -0
  94. package/dist/types-ts4.5/i18n/th.d.ts +5 -0
  95. package/dist/types-ts4.5/i18n/tr.d.ts +5 -0
  96. package/dist/types-ts4.5/i18n/vi.d.ts +5 -0
  97. package/dist/types-ts4.5/i18n/zh.d.ts +5 -0
  98. package/dist/types-ts4.5/i18n/zh_TW.d.ts +5 -0
  99. package/dist/types-ts4.5/react/marks/textColor.d.ts +2 -2
  100. package/dist/types-ts4.5/react/nodes/tableCell.d.ts +5 -62
  101. package/package.json +13 -7
@@ -17,5 +17,10 @@ export default {
17
17
  'fabric.editor.headingLink.failedToCopy': '複製失敗',
18
18
  'fabric.editor.headingLink.invalidLabel': '⚠️ 您無法排序包含合併儲存格的表格',
19
19
  'fabric.editor.headingLink.noOrderLabel': '從 A 欄排序到 Z 欄',
20
- 'fabric.editor.headingLink.noneSortingLabel': '無'
20
+ 'fabric.editor.headingLink.noneSortingLabel': '無',
21
+ 'fabric.editor.tableHeader.sorting.asc': '已套用遞增排序',
22
+ 'fabric.editor.tableHeader.sorting.default': '排序直欄',
23
+ 'fabric.editor.tableHeader.sorting.desc': '已套用遞減排序',
24
+ 'fabric.editor.tableHeader.sorting.invalid': '您無法使用合併的儲存格來排序表格',
25
+ 'fabric.editor.tableHeader.sorting.no': '沒有套用至直欄的排序'
21
26
  };
@@ -1,12 +1,75 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React, { useMemo } from 'react';
4
+ import { isHex, isRgb, rgbToHex } from '@atlaskit/adf-schema';
4
5
  import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
+ import { useThemeObserver } from '@atlaskit/tokens';
8
+ /**
9
+ * This function is duplicated in
10
+ * - @atlaskit/adf-schema
11
+ * - ../nodes/tableCell.tsx
12
+ * it takes a color string, and if the color string is a hex or rgb value
13
+ * it will invert the color and return the inverted color.
14
+ */
15
+ function invertCustomColor(customColor) {
16
+ var hex;
17
+ if (isHex(customColor)) {
18
+ hex = customColor;
19
+ } else if (isRgb(customColor)) {
20
+ hex = rgbToHex(customColor);
21
+ } else {
22
+ return customColor;
23
+ }
24
+ var hexWithoutHash = hex.replace('#', '');
25
+
26
+ // This inverts the hex color by
27
+ // 1. converting the hex code to a number
28
+ // 2. XORing it with 0xffffff
29
+ // 3. Converting the result back to hex
30
+ // 4. Removing the leading 1 from the result
31
+ return "#".concat((Number("0x1".concat(hexWithoutHash)) ^ 0xffffff).toString(16).substring(1).toUpperCase());
32
+ }
5
33
  export default function TextColor(props) {
34
+ var _useThemeObserver = useThemeObserver(),
35
+ colorMode = _useThemeObserver.colorMode;
6
36
  // Note -- while there is no way to create custom colors using default tooling
7
37
  // the editor does supported ad hoc color values -- and there may be content
8
38
  // which has been migrated or created via apis which use such values.
9
- var paletteColorValue = hexToEditorTextPaletteColor(props.color) || props.color;
39
+ var paletteColorValue;
40
+ if (getBooleanFF('platform.editor.dm-invert-text-color_cvho2')) {
41
+ /**
42
+ * The Editor persists custom text colors when content has been migrated from the old editor, or created via
43
+ * apis.
44
+ *
45
+ * This behaviour predates the introduction of dark mode.
46
+ *
47
+ * Without the inversion logic below, text with custom colors, can be hard to read when the user loads the page in dark mode.
48
+ *
49
+ * This introduces inversion of the presentation of the custom text colors when the user is in dark mode.
50
+ *
51
+ * This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
52
+ * how we detect text colors copied from external editor sources. Where we load the background color from a
53
+ * seperate attribute (data-text-custom-color), instead of the inline style.
54
+ *
55
+ * See the following document for more details on this behaviour
56
+ * https://hello.atlassian.net/wiki/spaces/CCECO/pages/2908658046/Unsupported+custom+text+colors+in+dark+theme+Editor+Job+Story
57
+ */
58
+ var tokenColor = hexToEditorTextPaletteColor(props.color);
59
+ if (tokenColor) {
60
+ paletteColorValue = hexToEditorTextPaletteColor(props.color) || props.color;
61
+ } else {
62
+ if (colorMode === 'dark') {
63
+ // if we have a custom color, we need to check if we are in dark mode
64
+ paletteColorValue = invertCustomColor(props.color);
65
+ } else {
66
+ // if we are in light mode, we can just set the color
67
+ paletteColorValue = props.color;
68
+ }
69
+ }
70
+ } else {
71
+ paletteColorValue = hexToEditorTextPaletteColor(props.color) || props.color;
72
+ }
10
73
  var style = useMemo(function () {
11
74
  return _defineProperty({}, '--custom-palette-color', paletteColorValue);
12
75
  }, [paletteColorValue]);
@@ -1,23 +1,15 @@
1
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
1
  import _extends from "@babel/runtime/helpers/extends";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
2
  import React from 'react';
12
- import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
13
- import { compose } from '@atlaskit/editor-common/utils';
3
+ import { isHex, isRgb, rgbToHex, tableBackgroundColorPalette } from '@atlaskit/adf-schema';
4
+ import { useThemeObserver } from '@atlaskit/tokens';
14
5
  import { SortOrder } from '@atlaskit/editor-common/types';
15
6
  import { hexToEditorBackgroundPaletteRawValue } from '@atlaskit/editor-palette';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
16
8
  import SortingIcon from '../../ui/SortingIcon';
17
9
  import { MODE, PLATFORM } from '../../analytics/events';
18
10
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
19
11
  import { RendererCssClassName } from '../../consts';
20
- import { injectIntl } from 'react-intl-next';
12
+ import { useIntl } from 'react-intl-next';
21
13
  import { tableCellMessages } from '../../messages';
22
14
  var IgnoreSorting = ['LABEL', 'INPUT'];
23
15
  var nextStatusOrder = function nextStatusOrder(currentSortOrder) {
@@ -70,13 +62,76 @@ var getDataAttributes = function getDataAttributes(colwidth, background) {
70
62
  }
71
63
  return attrs;
72
64
  };
73
- var getStyle = function getStyle(background, colGroupWidth, offsetTop) {
65
+
66
+ /**
67
+ * This function is duplicated in
68
+ * - @atlaskit/adf-schema
69
+ * - ../marks/textColor.tsx
70
+ * it takes a color string, and if the color string is a hex or rgb value
71
+ * it will invert the color and return the inverted color.
72
+ */
73
+ function invertCustomColor(customColor) {
74
+ var hex;
75
+ if (isHex(customColor)) {
76
+ hex = customColor;
77
+ } else if (isRgb(customColor)) {
78
+ hex = rgbToHex(customColor);
79
+ } else {
80
+ return customColor;
81
+ }
82
+ var hexWithoutHash = hex.replace('#', '');
83
+
84
+ // This inverts the hex color by
85
+ // 1. converting the hex code to a number
86
+ // 2. XORing it with 0xffffff
87
+ // 3. Converting the result back to hex
88
+ // 4. Removing the leading 1 from the result
89
+ return "#".concat((Number("0x1".concat(hexWithoutHash)) ^ 0xffffff).toString(16).substring(1).toUpperCase());
90
+ }
91
+ var getStyle = function getStyle(_ref) {
92
+ var background = _ref.background,
93
+ colGroupWidth = _ref.colGroupWidth,
94
+ offsetTop = _ref.offsetTop,
95
+ colorMode = _ref.colorMode;
74
96
  var style = {};
75
97
  if (background &&
76
98
  // ignore setting inline styles if ds neutral token is detected
77
99
  !background.includes('--ds-background-neutral')) {
78
- var tokenColor = hexToEditorBackgroundPaletteRawValue(background) || background;
79
- style.backgroundColor = tokenColor;
100
+ if (getBooleanFF('platform.editor.dm-invert-tablecell-bgcolor_9fz6s')) {
101
+ /**
102
+ * The Editor supports users pasting content from external sources with custom table cell backgrounds and having those
103
+ * backgrounds persisted.
104
+ *
105
+ * This feature predates the introduction of dark mode.
106
+ *
107
+ * Without the inversion logic below, tokenised content (ie. text), can be hard to read when the user loads the page in dark mode.
108
+ *
109
+ * This introduces inversion of the presentation of the custom background color when the user is in dark mode.
110
+ *
111
+ * This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
112
+ * how we detect table cell background colors copied from external editor sources. Where we load the background color from a
113
+ * seperate attribute (data-cell-background), instead of the inline style.
114
+ *
115
+ * See the following document for more details on this behaviour
116
+ * https://hello.atlassian.net/wiki/spaces/CCECO/pages/2892247168/Unsupported+custom+table+cell+background+colors+in+dark+theme+Editor+Job+Story
117
+ */
118
+ var tokenColor = hexToEditorBackgroundPaletteRawValue(background);
119
+ if (tokenColor) {
120
+ style.backgroundColor = tokenColor;
121
+ } else {
122
+ // if we have a custom color, we need to check if we are in dark mode
123
+ if (colorMode === 'dark') {
124
+ // if we are in dark mode, we need to invert the color
125
+ style.backgroundColor = invertCustomColor(background);
126
+ } else {
127
+ // if we are in light mode, we can just set the color
128
+ style.backgroundColor = background;
129
+ }
130
+ }
131
+ } else {
132
+ var _tokenColor = hexToEditorBackgroundPaletteRawValue(background) || background;
133
+ style.backgroundColor = _tokenColor;
134
+ }
80
135
  }
81
136
  if (colGroupWidth) {
82
137
  style.width = colGroupWidth;
@@ -87,128 +142,115 @@ var getStyle = function getStyle(background, colGroupWidth, offsetTop) {
87
142
  }
88
143
  return style;
89
144
  };
90
- var withCellProps = function withCellProps(WrapperComponent) {
91
- return /*#__PURE__*/function (_React$Component) {
92
- _inherits(WithCellProps, _React$Component);
93
- var _super = _createSuper(WithCellProps);
94
- function WithCellProps() {
95
- _classCallCheck(this, WithCellProps);
96
- return _super.apply(this, arguments);
97
- }
98
- _createClass(WithCellProps, [{
99
- key: "render",
100
- value: function render() {
101
- var _this$props = this.props,
102
- children = _this$props.children,
103
- className = _this$props.className,
104
- onClick = _this$props.onClick,
105
- colwidth = _this$props.colwidth,
106
- colGroupWidth = _this$props.colGroupWidth,
107
- rowspan = _this$props.rowspan,
108
- colspan = _this$props.colspan,
109
- background = _this$props.background,
110
- offsetTop = _this$props.offsetTop,
111
- ariaSort = _this$props.ariaSort;
112
- var colorName = background ? tableBackgroundColorPalette.get(background) : '';
113
- return /*#__PURE__*/React.createElement(WrapperComponent, _extends({
114
- rowSpan: rowspan,
115
- colSpan: colspan,
116
- style: getStyle(background, colGroupWidth, offsetTop),
117
- colorname: colorName,
118
- onClick: onClick,
119
- className: className
120
- }, getDataAttributes(colwidth, background), {
121
- "aria-sort": ariaSort
122
- }), children);
123
- }
124
- }]);
125
- return WithCellProps;
126
- }(React.Component);
145
+ var getWithCellProps = function getWithCellProps(WrapperComponent) {
146
+ return function WithCellProps(props) {
147
+ var _useThemeObserver = useThemeObserver(),
148
+ colorMode = _useThemeObserver.colorMode;
149
+ var children = props.children,
150
+ className = props.className,
151
+ onClick = props.onClick,
152
+ colwidth = props.colwidth,
153
+ colGroupWidth = props.colGroupWidth,
154
+ rowspan = props.rowspan,
155
+ colspan = props.colspan,
156
+ background = props.background,
157
+ offsetTop = props.offsetTop,
158
+ ariaSort = props.ariaSort;
159
+
160
+ // This is used to set the background color of the cell
161
+ // to a dark mode color in mobile dark mode
162
+ var colorName = background ? tableBackgroundColorPalette.get(background) : '';
163
+ return /*#__PURE__*/React.createElement(WrapperComponent, _extends({
164
+ rowSpan: rowspan,
165
+ colSpan: colspan
166
+ // Note: When content from a renderer is pasted into an editor
167
+ // the background color is not taken from the inline style.
168
+ // Instead it is taken from the data-cell-background attribute
169
+ // (added via getDataAttributes below).
170
+ ,
171
+ style: getStyle({
172
+ background: background,
173
+ colGroupWidth: colGroupWidth,
174
+ offsetTop: offsetTop,
175
+ colorMode: colorMode
176
+ }),
177
+ colorname: colorName,
178
+ onClick: onClick,
179
+ className: className
180
+ }, getDataAttributes(colwidth, background), {
181
+ "aria-sort": ariaSort
182
+ }), children);
183
+ };
127
184
  };
185
+ var TH = getWithCellProps('th');
128
186
  export var withSortableColumn = function withSortableColumn(WrapperComponent) {
129
- var WithSortableColumn = /*#__PURE__*/function (_React$Component2) {
130
- _inherits(WithSortableColumn, _React$Component2);
131
- var _super2 = _createSuper(WithSortableColumn);
132
- function WithSortableColumn(props) {
133
- var _this;
134
- _classCallCheck(this, WithSortableColumn);
135
- _this = _super2.call(this, props);
136
- _defineProperty(_assertThisInitialized(_this), "onKeyPress", function (event) {
137
- var keys = [' ', 'Enter', 'Spacebar'];
138
- var _ref = event.target,
139
- tagName = _ref.tagName;
140
- // trigger sorting if space or enter are clicked but not when in an input field (template variables)
141
- if (keys.includes(event.key) && !IgnoreSorting.includes(tagName)) {
142
- event.preventDefault();
143
- _this.sort();
144
- }
145
- });
146
- _defineProperty(_assertThisInitialized(_this), "sort", function () {
147
- var _this$props2 = _this.props,
148
- fireAnalyticsEvent = _this$props2.fireAnalyticsEvent,
149
- onSorting = _this$props2.onSorting,
150
- columnIndex = _this$props2.columnIndex,
151
- sortOrdered = _this$props2.sortOrdered;
152
- if (onSorting && columnIndex != null) {
153
- var sortOrder = nextStatusOrder(sortOrdered);
154
- onSorting(columnIndex, sortOrder);
155
- fireAnalyticsEvent && fireAnalyticsEvent({
156
- action: ACTION.SORT_COLUMN,
157
- actionSubject: ACTION_SUBJECT.TABLE,
158
- attributes: {
159
- platform: PLATFORM.WEB,
160
- mode: MODE.RENDERER,
161
- columnIndex: columnIndex,
162
- sortOrder: sortOrder
163
- },
164
- eventType: EVENT_TYPE.TRACK
165
- });
166
- } else {
167
- fireAnalyticsEvent && fireAnalyticsEvent({
168
- action: ACTION.SORT_COLUMN_NOT_ALLOWED,
169
- actionSubject: ACTION_SUBJECT.TABLE,
170
- attributes: {
171
- platform: PLATFORM.WEB,
172
- mode: MODE.RENDERER
173
- },
174
- eventType: EVENT_TYPE.TRACK
175
- });
176
- }
177
- });
178
- return _this;
187
+ return function THWithSortableColumn(props) {
188
+ var intl = useIntl();
189
+ var allowColumnSorting = props.allowColumnSorting,
190
+ onSorting = props.onSorting,
191
+ children = props.children,
192
+ sortOrdered = props.sortOrdered,
193
+ isHeaderRow = props.isHeaderRow;
194
+ var sortOrderedClassName = sortOrdered === SortOrder.NO_ORDER ? RendererCssClassName.SORTABLE_COLUMN_NO_ORDER : '';
195
+ if (!allowColumnSorting || !isHeaderRow) {
196
+ return /*#__PURE__*/React.createElement(WrapperComponent, props);
179
197
  }
180
- _createClass(WithSortableColumn, [{
181
- key: "render",
182
- value: function render() {
183
- var _this$props3 = this.props,
184
- allowColumnSorting = _this$props3.allowColumnSorting,
185
- onSorting = _this$props3.onSorting,
186
- children = _this$props3.children,
187
- sortOrdered = _this$props3.sortOrdered,
188
- isHeaderRow = _this$props3.isHeaderRow,
189
- intl = _this$props3.intl;
190
- var sortOrderedClassName = sortOrdered === SortOrder.NO_ORDER ? RendererCssClassName.SORTABLE_COLUMN_NO_ORDER : '';
191
- if (!allowColumnSorting || !isHeaderRow) {
192
- return /*#__PURE__*/React.createElement(WrapperComponent, this.props);
193
- }
194
- return /*#__PURE__*/React.createElement(WrapperComponent, _extends({}, this.props, {
195
- className: RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
196
- ariaSort: getSortOrderLabel(intl, sortOrdered)
197
- }), /*#__PURE__*/React.createElement("div", {
198
- className: RendererCssClassName.SORTABLE_COLUMN
199
- }, children, /*#__PURE__*/React.createElement("figure", {
200
- className: "".concat(RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER, " ").concat(sortOrderedClassName)
201
- }, /*#__PURE__*/React.createElement(SortingIcon, {
202
- isSortingAllowed: !!onSorting,
203
- sortOrdered: sortOrdered,
204
- onClick: this.sort,
205
- onKeyDown: this.onKeyPress
206
- }))));
198
+ return /*#__PURE__*/React.createElement(WrapperComponent, _extends({}, props, {
199
+ className: RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
200
+ ariaSort: getSortOrderLabel(intl, sortOrdered)
201
+ }), /*#__PURE__*/React.createElement("div", {
202
+ className: RendererCssClassName.SORTABLE_COLUMN
203
+ }, children, /*#__PURE__*/React.createElement("figure", {
204
+ className: "".concat(RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER, " ").concat(sortOrderedClassName)
205
+ }, /*#__PURE__*/React.createElement(SortingIcon, {
206
+ isSortingAllowed: !!onSorting,
207
+ sortOrdered: sortOrdered,
208
+ onClick: sort,
209
+ onKeyDown: onKeyPress
210
+ }))));
211
+ function onKeyPress(event) {
212
+ var keys = [' ', 'Enter', 'Spacebar'];
213
+ var _ref2 = event.target,
214
+ tagName = _ref2.tagName;
215
+ // trigger sorting if space or enter are clicked but not when in an input field (template variables)
216
+ if (keys.includes(event.key) && !IgnoreSorting.includes(tagName)) {
217
+ event.preventDefault();
218
+ sort();
207
219
  }
208
- }]);
209
- return WithSortableColumn;
210
- }(React.Component);
211
- return injectIntl(WithSortableColumn);
220
+ }
221
+ function sort() {
222
+ var fireAnalyticsEvent = props.fireAnalyticsEvent,
223
+ onSorting = props.onSorting,
224
+ columnIndex = props.columnIndex,
225
+ sortOrdered = props.sortOrdered;
226
+ if (onSorting && columnIndex != null) {
227
+ var sortOrder = nextStatusOrder(sortOrdered);
228
+ onSorting(columnIndex, sortOrder);
229
+ fireAnalyticsEvent && fireAnalyticsEvent({
230
+ action: ACTION.SORT_COLUMN,
231
+ actionSubject: ACTION_SUBJECT.TABLE,
232
+ attributes: {
233
+ platform: PLATFORM.WEB,
234
+ mode: MODE.RENDERER,
235
+ columnIndex: columnIndex,
236
+ sortOrder: sortOrder
237
+ },
238
+ eventType: EVENT_TYPE.TRACK
239
+ });
240
+ } else {
241
+ fireAnalyticsEvent && fireAnalyticsEvent({
242
+ action: ACTION.SORT_COLUMN_NOT_ALLOWED,
243
+ actionSubject: ACTION_SUBJECT.TABLE,
244
+ attributes: {
245
+ platform: PLATFORM.WEB,
246
+ mode: MODE.RENDERER
247
+ },
248
+ eventType: EVENT_TYPE.TRACK
249
+ });
250
+ }
251
+ }
252
+ };
212
253
  };
213
- export var TableHeader = compose(withSortableColumn, withCellProps)('th');
214
- export var TableCell = withCellProps('td');
254
+ export var TableHeader = withSortableColumn(TH);
255
+ var TD = getWithCellProps('td');
256
+ export var TableCell = TD;
@@ -45,7 +45,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
45
45
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
46
46
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
47
47
  var packageName = "@atlaskit/renderer";
48
- var packageVersion = "108.15.13";
48
+ var packageVersion = "108.15.15";
49
49
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
50
50
  _inherits(Renderer, _PureComponent);
51
51
  var _super = _createSuper(Renderer);
@@ -101,7 +101,7 @@ var fullWidthStyles = function fullWidthStyles(_ref5) {
101
101
  return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n max-width: ", "px;\n margin: 0 auto;\n\n .fabric-editor-breakout-mark,\n .ak-renderer-extension {\n width: 100% !important;\n }\n\n ", "\n "])), akEditorFullWidthLayoutWidth, isTableResizingEnabled(appearance) ? '' : "\n .pm-table-container {\n width: 100% !important;\n }\n ");
102
102
  };
103
103
  var breakoutWidthStyle = function breakoutWidthStyle() {
104
- return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n *:not([data-mark-type='fragment'])\n .", " {\n width: 100% !important;\n left: 0 !important;\n }\n\n [data-mark-type='fragment'] * .", " {\n width: 100% !important;\n left: 0 !important;\n }\n "])), TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_CONTAINER);
104
+ return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n *:not([data-mark-type='fragment'])\n .", " {\n width: 100%;\n left: 0 !important;\n }\n\n [data-mark-type='fragment'] * .", " {\n width: 100%;\n left: 0 !important;\n }\n "])), TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_CONTAINER);
105
105
  };
106
106
  var getShadowOverrides = function getShadowOverrides() {
107
107
  return getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n /** Shadow overrides */\n &.", "::after,\n &.", "::before {\n width: ", "px;\n background: linear-gradient(\n to left,\n transparent 0,\n ", " 140%\n ),\n linear-gradient(\n to right,\n ", " 0px,\n transparent 1px\n );\n }\n\n &.", "::after {\n background: linear-gradient(\n to right,\n transparent 0,\n ", " 140%\n ),\n linear-gradient(\n to left,\n ", " 0px,\n transparent 1px\n );\n left: calc(100% - ", "px);\n }\n "])), shadowClassNames.RIGHT_SHADOW, shadowClassNames.LEFT_SHADOW, tableShadowWidth, "var(--ds-shadow-overflow-spread, ".concat(N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", shadowClassNames.RIGHT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", tableShadowWidth) : '';
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;
@@ -16,5 +16,10 @@ declare const _default: {
16
16
  'fabric.editor.headingLink.invalidLabel': string;
17
17
  'fabric.editor.headingLink.noOrderLabel': string;
18
18
  'fabric.editor.headingLink.noneSortingLabel': string;
19
+ 'fabric.editor.tableHeader.sorting.asc': string;
20
+ 'fabric.editor.tableHeader.sorting.default': string;
21
+ 'fabric.editor.tableHeader.sorting.desc': string;
22
+ 'fabric.editor.tableHeader.sorting.invalid': string;
23
+ 'fabric.editor.tableHeader.sorting.no': string;
19
24
  };
20
25
  export default _default;