@jetbrains/ring-ui-built 8.0.0-beta.14 → 8.0.0-beta.16

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.
@@ -19,7 +19,6 @@ import '../_helpers/island.js';
19
19
  import '../island/header.js';
20
20
  import 'react/compiler-runtime';
21
21
  import '../island/content.js';
22
- import 'element-resize-detector';
23
22
  import '../global/schedule-raf.js';
24
23
  import '../global/get-uid.js';
25
24
  import '../shortcuts/shortcuts.js';
@@ -7,7 +7,6 @@ import ContentWrapper from '../island/content.js';
7
7
  import Dialog from '../dialog/dialog.js';
8
8
  import { Button } from '../button/button.js';
9
9
  import { H2 } from '../heading/heading.js';
10
- import 'element-resize-detector';
11
10
  import '../global/schedule-raf.js';
12
11
  import '../island/adaptive-island-hoc.js';
13
12
  import '../global/linear-function.js';
@@ -9,7 +9,6 @@ import 'classnames';
9
9
  import '../_helpers/island.js';
10
10
  import 'react/compiler-runtime';
11
11
  import '../island/content.js';
12
- import 'element-resize-detector';
13
12
  import '../global/schedule-raf.js';
14
13
  import '../island/adaptive-island-hoc.js';
15
14
  import '../global/linear-function.js';
@@ -25,9 +25,10 @@ export interface CollapsibleGroupProps {
25
25
  */
26
26
  headingLevel?: 2 | 3 | 4 | 5 | 6;
27
27
  'data-test'?: string | null | undefined;
28
+ expandedShadow?: boolean;
28
29
  }
29
30
  declare const CollapsibleGroup: {
30
- ({ ref, avatar, title, subtitle, children, className, defaultExpanded, expanded, onChange, disableAnimation, interactive, keepMounted, headingLevel, "data-test": dataTest, }: CollapsibleGroupProps): React.JSX.Element;
31
+ ({ ref, avatar, title, subtitle, children, className, defaultExpanded, expanded, onChange, disableAnimation, interactive, keepMounted, headingLevel, "data-test": dataTest, expandedShadow, }: CollapsibleGroupProps): React.JSX.Element;
31
32
  displayName: string;
32
33
  };
33
34
  export default CollapsibleGroup;
@@ -18,15 +18,15 @@ import '../global/dom.js';
18
18
  import '../global/parse-css-duration.js';
19
19
  import '../collapse/utils.js';
20
20
 
21
- var styles = {"expand":"ring-collapsible-group-expand","collapseRoot":"ring-collapsible-group-collapseRoot","hovered":"ring-collapsible-group-hovered","expanded":"ring-collapsible-group-expanded","headerButton":"ring-collapsible-group-headerButton","header":"ring-collapsible-group-header","heading":"ring-collapsible-group-heading","headerStatic":"ring-collapsible-group-headerStatic","headerContent":"ring-collapsible-group-headerContent","avatarGroup":"ring-collapsible-group-avatarGroup","title":"ring-collapsible-group-title","subtitleGroup":"ring-collapsible-group-subtitleGroup","subtitle":"ring-collapsible-group-subtitle","subtitleChevron":"ring-collapsible-group-subtitleChevron","toggle":"ring-collapsible-group-toggle","toggleIcon":"ring-collapsible-group-toggleIcon","body":"ring-collapsible-group-body"};
21
+ var styles = {"expand":"ring-collapsible-group-expand","collapseRoot":"ring-collapsible-group-collapseRoot","headerButton":"ring-collapsible-group-headerButton","expandedShadow":"ring-collapsible-group-expandedShadow","header":"ring-collapsible-group-header","heading":"ring-collapsible-group-heading","headerStatic":"ring-collapsible-group-headerStatic","headerContent":"ring-collapsible-group-headerContent","avatarGroup":"ring-collapsible-group-avatarGroup","title":"ring-collapsible-group-title","subtitleGroup":"ring-collapsible-group-subtitleGroup","subtitle":"ring-collapsible-group-subtitle","subtitleChevron":"ring-collapsible-group-subtitleChevron","toggle":"ring-collapsible-group-toggle","toggleIcon":"ring-collapsible-group-toggleIcon","body":"ring-collapsible-group-body"};
22
22
 
23
23
  function CollapsibleGroupHeaderContent(t0) {
24
24
  const $ = c(16);
25
- if ($[0] !== "1f361c2ded768218a0a90f8cd47ebb79eb0ef7a40f501eb82fe1f1443b14d037") {
25
+ if ($[0] !== "2615250e6936ea59c19eaf09870ac5b92345ac63694f8dd4c63950e29378135f") {
26
26
  for (let $i = 0; $i < 16; $i += 1) {
27
27
  $[$i] = Symbol.for("react.memo_cache_sentinel");
28
28
  }
29
- $[0] = "1f361c2ded768218a0a90f8cd47ebb79eb0ef7a40f501eb82fe1f1443b14d037";
29
+ $[0] = "2615250e6936ea59c19eaf09870ac5b92345ac63694f8dd4c63950e29378135f";
30
30
  }
31
31
  const {
32
32
  avatar,
@@ -121,11 +121,11 @@ function CollapsibleGroupHeaderContent(t0) {
121
121
  }
122
122
  function CollapsibleGroupHeader(t0) {
123
123
  const $ = c(16);
124
- if ($[0] !== "1f361c2ded768218a0a90f8cd47ebb79eb0ef7a40f501eb82fe1f1443b14d037") {
124
+ if ($[0] !== "2615250e6936ea59c19eaf09870ac5b92345ac63694f8dd4c63950e29378135f") {
125
125
  for (let $i = 0; $i < 16; $i += 1) {
126
126
  $[$i] = Symbol.for("react.memo_cache_sentinel");
127
127
  }
128
- $[0] = "1f361c2ded768218a0a90f8cd47ebb79eb0ef7a40f501eb82fe1f1443b14d037";
128
+ $[0] = "2615250e6936ea59c19eaf09870ac5b92345ac63694f8dd4c63950e29378135f";
129
129
  }
130
130
  let avatar;
131
131
  let buttonProps;
@@ -194,11 +194,11 @@ function CollapsibleGroupHeader(t0) {
194
194
  }
195
195
  function CollapsibleGroupHeaderStatic(t0) {
196
196
  const $ = c(5);
197
- if ($[0] !== "1f361c2ded768218a0a90f8cd47ebb79eb0ef7a40f501eb82fe1f1443b14d037") {
197
+ if ($[0] !== "2615250e6936ea59c19eaf09870ac5b92345ac63694f8dd4c63950e29378135f") {
198
198
  for (let $i = 0; $i < 5; $i += 1) {
199
199
  $[$i] = Symbol.for("react.memo_cache_sentinel");
200
200
  }
201
- $[0] = "1f361c2ded768218a0a90f8cd47ebb79eb0ef7a40f501eb82fe1f1443b14d037";
201
+ $[0] = "2615250e6936ea59c19eaf09870ac5b92345ac63694f8dd4c63950e29378135f";
202
202
  }
203
203
  const {
204
204
  avatar,
@@ -225,12 +225,12 @@ function CollapsibleGroupHeaderStatic(t0) {
225
225
  return t1;
226
226
  }
227
227
  const CollapsibleGroup = t0 => {
228
- const $ = c(31);
229
- if ($[0] !== "1f361c2ded768218a0a90f8cd47ebb79eb0ef7a40f501eb82fe1f1443b14d037") {
230
- for (let $i = 0; $i < 31; $i += 1) {
228
+ const $ = c(30);
229
+ if ($[0] !== "2615250e6936ea59c19eaf09870ac5b92345ac63694f8dd4c63950e29378135f") {
230
+ for (let $i = 0; $i < 30; $i += 1) {
231
231
  $[$i] = Symbol.for("react.memo_cache_sentinel");
232
232
  }
233
- $[0] = "1f361c2ded768218a0a90f8cd47ebb79eb0ef7a40f501eb82fe1f1443b14d037";
233
+ $[0] = "2615250e6936ea59c19eaf09870ac5b92345ac63694f8dd4c63950e29378135f";
234
234
  }
235
235
  const {
236
236
  ref,
@@ -246,7 +246,8 @@ const CollapsibleGroup = t0 => {
246
246
  interactive: t5,
247
247
  keepMounted: t6,
248
248
  headingLevel,
249
- "data-test": dataTest
249
+ "data-test": dataTest,
250
+ expandedShadow
250
251
  } = t0;
251
252
  const defaultExpanded = t1 === undefined ? false : t1;
252
253
  const expanded = t2 === undefined ? null : t2;
@@ -255,7 +256,6 @@ const CollapsibleGroup = t0 => {
255
256
  const interactive = t5 === undefined ? true : t5;
256
257
  const keepMounted = t6 === undefined ? false : t6;
257
258
  const [innerExpanded, setInnerExpanded] = useState(defaultExpanded);
258
- const [hovered, setHovered] = useState(false);
259
259
  const isExpanded = expanded !== null && expanded !== void 0 ? expanded : innerExpanded;
260
260
  let t7;
261
261
  if ($[1] !== expanded || $[2] !== onChange) {
@@ -273,107 +273,104 @@ const CollapsibleGroup = t0 => {
273
273
  t7 = $[3];
274
274
  }
275
275
  const handleChange = t7;
276
- let t8;
277
- if ($[4] !== className || $[5] !== hovered || $[6] !== isExpanded) {
278
- t8 = classNames(styles.expand, className, {
279
- [styles.hovered]: hovered,
280
- [styles.expanded]: isExpanded
276
+ const t8 = expandedShadow && isExpanded;
277
+ let t9;
278
+ if ($[4] !== className || $[5] !== t8) {
279
+ t9 = classNames(styles.expand, className, {
280
+ [styles.expandedShadow]: t8
281
281
  });
282
282
  $[4] = className;
283
- $[5] = hovered;
284
- $[6] = isExpanded;
285
- $[7] = t8;
283
+ $[5] = t8;
284
+ $[6] = t9;
286
285
  } else {
287
- t8 = $[7];
286
+ t9 = $[6];
288
287
  }
289
- const classes = t8;
290
- let t9;
291
- if ($[8] !== avatar || $[9] !== interactive || $[10] !== subtitle || $[11] !== title) {
292
- t9 = interactive ? /*#__PURE__*/jsx(CollapsibleGroupHeader, {
288
+ const classes = t9;
289
+ let t10;
290
+ if ($[7] !== avatar || $[8] !== interactive || $[9] !== subtitle || $[10] !== title) {
291
+ t10 = interactive ? /*#__PURE__*/jsx(CollapsibleGroupHeader, {
293
292
  avatar: avatar,
294
293
  titleContent: title,
295
- subtitle: subtitle,
296
- onMouseEnter: () => setHovered(true),
297
- onMouseLeave: () => setHovered(false)
294
+ subtitle: subtitle
298
295
  }) : /*#__PURE__*/jsx(CollapsibleGroupHeaderStatic, {
299
296
  avatar: avatar,
300
297
  titleContent: title,
301
298
  subtitle: subtitle
302
299
  });
303
- $[8] = avatar;
304
- $[9] = interactive;
305
- $[10] = subtitle;
306
- $[11] = title;
307
- $[12] = t9;
300
+ $[7] = avatar;
301
+ $[8] = interactive;
302
+ $[9] = subtitle;
303
+ $[10] = title;
304
+ $[11] = t10;
308
305
  } else {
309
- t9 = $[12];
306
+ t10 = $[11];
310
307
  }
311
- const header = t9;
312
- const t10 = !defaultExpanded;
313
- const t11 = expanded == null ? null : !expanded;
314
- let t12;
315
- if ($[13] !== header || $[14] !== headingLevel) {
316
- t12 = headingLevel != null ? /*#__PURE__*/React__default.createElement(`h${headingLevel}`, {
308
+ const header = t10;
309
+ const t11 = !defaultExpanded;
310
+ const t12 = expanded == null ? null : !expanded;
311
+ let t13;
312
+ if ($[12] !== header || $[13] !== headingLevel) {
313
+ t13 = headingLevel != null ? /*#__PURE__*/React__default.createElement(`h${headingLevel}`, {
317
314
  className: styles.heading
318
315
  }, header) : header;
319
- $[13] = header;
320
- $[14] = headingLevel;
321
- $[15] = t12;
316
+ $[12] = header;
317
+ $[13] = headingLevel;
318
+ $[14] = t13;
322
319
  } else {
323
- t12 = $[15];
320
+ t13 = $[14];
324
321
  }
325
- let t13;
326
- if ($[16] !== children) {
327
- t13 = /*#__PURE__*/jsx(CollapseContent, {
322
+ let t14;
323
+ if ($[15] !== children) {
324
+ t14 = /*#__PURE__*/jsx(CollapseContent, {
328
325
  children: /*#__PURE__*/jsx("div", {
329
326
  className: styles.body,
330
327
  children: children
331
328
  })
332
329
  });
333
- $[16] = children;
334
- $[17] = t13;
330
+ $[15] = children;
331
+ $[16] = t14;
335
332
  } else {
336
- t13 = $[17];
333
+ t14 = $[16];
337
334
  }
338
- let t14;
339
- if ($[18] !== disableAnimation || $[19] !== handleChange || $[20] !== keepMounted || $[21] !== t10 || $[22] !== t11 || $[23] !== t12 || $[24] !== t13) {
340
- t14 = /*#__PURE__*/jsxs(Collapse, {
341
- defaultCollapsed: t10,
342
- collapsed: t11,
335
+ let t15;
336
+ if ($[17] !== disableAnimation || $[18] !== handleChange || $[19] !== keepMounted || $[20] !== t11 || $[21] !== t12 || $[22] !== t13 || $[23] !== t14) {
337
+ t15 = /*#__PURE__*/jsxs(Collapse, {
338
+ defaultCollapsed: t11,
339
+ collapsed: t12,
343
340
  onChange: handleChange,
344
341
  disableAnimation: disableAnimation,
345
342
  keepMounted: keepMounted,
346
343
  className: styles.collapseRoot,
347
- children: [t12, t13]
344
+ children: [t13, t14]
348
345
  });
349
- $[18] = disableAnimation;
350
- $[19] = handleChange;
351
- $[20] = keepMounted;
352
- $[21] = t10;
353
- $[22] = t11;
354
- $[23] = t12;
355
- $[24] = t13;
356
- $[25] = t14;
346
+ $[17] = disableAnimation;
347
+ $[18] = handleChange;
348
+ $[19] = keepMounted;
349
+ $[20] = t11;
350
+ $[21] = t12;
351
+ $[22] = t13;
352
+ $[23] = t14;
353
+ $[24] = t15;
357
354
  } else {
358
- t14 = $[25];
355
+ t15 = $[24];
359
356
  }
360
- let t15;
361
- if ($[26] !== classes || $[27] !== dataTest || $[28] !== ref || $[29] !== t14) {
362
- t15 = /*#__PURE__*/jsx("div", {
357
+ let t16;
358
+ if ($[25] !== classes || $[26] !== dataTest || $[27] !== ref || $[28] !== t15) {
359
+ t16 = /*#__PURE__*/jsx("div", {
363
360
  ref: ref,
364
361
  className: classes,
365
362
  "data-test": dataTest,
366
- children: t14
363
+ children: t15
367
364
  });
368
- $[26] = classes;
369
- $[27] = dataTest;
370
- $[28] = ref;
371
- $[29] = t14;
372
- $[30] = t15;
365
+ $[25] = classes;
366
+ $[26] = dataTest;
367
+ $[27] = ref;
368
+ $[28] = t15;
369
+ $[29] = t16;
373
370
  } else {
374
- t15 = $[30];
371
+ t16 = $[29];
375
372
  }
376
- return t15;
373
+ return t16;
377
374
  };
378
375
  CollapsibleGroup.displayName = 'CollapsibleGroup';
379
376
  function _temp() {}
@@ -13,7 +13,6 @@ import '../global/data-tests.js';
13
13
  import '../island/adaptive-island-hoc.js';
14
14
  import '../global/linear-function.js';
15
15
  import 'react/compiler-runtime';
16
- import 'element-resize-detector';
17
16
  import '../global/schedule-raf.js';
18
17
  import '../global/get-uid.js';
19
18
  import '../shortcuts/shortcuts.js';
@@ -14,7 +14,6 @@ import '../_helpers/island.js';
14
14
  import '../island/header.js';
15
15
  import 'react/compiler-runtime';
16
16
  import '../island/content.js';
17
- import 'element-resize-detector';
18
17
  import '../global/schedule-raf.js';
19
18
  import '../global/get-uid.js';
20
19
  import '../shortcuts/shortcuts.js';
@@ -7,6 +7,7 @@ export interface Geometry {
7
7
  height: number;
8
8
  }
9
9
  export interface DialogState {
10
+ isShown: boolean;
10
11
  shortcutsScope: string;
11
12
  geometry: Geometry | null;
12
13
  resized: boolean;
@@ -20,7 +20,6 @@ import '../_helpers/island.js';
20
20
  import '../island/header.js';
21
21
  import 'react/compiler-runtime';
22
22
  import '../island/content.js';
23
- import 'element-resize-detector';
24
23
  import '../global/schedule-raf.js';
25
24
  import '../shortcuts/core.js';
26
25
  import 'core-js/modules/es.array.includes.js';
@@ -71,7 +70,8 @@ class Dialog extends PureComponent {
71
70
  state = {
72
71
  shortcutsScope: getUID('ring-dialog-'),
73
72
  geometry: null,
74
- resized: false
73
+ resized: false,
74
+ isShown: false
75
75
  };
76
76
  componentDidMount() {
77
77
  const {
@@ -116,6 +116,7 @@ class Dialog extends PureComponent {
116
116
  } = this.props;
117
117
  if (this.nativeDialog.current) {
118
118
  if (show) {
119
+ const focusedElementBeforeOpen = document.activeElement;
119
120
  this.nativeDialog.current.removeAttribute('open');
120
121
  if (modal) {
121
122
  this.nativeDialog.current.showModal();
@@ -123,11 +124,18 @@ class Dialog extends PureComponent {
123
124
  this.nativeDialog.current.show();
124
125
  }
125
126
  if (!autoFocusFirst && !this.nativeDialog.current.querySelector('[autofocus]')) {
126
- this.nativeDialog.current.focus();
127
+ if (focusedElementBeforeOpen instanceof HTMLElement && this.nativeDialog.current.contains(focusedElementBeforeOpen)) {
128
+ focusedElementBeforeOpen.focus();
129
+ } else {
130
+ this.nativeDialog.current.focus();
131
+ }
127
132
  }
128
133
  } else {
129
134
  this.nativeDialog.current.close();
130
135
  }
136
+ this.setState({
137
+ isShown: show
138
+ });
131
139
  }
132
140
  }
133
141
  toggleScrollPreventer() {
@@ -349,6 +357,11 @@ class Dialog extends PureComponent {
349
357
  })]
350
358
  });
351
359
  if (native) {
360
+ // Chromium lets sequential focus escape a modal dialog backward from its first focusable and
361
+ // drops focus when the dialog unmounts while closing, so honor a requested trap here the same
362
+ // way the non-native branch does.
363
+ const trapEnabled = !getTrapDisabled(trapFocus, trapDisabled);
364
+ const doShow = this.state.isShown || show;
352
365
  return /*#__PURE__*/jsx("dialog", {
353
366
  ...restProps,
354
367
  "aria-label": label,
@@ -361,8 +374,14 @@ class Dialog extends PureComponent {
361
374
  children: /*#__PURE__*/jsx(PopupTarget, {
362
375
  id: this.uid,
363
376
  className: styles.popupTarget,
364
- children: target => /*#__PURE__*/jsxs(Fragment, {
377
+ children: target => trapEnabled && doShow ? /*#__PURE__*/jsxs(TabTrap, {
378
+ trapDisabled: false,
379
+ autoFocusFirst: autoFocusFirst,
380
+ focusBackOnClose: focusBackOnClose,
381
+ focusBackOnExit: focusBackOnExit,
365
382
  children: [content, target]
383
+ }) : /*#__PURE__*/jsxs(Fragment, {
384
+ children: [doShow && content, target]
366
385
  })
367
386
  })
368
387
  });
@@ -370,15 +389,7 @@ class Dialog extends PureComponent {
370
389
  return show && /*#__PURE__*/jsx(PopupTargetContext.Consumer, {
371
390
  children: contextTarget => {
372
391
  const normalizedContextTarget = normalizePopupTarget(contextTarget);
373
- let targetElement = document.body;
374
- if (portalTarget instanceof HTMLElement) {
375
- targetElement = portalTarget;
376
- } else if (normalizedContextTarget !== undefined) {
377
- const container = getPopupContainer(normalizedContextTarget);
378
- if (container) {
379
- targetElement = container;
380
- }
381
- }
392
+ const targetElement = portalTarget instanceof HTMLElement ? portalTarget : normalizedContextTarget !== undefined && getPopupContainer(normalizedContextTarget) || document.body;
382
393
  return /*#__PURE__*/createPortal(/*#__PURE__*/jsx(PopupTarget, {
383
394
  id: this.uid,
384
395
  className: styles.popupTarget,
@@ -1,5 +1,4 @@
1
1
  import { Component, type Ref, type HTMLAttributes } from 'react';
2
- import createResizeDetector from 'element-resize-detector';
3
2
  export interface IslandContentProps extends Omit<HTMLAttributes<HTMLElement>, 'onScroll'> {
4
3
  ref?: Ref<Content>;
5
4
  fade?: boolean | null | undefined;
@@ -20,11 +19,10 @@ declare class Content extends Component<IslandContentInnerProps> {
20
19
  };
21
20
  state: {
22
21
  scrolledToTop: boolean;
23
- scrolledToBottom: boolean;
22
+ showBottomFade: boolean;
24
23
  };
25
24
  componentWillUnmount(): void;
26
- resizeDetector: createResizeDetector.Erd;
27
- wrapperNode?: HTMLElement | null;
25
+ wrapperResizeObserver?: ResizeObserver;
28
26
  setWrapper: (node: HTMLElement | null) => void;
29
27
  calculateScrollPosition: () => void;
30
28
  scrollableNode?: HTMLElement | null;
@@ -1,7 +1,6 @@
1
1
  import { c } from 'react/compiler-runtime';
2
2
  import { Component } from 'react';
3
3
  import classNames from 'classnames';
4
- import createResizeDetector from 'element-resize-detector';
5
4
  import scheduleRAF from '../global/schedule-raf.js';
6
5
  import { ScrollHandlerContext } from './adaptive-island-hoc.js';
7
6
  import { s as styles } from '../_helpers/island.js';
@@ -10,7 +9,10 @@ import '../global/linear-function.js';
10
9
 
11
10
  const scheduleScrollAction = scheduleRAF();
12
11
  const noop = () => {};
13
- const END_DISTANCE = 16;
12
+ // `onScrollToBottom` keeps the legacy 16px allowance so callbacks still fire when subpixel rounding or
13
+ // zoom leaves a small gap, while the visual fade hides only at the exact bottom edge.
14
+ const CALLBACK_END_DISTANCE = 16;
15
+ const FADE_END_DISTANCE = 1;
14
16
  class Content extends Component {
15
17
  static defaultProps = {
16
18
  fade: true,
@@ -20,25 +22,22 @@ class Content extends Component {
20
22
  };
21
23
  state = {
22
24
  scrolledToTop: true,
23
- scrolledToBottom: false
25
+ showBottomFade: false
24
26
  };
25
27
  componentWillUnmount() {
26
28
  this.scrollableNode = null;
27
- if (!this.wrapperNode) {
28
- return;
29
- }
30
- this.resizeDetector.removeAllListeners(this.wrapperNode);
29
+ this.wrapperResizeObserver?.disconnect();
31
30
  }
32
- resizeDetector = createResizeDetector({
33
- strategy: 'scroll'
34
- });
35
- wrapperNode;
31
+ wrapperResizeObserver;
36
32
  setWrapper = node => {
37
33
  if (!node) {
38
34
  return;
39
35
  }
40
- this.wrapperNode = node;
41
- this.resizeDetector.listenTo(node, this.calculateScrollPosition);
36
+ this.wrapperResizeObserver?.disconnect();
37
+ this.wrapperResizeObserver = new ResizeObserver(() => {
38
+ this.calculateScrollPosition();
39
+ });
40
+ this.wrapperResizeObserver.observe(node);
42
41
  };
43
42
  calculateScrollPosition = () => scheduleScrollAction(() => {
44
43
  const {
@@ -54,13 +53,14 @@ class Content extends Component {
54
53
  offsetHeight
55
54
  } = scrollableNode;
56
55
  const scrolledToTop = scrollTop === 0;
57
- const scrolledToBottom = offsetHeight + scrollTop >= scrollHeight - END_DISTANCE;
58
- if (scrolledToBottom) {
56
+ const showBottomFade = offsetHeight + scrollTop >= scrollHeight - FADE_END_DISTANCE;
57
+ const isNearBottom = offsetHeight > 0 && offsetHeight + scrollTop >= scrollHeight - CALLBACK_END_DISTANCE;
58
+ if (isNearBottom) {
59
59
  this.props.onScrollToBottom?.();
60
60
  }
61
61
  this.setState({
62
62
  scrolledToTop,
63
- scrolledToBottom
63
+ showBottomFade
64
64
  });
65
65
  });
66
66
  scrollableNode;
@@ -86,13 +86,13 @@ class Content extends Component {
86
86
  } = this.props;
87
87
  const {
88
88
  scrolledToTop,
89
- scrolledToBottom
89
+ showBottomFade
90
90
  } = this.state;
91
91
  const classes = classNames(styles.content, className, {
92
92
  [styles.contentWithTopFade]: fade && !scrolledToTop,
93
- [styles.contentWithBottomFade]: fade && !scrolledToBottom,
93
+ [styles.contentWithBottomFade]: fade && !showBottomFade,
94
94
  [styles.withTransparentBottomBorder]: bottomBorder,
95
- [styles.withBottomBorder]: bottomBorder && !scrolledToBottom
95
+ [styles.withBottomBorder]: bottomBorder && !showBottomFade
96
96
  });
97
97
  const scrollableWrapperClasses = classNames(styles.scrollableWrapper, scrollableWrapperClassName);
98
98
  return /*#__PURE__*/jsx("div", {
@@ -114,11 +114,11 @@ class Content extends Component {
114
114
  }
115
115
  const ContentWrapper = t0 => {
116
116
  const $ = c(5);
117
- if ($[0] !== "e4db06b946c16f75a9eac1dc4434adb1fda7cf8013533176d779915994c312c4") {
117
+ if ($[0] !== "df1ec5d93922f12587fd3db6b559dd3360b591c94eca864dcfb78d805d49fd83") {
118
118
  for (let $i = 0; $i < 5; $i += 1) {
119
119
  $[$i] = Symbol.for("react.memo_cache_sentinel");
120
120
  }
121
- $[0] = "e4db06b946c16f75a9eac1dc4434adb1fda7cf8013533176d779915994c312c4";
121
+ $[0] = "df1ec5d93922f12587fd3db6b559dd3360b591c94eca864dcfb78d805d49fd83";
122
122
  }
123
123
  let props;
124
124
  if ($[1] !== t0) {
@@ -8,7 +8,6 @@ export { default as Header } from './header.js';
8
8
  export { default as Content } from './content.js';
9
9
  import '../global/linear-function.js';
10
10
  import 'react/compiler-runtime';
11
- import 'element-resize-detector';
12
11
  import '../global/schedule-raf.js';
13
12
 
14
13
  class Island extends Component {
@@ -9,10 +9,17 @@ export interface LoginDialogProps {
9
9
  loader?: boolean | null | undefined;
10
10
  loadingMessage?: string | null | undefined;
11
11
  }
12
+ interface State {
13
+ loading: boolean;
14
+ loggingIn: boolean;
15
+ showFallbackLink: boolean;
16
+ height: number;
17
+ width: number;
18
+ }
12
19
  /**
13
20
  * @name Login Dialog
14
21
  */
15
- export default class LoginDialog extends Component<LoginDialogProps> {
22
+ export default class LoginDialog extends Component<LoginDialogProps, State> {
16
23
  static defaultProps: {
17
24
  show: boolean;
18
25
  url: string;
@@ -26,7 +33,13 @@ export default class LoginDialog extends Component<LoginDialogProps> {
26
33
  height: number;
27
34
  width: number;
28
35
  };
36
+ static getDerivedStateFromProps(nextProps: LoginDialogProps, prevState: State): {
37
+ loading: boolean;
38
+ loggingIn: boolean;
39
+ showFallbackLink: boolean;
40
+ } | null;
29
41
  componentDidMount(): void;
42
+ componentDidUpdate(prevProps: LoginDialogProps): void;
30
43
  componentWillUnmount(): void;
31
44
  showFallbackTimout?: number;
32
45
  startFallbackCountdown(): void;
@@ -34,3 +47,4 @@ export default class LoginDialog extends Component<LoginDialogProps> {
34
47
  render(): import("react").JSX.Element;
35
48
  }
36
49
  export type LoginDialogAttrs = React.JSX.LibraryManagedAttributes<typeof LoginDialog, LoginDialogProps>;
50
+ export {};
@@ -13,7 +13,6 @@ import '../global/data-tests.js';
13
13
  import '../island/adaptive-island-hoc.js';
14
14
  import '../global/linear-function.js';
15
15
  import '../island/header.js';
16
- import 'element-resize-detector';
17
16
  import '../global/schedule-raf.js';
18
17
  import '../global/get-uid.js';
19
18
  import '../shortcuts/shortcuts.js';
@@ -79,11 +78,32 @@ class LoginDialog extends Component {
79
78
  height: DEFAULT_HEIGHT,
80
79
  width: DEFAULT_WIDTH
81
80
  };
81
+ static getDerivedStateFromProps(nextProps, prevState) {
82
+ if (!nextProps.show && (!prevState.loading || prevState.loggingIn || prevState.showFallbackLink)) {
83
+ return {
84
+ loading: true,
85
+ loggingIn: false,
86
+ showFallbackLink: false
87
+ };
88
+ }
89
+ return null;
90
+ }
82
91
  componentDidMount() {
83
92
  window.addEventListener('message', this.onMessage);
84
- this.startFallbackCountdown();
93
+ if (this.props.show) {
94
+ this.startFallbackCountdown();
95
+ }
96
+ }
97
+ componentDidUpdate(prevProps) {
98
+ if (this.props.show && !prevProps.show) {
99
+ this.startFallbackCountdown();
100
+ }
101
+ if (!this.props.show && prevProps.show) {
102
+ clearTimeout(this.showFallbackTimout);
103
+ }
85
104
  }
86
105
  componentWillUnmount() {
106
+ clearTimeout(this.showFallbackTimout);
87
107
  window.removeEventListener('message', this.onMessage);
88
108
  }
89
109
  showFallbackTimout;
@@ -16,7 +16,6 @@ import '../_helpers/island.js';
16
16
  import '../island/header.js';
17
17
  import 'react/compiler-runtime';
18
18
  import '../island/content.js';
19
- import 'element-resize-detector';
20
19
  import '../global/schedule-raf.js';
21
20
  import '../global/get-uid.js';
22
21
  import '../shortcuts/shortcuts.js';