@financial-times/qanda-ui 0.0.1-beta.44 → 0.0.1-beta.45

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/dist/cjs/index.js CHANGED
@@ -46,7 +46,31 @@ class QandaUI {
46
46
  init() {
47
47
  (0, preact_1.render)((0, jsx_runtime_1.jsx)(Qanda_1.default, { storyId: this.storyId, useStaging: this.useStaging, title: this.title, commentsAPIHost: this.commentsAPIHost, commentsAPIVersion: this.commentsAPIVersion, maxQuestionLength: this.maxQuestionLength, embedFormFieldContainer: this.embedFormFieldContainer, countdownTimerContainer: this.countdownTimerContainer }), this.containerElement);
48
48
  }
49
+ checkFooterVisibility(footerSelector) {
50
+ const footer = document.querySelector(footerSelector);
51
+ if (footer) {
52
+ this.footerObserver = new IntersectionObserver((entries) => {
53
+ const floatingActionBar = document.querySelector('.floating-action-bar__container');
54
+ if (floatingActionBar) {
55
+ entries.forEach((entry) => {
56
+ if (entry.isIntersecting &&
57
+ !floatingActionBar.classList.contains('o3-visually-hidden')) {
58
+ floatingActionBar.classList.add('o3-visually-hidden');
59
+ }
60
+ else {
61
+ floatingActionBar.classList.remove('o3-visually-hidden');
62
+ }
63
+ });
64
+ }
65
+ });
66
+ this.footerObserver.observe(footer);
67
+ }
68
+ }
49
69
  destroy() {
70
+ if (this.footerObserver) {
71
+ this.footerObserver.disconnect();
72
+ this.footerObserver = undefined;
73
+ }
50
74
  (0, preact_1.render)(null, this.containerElement);
51
75
  }
52
76
  }
package/dist/esm/index.js CHANGED
@@ -39,7 +39,31 @@ class QandaUI {
39
39
  init() {
40
40
  render(_jsx(Qanda, { storyId: this.storyId, useStaging: this.useStaging, title: this.title, commentsAPIHost: this.commentsAPIHost, commentsAPIVersion: this.commentsAPIVersion, maxQuestionLength: this.maxQuestionLength, embedFormFieldContainer: this.embedFormFieldContainer, countdownTimerContainer: this.countdownTimerContainer }), this.containerElement);
41
41
  }
42
+ checkFooterVisibility(footerSelector) {
43
+ const footer = document.querySelector(footerSelector);
44
+ if (footer) {
45
+ this.footerObserver = new IntersectionObserver((entries) => {
46
+ const floatingActionBar = document.querySelector('.floating-action-bar__container');
47
+ if (floatingActionBar) {
48
+ entries.forEach((entry) => {
49
+ if (entry.isIntersecting &&
50
+ !floatingActionBar.classList.contains('o3-visually-hidden')) {
51
+ floatingActionBar.classList.add('o3-visually-hidden');
52
+ }
53
+ else {
54
+ floatingActionBar.classList.remove('o3-visually-hidden');
55
+ }
56
+ });
57
+ }
58
+ });
59
+ this.footerObserver.observe(footer);
60
+ }
61
+ }
42
62
  destroy() {
63
+ if (this.footerObserver) {
64
+ this.footerObserver.disconnect();
65
+ this.footerObserver = undefined;
66
+ }
43
67
  render(null, this.containerElement);
44
68
  }
45
69
  }
@@ -10,8 +10,10 @@ declare class QandaUI {
10
10
  commentsAPIHost: string;
11
11
  commentsAPIVersion: string;
12
12
  maxQuestionLength: number;
13
+ footerObserver?: IntersectionObserver;
13
14
  constructor(containerElement: HTMLElement, options?: QandaProps);
14
15
  init(): void;
16
+ checkFooterVisibility(footerSelector: string): void;
15
17
  destroy(): void;
16
18
  }
17
19
  export { QandaUI, QandaBlock };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/qanda-ui",
3
- "version": "0.0.1-beta.44",
3
+ "version": "0.0.1-beta.45",
4
4
  "description": "Components for the Live Q&A (AKA Ask an Expert) UI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",