@vkontakte/vkui 8.1.1 → 8.1.3

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 (65) hide show
  1. package/dist/components/Flex/FlexItem/FlexItem.d.ts +1 -1
  2. package/dist/components/Flex/FlexItem/FlexItem.d.ts.map +1 -1
  3. package/dist/components/Flex/FlexItem/FlexItem.js +39 -8
  4. package/dist/components/Flex/FlexItem/FlexItem.js.map +1 -1
  5. package/dist/components/NavTransitionContext/NavTransitionContext.d.ts +2 -1
  6. package/dist/components/NavTransitionContext/NavTransitionContext.d.ts.map +1 -1
  7. package/dist/components/NavTransitionContext/NavTransitionContext.js +8 -4
  8. package/dist/components/NavTransitionContext/NavTransitionContext.js.map +1 -1
  9. package/dist/components/OnboardingTooltip/OnboardingTooltip.d.ts.map +1 -1
  10. package/dist/components/OnboardingTooltip/OnboardingTooltip.js +2 -4
  11. package/dist/components/OnboardingTooltip/OnboardingTooltip.js.map +1 -1
  12. package/dist/components/Popper/Popper.d.ts.map +1 -1
  13. package/dist/components/Popper/Popper.js +6 -3
  14. package/dist/components/Popper/Popper.js.map +1 -1
  15. package/dist/components/Root/Root.d.ts.map +1 -1
  16. package/dist/components/Root/Root.js +29 -32
  17. package/dist/components/Root/Root.js.map +1 -1
  18. package/dist/components/View/View.d.ts.map +1 -1
  19. package/dist/components/View/View.js +50 -53
  20. package/dist/components/View/View.js.map +1 -1
  21. package/dist/components/View/ViewInfinite.d.ts.map +1 -1
  22. package/dist/components/View/ViewInfinite.js +34 -37
  23. package/dist/components/View/ViewInfinite.js.map +1 -1
  24. package/dist/components.css +1 -1
  25. package/dist/components.css.map +1 -1
  26. package/dist/cssm/components/Flex/FlexItem/FlexItem.js +39 -9
  27. package/dist/cssm/components/Flex/FlexItem/FlexItem.js.map +1 -1
  28. package/dist/cssm/components/NavTransitionContext/NavTransitionContext.js +8 -4
  29. package/dist/cssm/components/NavTransitionContext/NavTransitionContext.js.map +1 -1
  30. package/dist/cssm/components/OnboardingTooltip/OnboardingTooltip.js +2 -4
  31. package/dist/cssm/components/OnboardingTooltip/OnboardingTooltip.js.map +1 -1
  32. package/dist/cssm/components/Popper/Popper.js +6 -3
  33. package/dist/cssm/components/Popper/Popper.js.map +1 -1
  34. package/dist/cssm/components/Root/Root.js +29 -32
  35. package/dist/cssm/components/Root/Root.js.map +1 -1
  36. package/dist/cssm/components/View/View.js +50 -53
  37. package/dist/cssm/components/View/View.js.map +1 -1
  38. package/dist/cssm/components/View/ViewInfinite.js +34 -37
  39. package/dist/cssm/components/View/ViewInfinite.js.map +1 -1
  40. package/dist/cssm/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.js +4 -4
  41. package/dist/cssm/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.js.map +1 -1
  42. package/dist/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.d.ts.map +1 -1
  43. package/dist/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.js +4 -4
  44. package/dist/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.js.map +1 -1
  45. package/dist/vkui.css +1 -1
  46. package/dist/vkui.css.map +1 -1
  47. package/package.json +1 -1
  48. package/src/components/Flex/FlexItem/FlexItem.tsx +38 -11
  49. package/src/components/NavTransitionContext/NavTransitionContext.tsx +5 -1
  50. package/src/components/OnboardingTooltip/OnboardingTooltip.tsx +2 -5
  51. package/src/components/Popper/Popper.tsx +7 -4
  52. package/src/components/Root/Root.tsx +50 -52
  53. package/src/components/View/View.tsx +83 -89
  54. package/src/components/View/ViewInfinite.tsx +65 -69
  55. package/src/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.ts +4 -5
  56. package/dist/cssm/components/Flex/FlexItem/FlexItem.module.css +0 -17
  57. package/dist/cssm/lib/floating/LockFloatingPosition/LockFloatingPosition.js +0 -6
  58. package/dist/cssm/lib/floating/LockFloatingPosition/LockFloatingPosition.js.map +0 -1
  59. package/dist/lib/floating/LockFloatingPosition/LockFloatingPosition.d.ts +0 -6
  60. package/dist/lib/floating/LockFloatingPosition/LockFloatingPosition.d.ts.map +0 -1
  61. package/dist/lib/floating/LockFloatingPosition/LockFloatingPosition.js +0 -6
  62. package/dist/lib/floating/LockFloatingPosition/LockFloatingPosition.js.map +0 -1
  63. package/src/components/Flex/FlexItem/FlexItem.module.css +0 -17
  64. package/src/components/Flex/FlexItem/FlexItem.module.css.d.ts.map +0 -1
  65. package/src/lib/floating/LockFloatingPosition/LockFloatingPosition.tsx +0 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "8.1.1",
3
+ "version": "8.1.3",
4
4
  "name": "@vkontakte/vkui",
5
5
  "description": "VKUI library",
6
6
  "module": "./dist/index.js",
@@ -1,15 +1,8 @@
1
+ import { getRequiredValueByKey } from '../../../helpers/getValueByKey';
1
2
  import { type LayoutProps, resolveLayoutProps } from '../../../lib/layouts';
2
3
  import { warnOnce } from '../../../lib/warnOnce';
3
4
  import { RootComponent } from '../../RootComponent/RootComponent';
4
5
  import type { RootComponentProps } from '../../RootComponent/RootComponent';
5
- import styles from './FlexItem.module.css';
6
-
7
- const flexClassNames = {
8
- grow: styles.flexGrow,
9
- shrink: styles.flexShrink,
10
- content: styles.flexContent,
11
- fixed: styles.flexFixed,
12
- };
13
6
 
14
7
  export type FlexItemProps = RootComponentProps<HTMLElement> &
15
8
  Pick<LayoutProps, 'alignSelf' | 'justifySelf' | 'flexBasis'> & {
@@ -24,14 +17,48 @@ export type FlexItemProps = RootComponentProps<HTMLElement> &
24
17
  flex?: 'grow' | 'shrink' | 'content' | 'fixed' | undefined;
25
18
  };
26
19
 
20
+ const resolveFlexProps = (flex: FlexItemProps['flex'], flexBasis: FlexItemProps['flexBasis']) => {
21
+ const overrideProps = flexBasis !== undefined ? { flexBasis } : {};
22
+ if (!flex) {
23
+ return overrideProps;
24
+ }
25
+ return {
26
+ ...getRequiredValueByKey<Pick<LayoutProps, 'flexGrow' | 'flexShrink' | 'flexBasis'>>(flex, {
27
+ grow: {
28
+ flexGrow: 1,
29
+ flexShrink: 0,
30
+ flexBasis: 'auto',
31
+ },
32
+ shrink: {
33
+ flexGrow: 0,
34
+ flexShrink: 1,
35
+ flexBasis: 'auto',
36
+ },
37
+ content: {
38
+ flexGrow: 1,
39
+ flexShrink: 1,
40
+ flexBasis: 'auto',
41
+ },
42
+ fixed: {
43
+ flexGrow: 0,
44
+ flexShrink: 0,
45
+ flexBasis: 'auto',
46
+ },
47
+ }),
48
+ ...overrideProps,
49
+ };
50
+ };
51
+
27
52
  const warn = warnOnce('Flex.Item');
28
53
 
29
- export const FlexItem = ({ flex, ...restProps }: FlexItemProps): React.ReactNode => {
54
+ export const FlexItem = ({ flex, flexBasis, ...restProps }: FlexItemProps): React.ReactNode => {
30
55
  if (process.env.NODE_ENV === 'development') {
31
56
  warn('Компонент Flex.Item устарел, используйте компонент Box в качестве альтернативы.');
32
57
  }
33
58
 
34
- const resolvedProps = resolveLayoutProps(restProps);
59
+ const flexProps = resolveFlexProps(flex, flexBasis);
60
+
61
+ const resolvedProps = resolveLayoutProps({ ...restProps, ...flexProps });
35
62
 
36
- return <RootComponent baseClassName={flex && flexClassNames[flex]} {...resolvedProps} />;
63
+ return <RootComponent {...resolvedProps} />;
37
64
  };
@@ -5,22 +5,26 @@ import * as React from 'react';
5
5
 
6
6
  export interface TransitionContextProps {
7
7
  entering: boolean;
8
+ animating: boolean;
8
9
  }
9
10
  const TransitionContext = React.createContext<TransitionContextProps>({
10
11
  entering: false,
12
+ animating: false,
11
13
  });
12
14
  export const useNavTransition = (): TransitionContextProps => React.useContext(TransitionContext);
13
15
 
14
16
  export const NavTransitionProvider = ({
15
17
  children,
16
18
  entering,
19
+ animating,
17
20
  }: React.PropsWithChildren<TransitionContextProps>): React.ReactNode => {
18
21
  const parentContext = useNavTransition();
19
22
  const contextValue = React.useMemo(
20
23
  () => ({
21
24
  entering: parentContext.entering || entering,
25
+ animating: parentContext.animating || animating,
22
26
  }),
23
- [entering, parentContext.entering],
27
+ [entering, animating, parentContext.entering, parentContext.animating],
24
28
  );
25
29
 
26
30
  return <TransitionContext.Provider value={contextValue}>{children}</TransitionContext.Provider>;
@@ -15,7 +15,6 @@ import {
15
15
  useFloatingMiddlewaresBootstrap,
16
16
  usePlacementChangeCallback,
17
17
  } from '../../lib/floating';
18
- import { LockFloatingPositionContext } from '../../lib/floating/LockFloatingPosition/LockFloatingPosition';
19
18
  import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
20
19
  import { warnOnce } from '../../lib/warnOnce';
21
20
  import { DEFAULT_ARROW_HEIGHT, DEFAULT_ARROW_PADDING } from '../FloatingArrow/DefaultIcon';
@@ -118,7 +117,7 @@ export const OnboardingTooltip = ({
118
117
  }: OnboardingTooltipProps): React.ReactNode => {
119
118
  const generatedId = React.useId();
120
119
  const tooltipId = idProp || generatedId;
121
- const { entering } = useNavTransition();
120
+ const { entering, animating } = useNavTransition();
122
121
 
123
122
  const [arrowRef, setArrowRef] = React.useState<HTMLDivElement | null>(null);
124
123
  const [tooltipContainer, setTooltipContainer] = React.useState<HTMLElement | null>(null);
@@ -138,8 +137,6 @@ export const OnboardingTooltip = ({
138
137
  overflowPadding,
139
138
  });
140
139
 
141
- const isLock = React.useContext(LockFloatingPositionContext);
142
-
143
140
  const {
144
141
  x: floatingDataX,
145
142
  y: floatingDataY,
@@ -151,7 +148,7 @@ export const OnboardingTooltip = ({
151
148
  strategy: positionStrategy,
152
149
  ...(strictPlacement !== undefined && { placement: strictPlacement }),
153
150
  middleware: middlewares,
154
- ...(!isLock && {
151
+ ...(!animating && {
155
152
  whileElementsMounted: (...args) =>
156
153
  autoUpdateFloatingElement(...args, { elementResize: true }),
157
154
  }),
@@ -12,7 +12,6 @@ import {
12
12
  usePlacementChangeCallback,
13
13
  type VirtualElement,
14
14
  } from '../../lib/floating';
15
- import { LockFloatingPositionContext } from '../../lib/floating/LockFloatingPosition/LockFloatingPosition';
16
15
  import { useReferenceHiddenChangeCallback } from '../../lib/floating/useReferenceHiddenChangeCallback';
17
16
  import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
18
17
  import type { HTMLAttributesWithRootRef } from '../../types';
@@ -26,6 +25,7 @@ import {
26
25
  FloatingArrow,
27
26
  type FloatingArrowProps as FloatingArrowPropsPrivate,
28
27
  } from '../FloatingArrow/FloatingArrow';
28
+ import { useNavTransition } from '../NavTransitionContext/NavTransitionContext';
29
29
  import { RootComponent } from '../RootComponent/RootComponent';
30
30
  import styles from './Popper.module.css';
31
31
 
@@ -138,6 +138,7 @@ export const Popper = ({
138
138
  style,
139
139
  ...restProps
140
140
  }: PopperProps): React.ReactNode => {
141
+ const { entering, animating } = useNavTransition();
141
142
  const [arrowRef, setArrowRef] = React.useState<HTMLDivElement | null>(null);
142
143
 
143
144
  const { strictPlacement, middlewares } = useFloatingMiddlewaresBootstrap({
@@ -157,8 +158,6 @@ export const Popper = ({
157
158
  overflowPadding,
158
159
  });
159
160
 
160
- const isLock = React.useContext(LockFloatingPositionContext);
161
-
162
161
  const {
163
162
  x: floatingDataX,
164
163
  y: floatingDataY,
@@ -170,7 +169,7 @@ export const Popper = ({
170
169
  ...(strictPlacement !== undefined && { placement: strictPlacement }),
171
170
  ...(strategyProp !== undefined && { strategy: strategyProp }),
172
171
  middleware: middlewares,
173
- ...(isLock
172
+ ...(animating
174
173
  ? {}
175
174
  : {
176
175
  whileElementsMounted: (...args) => {
@@ -229,5 +228,9 @@ export const Popper = ({
229
228
  </RootComponent>
230
229
  );
231
230
 
231
+ if (entering) {
232
+ return null;
233
+ }
234
+
232
235
  return <AppRootPortal usePortal={usePortal}>{dropdown}</AppRootPortal>;
233
236
  };
@@ -4,7 +4,6 @@ import * as React from 'react';
4
4
  import { classNames } from '@vkontakte/vkjs';
5
5
  import { usePlatform } from '../../hooks/usePlatform';
6
6
  import { useDOM } from '../../lib/dom';
7
- import { LockFloatingPositionContext } from '../../lib/floating/LockFloatingPosition/LockFloatingPosition';
8
7
  import { getNavId, type NavIdProps } from '../../lib/getNavId';
9
8
  import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
10
9
  import { warnOnce } from '../../lib/warnOnce';
@@ -124,56 +123,55 @@ export const Root = ({
124
123
  };
125
124
 
126
125
  return (
127
- <LockFloatingPositionContext.Provider value={transition}>
128
- <RootComponent
129
- {...restProps}
130
- baseClassName={classNames(
131
- styles.host,
132
- platform === 'ios' && styles.ios,
133
- transition && styles.transition,
134
- )}
135
- >
136
- {views.map((view) => {
137
- const viewId = getNavId(view.props, warn);
138
- if (viewId !== activeView && !(transition && viewId === prevView)) {
139
- return null;
140
- }
141
- const isTransitionTarget = transition && viewId === (isBack ? prevView : activeView);
142
- const compensateScroll =
143
- transition && (viewId === prevView || (isBack && viewId === activeView));
144
- return (
145
- <div
146
- key={viewId}
147
- ref={(e) => {
148
- viewId && viewNodes.set(viewId, e);
149
- }}
150
- onAnimationEnd={isTransitionTarget ? onAnimationEnd : undefined}
151
- className={classNames(
152
- styles.view,
153
- transition && viewId === prevView && isBack && styles.viewHideBack,
154
- transition && viewId === prevView && !isBack && styles.viewHideForward,
155
- transition && viewId === activeView && isBack && styles.viewShowBack,
156
- transition && viewId === activeView && !isBack && styles.viewShowForward,
157
- )}
158
- >
159
- <NavTransitionDirectionProvider isBack={isBack}>
160
- <NavTransitionProvider entering={transition && viewId === activeView}>
161
- <div
162
- className={styles.scrollCompensation}
163
- style={{
164
- marginTop: compensateScroll
165
- ? viewId && -(scrolls.get(viewId) ?? 0)
166
- : undefined,
167
- }}
168
- >
169
- {view}
170
- </div>
171
- </NavTransitionProvider>
172
- </NavTransitionDirectionProvider>
173
- </div>
174
- );
175
- })}
176
- </RootComponent>
177
- </LockFloatingPositionContext.Provider>
126
+ <RootComponent
127
+ {...restProps}
128
+ baseClassName={classNames(
129
+ styles.host,
130
+ platform === 'ios' && styles.ios,
131
+ transition && styles.transition,
132
+ )}
133
+ >
134
+ {views.map((view) => {
135
+ const viewId = getNavId(view.props, warn);
136
+ if (viewId !== activeView && !(transition && viewId === prevView)) {
137
+ return null;
138
+ }
139
+ const isTransitionTarget = transition && viewId === (isBack ? prevView : activeView);
140
+ const compensateScroll =
141
+ transition && (viewId === prevView || (isBack && viewId === activeView));
142
+ return (
143
+ <div
144
+ key={viewId}
145
+ ref={(e) => {
146
+ viewId && viewNodes.set(viewId, e);
147
+ }}
148
+ onAnimationEnd={isTransitionTarget ? onAnimationEnd : undefined}
149
+ className={classNames(
150
+ styles.view,
151
+ transition && viewId === prevView && isBack && styles.viewHideBack,
152
+ transition && viewId === prevView && !isBack && styles.viewHideForward,
153
+ transition && viewId === activeView && isBack && styles.viewShowBack,
154
+ transition && viewId === activeView && !isBack && styles.viewShowForward,
155
+ )}
156
+ >
157
+ <NavTransitionDirectionProvider isBack={isBack}>
158
+ <NavTransitionProvider
159
+ entering={transition && viewId === activeView}
160
+ animating={transition}
161
+ >
162
+ <div
163
+ className={styles.scrollCompensation}
164
+ style={{
165
+ marginTop: compensateScroll ? viewId && -(scrolls.get(viewId) ?? 0) : undefined,
166
+ }}
167
+ >
168
+ {view}
169
+ </div>
170
+ </NavTransitionProvider>
171
+ </NavTransitionDirectionProvider>
172
+ </div>
173
+ );
174
+ })}
175
+ </RootComponent>
178
176
  );
179
177
  };
@@ -5,7 +5,6 @@ import { classNames } from '@vkontakte/vkjs';
5
5
  import { usePlatform } from '../../hooks/usePlatform';
6
6
  import { millisecondsInSecond } from '../../lib/date';
7
7
  import { blurActiveElement, useDOM } from '../../lib/dom';
8
- import { LockFloatingPositionContext } from '../../lib/floating/LockFloatingPosition/LockFloatingPosition';
9
8
  import { getNavId, type NavIdProps } from '../../lib/getNavId';
10
9
  import { warnOnce } from '../../lib/warnOnce';
11
10
  import type { HTMLAttributesWithRootRef } from '../../types';
@@ -457,96 +456,91 @@ export const View = ({
457
456
 
458
457
  return (
459
458
  <NavViewIdContext.Provider value={id}>
460
- <LockFloatingPositionContext.Provider value={swipingBack || animated}>
461
- <Touch
462
- Component="section"
463
- {...restProps}
464
- className={classNames(
465
- styles.host,
466
- platform === 'ios' && classNames(styles.ios, 'vkuiInternalView--ios'),
467
- !disableAnimation && animated && styles.animated,
468
- !disableAnimation && swipingBack && styles.swipingBack,
469
- disableAnimation && styles.noMotion,
470
- className,
471
- )}
472
- onMoveX={
473
- iOSSwipeBackSimulationEnabled
474
- ? handleTouchMoveXForIOSSwipeBackSimulation
475
- : platform === 'ios'
476
- ? handleTouchMoveXForNativeIOSSwipeBackOrSwipeNext
477
- : undefined
478
- }
479
- onEnd={
480
- iOSSwipeBackSimulationEnabled ? handleTouchEndForIOSSwipeBackSimulation : undefined
481
- }
482
- >
483
- <div className={styles.panels}>
484
- {panels.map((panel) => {
485
- const panelId = getNavId(panel.props, warn);
486
-
487
- const isPanelActive = panelId === activePanel;
488
- const isPanelPrev = panelId === prevPanel;
489
- const isPanelNext = panelId === nextPanel;
490
- const isAnimatedTarget = animated && (isBack ? isPanelPrev : isPanelNext);
491
-
492
- const isSwipeBackPrev = panelId === swipeBackPrevPanel;
493
- const isSwipeBackNext = panelId === swipeBackNextPanel;
494
- const isSwipeBackTarget = swipeBackResult && isSwipeBackPrev;
495
-
496
- let scrollCompensateStyle: React.CSSProperties | undefined = undefined;
497
-
498
- if (isPanelPrev || (isPanelNext && isBack) || isSwipeBackPrev || isSwipeBackNext) {
499
- const marginTop = scrolls.get(panelId);
500
- if (marginTop !== undefined) {
501
- scrollCompensateStyle = { marginTop: -1 * marginTop };
502
- }
459
+ <Touch
460
+ Component="section"
461
+ {...restProps}
462
+ className={classNames(
463
+ styles.host,
464
+ platform === 'ios' && classNames(styles.ios, 'vkuiInternalView--ios'),
465
+ !disableAnimation && animated && styles.animated,
466
+ !disableAnimation && swipingBack && styles.swipingBack,
467
+ disableAnimation && styles.noMotion,
468
+ className,
469
+ )}
470
+ onMoveX={
471
+ iOSSwipeBackSimulationEnabled
472
+ ? handleTouchMoveXForIOSSwipeBackSimulation
473
+ : platform === 'ios'
474
+ ? handleTouchMoveXForNativeIOSSwipeBackOrSwipeNext
475
+ : undefined
476
+ }
477
+ onEnd={iOSSwipeBackSimulationEnabled ? handleTouchEndForIOSSwipeBackSimulation : undefined}
478
+ >
479
+ <div className={styles.panels}>
480
+ {panels.map((panel) => {
481
+ const panelId = getNavId(panel.props, warn);
482
+
483
+ const isPanelActive = panelId === activePanel;
484
+ const isPanelPrev = panelId === prevPanel;
485
+ const isPanelNext = panelId === nextPanel;
486
+ const isAnimatedTarget = animated && (isBack ? isPanelPrev : isPanelNext);
487
+
488
+ const isSwipeBackPrev = panelId === swipeBackPrevPanel;
489
+ const isSwipeBackNext = panelId === swipeBackNextPanel;
490
+ const isSwipeBackTarget = swipeBackResult && isSwipeBackPrev;
491
+
492
+ let scrollCompensateStyle: React.CSSProperties | undefined = undefined;
493
+
494
+ if (isPanelPrev || (isPanelNext && isBack) || isSwipeBackPrev || isSwipeBackNext) {
495
+ const marginTop = scrolls.get(panelId);
496
+ if (marginTop !== undefined) {
497
+ scrollCompensateStyle = { marginTop: -1 * marginTop };
503
498
  }
504
-
505
- return (
506
- <div
507
- className={classNames(
508
- styles.panel,
509
-
510
- isPanelActive && styles.panelActive,
511
- isPanelPrev && styles.panelPrev,
512
- isPanelNext && styles.panelNext,
513
-
514
- isSwipeBackPrev && styles.panelSwipeBackPrev,
515
- isSwipeBackNext && styles.panelSwipeBackNext,
516
- swipeBackResult === 'success' && styles.panelSwipeBackSuccess,
517
- swipeBackResult === 'fail' && styles.panelSwipeBackFailed,
518
- )}
519
- onTransitionEnd={
520
- isSwipeBackTarget ? handleSwipeBackTargetTransitionEnd : undefined
521
- }
522
- onAnimationEnd={isAnimatedTarget ? handleAnimatedTargetAnimationEnd : undefined}
523
- ref={(el) => {
524
- panelId !== undefined && (panelNodes.current[panelId] = el);
525
- }}
526
- style={calcPanelSwipeStyles(isSwipeBackPrev, isSwipeBackNext)}
527
- key={panelId}
528
- >
529
- {platform === 'ios' && (
530
- <div
531
- className={styles.panelOverlay}
532
- style={calcPanelSwipeBackOverlayStyles(isSwipeBackNext)}
533
- />
534
- )}
535
- <div className={styles.panelIn} style={scrollCompensateStyle}>
536
- <NavTransitionDirectionProvider isBack={swipingBack || isBack}>
537
- <NavTransitionProvider
538
- entering={panelId === nextPanel || panelId === swipeBackNextPanel}
539
- >
540
- {panel}
541
- </NavTransitionProvider>
542
- </NavTransitionDirectionProvider>
543
- </div>
499
+ }
500
+
501
+ return (
502
+ <div
503
+ className={classNames(
504
+ styles.panel,
505
+
506
+ isPanelActive && styles.panelActive,
507
+ isPanelPrev && styles.panelPrev,
508
+ isPanelNext && styles.panelNext,
509
+
510
+ isSwipeBackPrev && styles.panelSwipeBackPrev,
511
+ isSwipeBackNext && styles.panelSwipeBackNext,
512
+ swipeBackResult === 'success' && styles.panelSwipeBackSuccess,
513
+ swipeBackResult === 'fail' && styles.panelSwipeBackFailed,
514
+ )}
515
+ onTransitionEnd={isSwipeBackTarget ? handleSwipeBackTargetTransitionEnd : undefined}
516
+ onAnimationEnd={isAnimatedTarget ? handleAnimatedTargetAnimationEnd : undefined}
517
+ ref={(el) => {
518
+ panelId !== undefined && (panelNodes.current[panelId] = el);
519
+ }}
520
+ style={calcPanelSwipeStyles(isSwipeBackPrev, isSwipeBackNext)}
521
+ key={panelId}
522
+ >
523
+ {platform === 'ios' && (
524
+ <div
525
+ className={styles.panelOverlay}
526
+ style={calcPanelSwipeBackOverlayStyles(isSwipeBackNext)}
527
+ />
528
+ )}
529
+ <div className={styles.panelIn} style={scrollCompensateStyle}>
530
+ <NavTransitionDirectionProvider isBack={swipingBack || isBack}>
531
+ <NavTransitionProvider
532
+ entering={panelId === nextPanel || panelId === swipeBackNextPanel}
533
+ animating={swipingBack || animated}
534
+ >
535
+ {panel}
536
+ </NavTransitionProvider>
537
+ </NavTransitionDirectionProvider>
544
538
  </div>
545
- );
546
- })}
547
- </div>
548
- </Touch>
549
- </LockFloatingPositionContext.Provider>
539
+ </div>
540
+ );
541
+ })}
542
+ </div>
543
+ </Touch>
550
544
  </NavViewIdContext.Provider>
551
545
  );
552
546
  };