@atlaskit/renderer 112.3.0 → 112.3.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,14 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 112.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#159704](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159704)
8
+ [`03e6dc49c3d4f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/03e6dc49c3d4f) -
9
+ Add temporary sticky header configuration options to allow consumer to set the default overflow
10
+ parent
11
+
3
12
  ## 112.3.0
4
13
 
5
14
  ### Minor Changes
@@ -173,7 +173,7 @@ var StickyTable = exports.StickyTable = function StickyTable(_ref) {
173
173
  /**
174
174
  * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
175
175
  */
176
- function findHorizontalOverflowScrollParent(table) {
176
+ function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
177
177
  var parent = table;
178
178
  if (!parent) {
179
179
  return null;
@@ -184,6 +184,11 @@ function findHorizontalOverflowScrollParent(table) {
184
184
  if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
185
185
  return parent;
186
186
  }
187
+ if (!!defaultScrollRootEl && defaultScrollRootEl === parent) {
188
+ // If a defaultScrollRootEl was specified and we reached it without finding a closer scroll parent,
189
+ // use the defaultScrollRootEl.
190
+ return parent;
191
+ }
187
192
  }
188
193
  return null;
189
194
  }
@@ -226,8 +231,8 @@ var OverflowParent = exports.OverflowParent = /*#__PURE__*/function () {
226
231
  }
227
232
  }], [{
228
233
  key: "fromElement",
229
- value: function fromElement(el) {
230
- return new OverflowParent(findHorizontalOverflowScrollParent(el) || window);
234
+ value: function fromElement(el, defaultScrollRootEl) {
235
+ return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootEl) || window);
231
236
  }
232
237
  }]);
233
238
  return OverflowParent;
@@ -253,7 +253,8 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
253
253
  this.resizeObserver.observe(this.stickyHeaderRef.current);
254
254
  }
255
255
  if (this.props.stickyHeaders) {
256
- this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current);
256
+ var _this$props$stickyHea;
257
+ this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRoot_DO_NOT_USE);
257
258
  this.overflowParent.addEventListener('scroll', this.onScroll);
258
259
  }
259
260
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
@@ -265,7 +266,8 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
265
266
  value: function componentDidUpdate(prevProps, prevState) {
266
267
  // toggling sticky headers visiblity
267
268
  if (this.props.stickyHeaders && !this.overflowParent) {
268
- this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current);
269
+ var _this$props$stickyHea2;
270
+ this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRoot_DO_NOT_USE);
269
271
  } else if (!this.props.stickyHeaders && this.overflowParent) {
270
272
  this.overflowParent.removeEventListener('scroll', this.onScroll);
271
273
  this.overflowParent = null;
@@ -296,7 +298,14 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
296
298
  case 'pin-bottom':
297
299
  return this.pinTop;
298
300
  case 'stick':
299
- return this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
301
+ var offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
302
+ if (typeof offsetTop === 'number') {
303
+ var _this$props$stickyHea3, _this$props$stickyHea4;
304
+ var defaultScrollRootOffsetTop = (_this$props$stickyHea3 = (_this$props$stickyHea4 = this.props.stickyHeaders) === null || _this$props$stickyHea4 === void 0 ? void 0 : _this$props$stickyHea4.defaultScrollRootTop_DO_NOT_USE) !== null && _this$props$stickyHea3 !== void 0 ? _this$props$stickyHea3 : 0;
305
+ return offsetTop + defaultScrollRootOffsetTop;
306
+ } else {
307
+ return offsetTop;
308
+ }
300
309
  default:
301
310
  return undefined;
302
311
  }
@@ -65,7 +65,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
65
65
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
66
66
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
67
67
  var packageName = "@atlaskit/renderer";
68
- var packageVersion = "112.3.0";
68
+ var packageVersion = "112.3.1";
69
69
  var setAsQueryContainerStyles = (0, _react2.css)({
70
70
  containerName: 'ak-renderer-wrapper',
71
71
  containerType: 'inline-size',
@@ -174,7 +174,7 @@ export const StickyTable = ({
174
174
  /**
175
175
  * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
176
176
  */
177
- function findHorizontalOverflowScrollParent(table) {
177
+ function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
178
178
  let parent = table;
179
179
  if (!parent) {
180
180
  return null;
@@ -185,6 +185,11 @@ function findHorizontalOverflowScrollParent(table) {
185
185
  if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
186
186
  return parent;
187
187
  }
188
+ if (!!defaultScrollRootEl && defaultScrollRootEl === parent) {
189
+ // If a defaultScrollRootEl was specified and we reached it without finding a closer scroll parent,
190
+ // use the defaultScrollRootEl.
191
+ return parent;
192
+ }
188
193
  }
189
194
  return null;
190
195
  }
@@ -193,8 +198,8 @@ export class OverflowParent {
193
198
  this.ref = ref;
194
199
  this.ref = ref;
195
200
  }
196
- static fromElement(el) {
197
- return new OverflowParent(findHorizontalOverflowScrollParent(el) || window);
201
+ static fromElement(el, defaultScrollRootEl) {
202
+ return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootEl) || window);
198
203
  }
199
204
  get isElement() {
200
205
  return this.ref instanceof HTMLElement;
@@ -204,7 +204,8 @@ export class TableContainer extends React.Component {
204
204
  this.resizeObserver.observe(this.stickyHeaderRef.current);
205
205
  }
206
206
  if (this.props.stickyHeaders) {
207
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current);
207
+ var _this$props$stickyHea;
208
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRoot_DO_NOT_USE);
208
209
  this.overflowParent.addEventListener('scroll', this.onScroll);
209
210
  }
210
211
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
@@ -214,7 +215,8 @@ export class TableContainer extends React.Component {
214
215
  componentDidUpdate(prevProps, prevState) {
215
216
  // toggling sticky headers visiblity
216
217
  if (this.props.stickyHeaders && !this.overflowParent) {
217
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current);
218
+ var _this$props$stickyHea2;
219
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRoot_DO_NOT_USE);
218
220
  } else if (!this.props.stickyHeaders && this.overflowParent) {
219
221
  this.overflowParent.removeEventListener('scroll', this.onScroll);
220
222
  this.overflowParent = null;
@@ -241,7 +243,14 @@ export class TableContainer extends React.Component {
241
243
  case 'pin-bottom':
242
244
  return this.pinTop;
243
245
  case 'stick':
244
- return this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
246
+ const offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
247
+ if (typeof offsetTop === 'number') {
248
+ var _this$props$stickyHea3, _this$props$stickyHea4;
249
+ const defaultScrollRootOffsetTop = (_this$props$stickyHea3 = (_this$props$stickyHea4 = this.props.stickyHeaders) === null || _this$props$stickyHea4 === void 0 ? void 0 : _this$props$stickyHea4.defaultScrollRootTop_DO_NOT_USE) !== null && _this$props$stickyHea3 !== void 0 ? _this$props$stickyHea3 : 0;
250
+ return offsetTop + defaultScrollRootOffsetTop;
251
+ } else {
252
+ return offsetTop;
253
+ }
245
254
  default:
246
255
  return undefined;
247
256
  }
@@ -45,7 +45,7 @@ import { countNodes } from './count-nodes';
45
45
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
46
46
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
47
47
  const packageName = "@atlaskit/renderer";
48
- const packageVersion = "112.3.0";
48
+ const packageVersion = "112.3.1";
49
49
  const setAsQueryContainerStyles = css({
50
50
  containerName: 'ak-renderer-wrapper',
51
51
  containerType: 'inline-size',
@@ -164,7 +164,7 @@ export var StickyTable = function StickyTable(_ref) {
164
164
  /**
165
165
  * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
166
166
  */
167
- function findHorizontalOverflowScrollParent(table) {
167
+ function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
168
168
  var parent = table;
169
169
  if (!parent) {
170
170
  return null;
@@ -175,6 +175,11 @@ function findHorizontalOverflowScrollParent(table) {
175
175
  if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
176
176
  return parent;
177
177
  }
178
+ if (!!defaultScrollRootEl && defaultScrollRootEl === parent) {
179
+ // If a defaultScrollRootEl was specified and we reached it without finding a closer scroll parent,
180
+ // use the defaultScrollRootEl.
181
+ return parent;
182
+ }
178
183
  }
179
184
  return null;
180
185
  }
@@ -217,8 +222,8 @@ export var OverflowParent = /*#__PURE__*/function () {
217
222
  }
218
223
  }], [{
219
224
  key: "fromElement",
220
- value: function fromElement(el) {
221
- return new OverflowParent(findHorizontalOverflowScrollParent(el) || window);
225
+ value: function fromElement(el, defaultScrollRootEl) {
226
+ return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootEl) || window);
222
227
  }
223
228
  }]);
224
229
  return OverflowParent;
@@ -246,7 +246,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
246
246
  this.resizeObserver.observe(this.stickyHeaderRef.current);
247
247
  }
248
248
  if (this.props.stickyHeaders) {
249
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current);
249
+ var _this$props$stickyHea;
250
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRoot_DO_NOT_USE);
250
251
  this.overflowParent.addEventListener('scroll', this.onScroll);
251
252
  }
252
253
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
@@ -258,7 +259,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
258
259
  value: function componentDidUpdate(prevProps, prevState) {
259
260
  // toggling sticky headers visiblity
260
261
  if (this.props.stickyHeaders && !this.overflowParent) {
261
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current);
262
+ var _this$props$stickyHea2;
263
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRoot_DO_NOT_USE);
262
264
  } else if (!this.props.stickyHeaders && this.overflowParent) {
263
265
  this.overflowParent.removeEventListener('scroll', this.onScroll);
264
266
  this.overflowParent = null;
@@ -289,7 +291,14 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
289
291
  case 'pin-bottom':
290
292
  return this.pinTop;
291
293
  case 'stick':
292
- return this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
294
+ var offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
295
+ if (typeof offsetTop === 'number') {
296
+ var _this$props$stickyHea3, _this$props$stickyHea4;
297
+ var defaultScrollRootOffsetTop = (_this$props$stickyHea3 = (_this$props$stickyHea4 = this.props.stickyHeaders) === null || _this$props$stickyHea4 === void 0 ? void 0 : _this$props$stickyHea4.defaultScrollRootTop_DO_NOT_USE) !== null && _this$props$stickyHea3 !== void 0 ? _this$props$stickyHea3 : 0;
298
+ return offsetTop + defaultScrollRootOffsetTop;
299
+ } else {
300
+ return offsetTop;
301
+ }
293
302
  default:
294
303
  return undefined;
295
304
  }
@@ -55,7 +55,7 @@ import { countNodes } from './count-nodes';
55
55
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
56
56
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
57
57
  var packageName = "@atlaskit/renderer";
58
- var packageVersion = "112.3.0";
58
+ var packageVersion = "112.3.1";
59
59
  var setAsQueryContainerStyles = css({
60
60
  containerName: 'ak-renderer-wrapper',
61
61
  containerType: 'inline-size',
@@ -31,7 +31,7 @@ export declare const StickyTable: ({ top, left, mode, shadowClassNames, innerRef
31
31
  export declare class OverflowParent {
32
32
  private ref;
33
33
  private constructor();
34
- static fromElement(el: HTMLElement | null): OverflowParent;
34
+ static fromElement(el: HTMLElement | null, defaultScrollRootEl?: HTMLElement): OverflowParent;
35
35
  get isElement(): boolean;
36
36
  get top(): number;
37
37
  addEventListener(type: string, cb: EventListenerOrEventListenerObject, ...args: any[]): void;
@@ -1,8 +1,27 @@
1
1
  /// <reference types="react" />
2
2
  export type RendererAppearance = 'comment' | 'full-page' | 'full-width' | undefined;
3
+ /**
4
+ * DO NOT USE THESE OPTIONS
5
+ * These StickyHeaderConfig_DO_NOT_USE options are being TEMPORARILY added so Confluence can use Sticky Table Headers
6
+ * in Nav4.
7
+ *
8
+ * They will be cleaned up ASAP after Confluence refactors its page layout to add an explicit scroll container (DISCO-3121)
9
+ *
10
+ * `defaultScrollRoot_DO_NOT_USE` - defaults to undefined - can be used to specify the default OverflowParent if the table
11
+ * doesn't have a parent that explicitly specifies `overflow: scroll` or `overflow-y: scroll`. When undefined, the
12
+ * default OverflowParent will be the window
13
+ * `defaultScrollRootTop_DO_NOT_USE` - defaults to 0 - can be used to specify any offset that should be applied to the
14
+ * sticky table header offset but does not need to be included when determining if the header should be sticky.
15
+ * This is required bcause the llogic that determines if the header should be sticky takes the OverflowParent.offsetTop
16
+ * into account. But the calculation to get the actual header offset does not.
17
+ */
18
+ type StickyHeaderConfig_DO_NOT_USE = {
19
+ defaultScrollRoot_DO_NOT_USE?: HTMLElement;
20
+ defaultScrollRootTop_DO_NOT_USE?: number;
21
+ };
3
22
  export type StickyHeaderConfig = {
4
23
  offsetTop?: number;
5
- };
24
+ } & StickyHeaderConfig_DO_NOT_USE;
6
25
  export type StickyHeaderProps = boolean | ({
7
26
  show?: boolean;
8
27
  } & StickyHeaderConfig);
@@ -14,3 +33,4 @@ export type NodeComponentsProps = {
14
33
  [key: string]: React.ComponentType<React.PropsWithChildren<any>>;
15
34
  };
16
35
  export type HeadingAnchorLinksProps = boolean | HeadingAnchorLinksConfig;
36
+ export {};
@@ -31,7 +31,7 @@ export declare const StickyTable: ({ top, left, mode, shadowClassNames, innerRef
31
31
  export declare class OverflowParent {
32
32
  private ref;
33
33
  private constructor();
34
- static fromElement(el: HTMLElement | null): OverflowParent;
34
+ static fromElement(el: HTMLElement | null, defaultScrollRootEl?: HTMLElement): OverflowParent;
35
35
  get isElement(): boolean;
36
36
  get top(): number;
37
37
  addEventListener(type: string, cb: EventListenerOrEventListenerObject, ...args: any[]): void;
@@ -1,8 +1,27 @@
1
1
  /// <reference types="react" />
2
2
  export type RendererAppearance = 'comment' | 'full-page' | 'full-width' | undefined;
3
+ /**
4
+ * DO NOT USE THESE OPTIONS
5
+ * These StickyHeaderConfig_DO_NOT_USE options are being TEMPORARILY added so Confluence can use Sticky Table Headers
6
+ * in Nav4.
7
+ *
8
+ * They will be cleaned up ASAP after Confluence refactors its page layout to add an explicit scroll container (DISCO-3121)
9
+ *
10
+ * `defaultScrollRoot_DO_NOT_USE` - defaults to undefined - can be used to specify the default OverflowParent if the table
11
+ * doesn't have a parent that explicitly specifies `overflow: scroll` or `overflow-y: scroll`. When undefined, the
12
+ * default OverflowParent will be the window
13
+ * `defaultScrollRootTop_DO_NOT_USE` - defaults to 0 - can be used to specify any offset that should be applied to the
14
+ * sticky table header offset but does not need to be included when determining if the header should be sticky.
15
+ * This is required bcause the llogic that determines if the header should be sticky takes the OverflowParent.offsetTop
16
+ * into account. But the calculation to get the actual header offset does not.
17
+ */
18
+ type StickyHeaderConfig_DO_NOT_USE = {
19
+ defaultScrollRoot_DO_NOT_USE?: HTMLElement;
20
+ defaultScrollRootTop_DO_NOT_USE?: number;
21
+ };
3
22
  export type StickyHeaderConfig = {
4
23
  offsetTop?: number;
5
- };
24
+ } & StickyHeaderConfig_DO_NOT_USE;
6
25
  export type StickyHeaderProps = boolean | ({
7
26
  show?: boolean;
8
27
  } & StickyHeaderConfig);
@@ -14,3 +33,4 @@ export type NodeComponentsProps = {
14
33
  [key: string]: React.ComponentType<React.PropsWithChildren<any>>;
15
34
  };
16
35
  export type HeadingAnchorLinksProps = boolean | HeadingAnchorLinksConfig;
36
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "112.3.0",
3
+ "version": "112.3.1",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/emoji": "^67.9.0",
38
38
  "@atlaskit/feature-gate-js-client": "^4.22.0",
39
39
  "@atlaskit/icon": "^22.24.0",
40
- "@atlaskit/link-datasource": "^3.7.0",
40
+ "@atlaskit/link-datasource": "^3.8.0",
41
41
  "@atlaskit/media-card": "^78.10.0",
42
42
  "@atlaskit/media-client": "^28.0.0",
43
43
  "@atlaskit/media-client-react": "^2.3.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/task-decision": "^17.11.0",
52
52
  "@atlaskit/theme": "^14.0.0",
53
53
  "@atlaskit/tmp-editor-statsig": "^2.11.0",
54
- "@atlaskit/tokens": "^2.0.0",
54
+ "@atlaskit/tokens": "^2.1.0",
55
55
  "@atlaskit/tooltip": "^18.8.0",
56
56
  "@babel/runtime": "^7.0.0",
57
57
  "@emotion/react": "^11.7.1",