react-panel-layout 0.6.0 → 0.6.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.
Files changed (216) hide show
  1. package/dist/{FloatingPanelFrame-SgYLc6Ud.js → FloatingPanelFrame-3eU9AwPo.js} +2 -2
  2. package/dist/{FloatingPanelFrame-SgYLc6Ud.js.map → FloatingPanelFrame-3eU9AwPo.js.map} +1 -1
  3. package/dist/FloatingWindow-CUXnEtrb.js +827 -0
  4. package/dist/FloatingWindow-CUXnEtrb.js.map +1 -0
  5. package/dist/FloatingWindow-DMwyK0eK.cjs +2 -0
  6. package/dist/FloatingWindow-DMwyK0eK.cjs.map +1 -0
  7. package/dist/GridLayout-DKTg_N61.cjs +2 -0
  8. package/dist/{GridLayout-B4VRsC0r.cjs.map → GridLayout-DKTg_N61.cjs.map} +1 -1
  9. package/dist/{GridLayout-BltqeCPK.js → GridLayout-UWNxXw77.js} +34 -35
  10. package/dist/{GridLayout-BltqeCPK.js.map → GridLayout-UWNxXw77.js.map} +1 -1
  11. package/dist/{HorizontalDivider-WF1k_qND.js → HorizontalDivider-DdxzfV0l.js} +3 -3
  12. package/dist/{HorizontalDivider-WF1k_qND.js.map → HorizontalDivider-DdxzfV0l.js.map} +1 -1
  13. package/dist/{HorizontalDivider-B5Z-KZLk.cjs → HorizontalDivider-_pgV4Mcv.cjs} +2 -2
  14. package/dist/{HorizontalDivider-B5Z-KZLk.cjs.map → HorizontalDivider-_pgV4Mcv.cjs.map} +1 -1
  15. package/dist/{PanelSystem-Dr1TBhxM.js → PanelSystem-BqUzNtf2.js} +5 -5
  16. package/dist/{PanelSystem-Dr1TBhxM.js.map → PanelSystem-BqUzNtf2.js.map} +1 -1
  17. package/dist/{PanelSystem-Bs8bQwQF.cjs → PanelSystem-D603LKKv.cjs} +2 -2
  18. package/dist/{PanelSystem-Bs8bQwQF.cjs.map → PanelSystem-D603LKKv.cjs.map} +1 -1
  19. package/dist/ResizeHandle-CBcAS918.cjs +2 -0
  20. package/dist/{ResizeHandle-CScipO5l.cjs.map → ResizeHandle-CBcAS918.cjs.map} +1 -1
  21. package/dist/{ResizeHandle-CdA_JYfN.js → ResizeHandle-CXjc1meV.js} +28 -29
  22. package/dist/{ResizeHandle-CdA_JYfN.js.map → ResizeHandle-CXjc1meV.js.map} +1 -1
  23. package/dist/SwipePivotTabBar-DWrCuwEI.js +411 -0
  24. package/dist/SwipePivotTabBar-DWrCuwEI.js.map +1 -0
  25. package/dist/SwipePivotTabBar-fjjXkpj7.cjs +2 -0
  26. package/dist/SwipePivotTabBar-fjjXkpj7.cjs.map +1 -0
  27. package/dist/components/gesture/SwipeSafeZone.d.ts +40 -0
  28. package/dist/components/window/Drawer.d.ts +3 -1
  29. package/dist/components/window/DrawerLayers.d.ts +1 -1
  30. package/dist/components/window/drawerStyles.d.ts +69 -0
  31. package/dist/components/window/drawerSwipeConfig.d.ts +29 -0
  32. package/dist/components/window/useDrawerSwipeTransform.d.ts +23 -0
  33. package/dist/config.cjs +1 -1
  34. package/dist/config.js +3 -3
  35. package/dist/constants/styles.d.ts +17 -0
  36. package/dist/dialog/index.d.ts +69 -0
  37. package/dist/floating.js +1 -1
  38. package/dist/grid.cjs +1 -1
  39. package/dist/grid.js +2 -2
  40. package/dist/hooks/gesture/testing/createGestureSimulator.d.ts +7 -0
  41. package/dist/hooks/gesture/types.d.ts +48 -5
  42. package/dist/hooks/gesture/utils.d.ts +19 -0
  43. package/dist/hooks/useAnimationFrame.d.ts +2 -0
  44. package/dist/hooks/useOperationContinuity.d.ts +64 -0
  45. package/dist/hooks/useResizeObserver.d.ts +33 -1
  46. package/dist/hooks/useSharedElementTransition.d.ts +112 -0
  47. package/dist/hooks/useSwipeContentTransform.d.ts +9 -2
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.js +7 -7
  50. package/dist/modules/dialog/AlertDialog.d.ts +9 -0
  51. package/dist/modules/dialog/DialogContainer.d.ts +37 -0
  52. package/dist/modules/dialog/Modal.d.ts +26 -0
  53. package/dist/modules/dialog/SwipeDialogContainer.d.ts +16 -0
  54. package/dist/modules/dialog/dialogAnimationUtils.d.ts +113 -0
  55. package/dist/modules/dialog/types.d.ts +183 -0
  56. package/dist/modules/dialog/useDialog.d.ts +39 -0
  57. package/dist/modules/dialog/useDialogContainer.d.ts +47 -0
  58. package/dist/modules/dialog/useDialogSwipeInput.d.ts +70 -0
  59. package/dist/modules/dialog/useDialogTransform.d.ts +82 -0
  60. package/dist/modules/drawer/types.d.ts +74 -0
  61. package/dist/modules/drawer/useDrawerSwipeInput.d.ts +24 -0
  62. package/dist/modules/pivot/SwipePivotTabBar.d.ts +3 -0
  63. package/dist/modules/stack/SwipeStackContent.d.ts +6 -3
  64. package/dist/modules/stack/SwipeStackOutlet.d.ts +4 -4
  65. package/dist/modules/stack/computeSwipeStackTransform.d.ts +1 -1
  66. package/dist/panels.cjs +1 -1
  67. package/dist/panels.js +1 -1
  68. package/dist/pivot.cjs +1 -1
  69. package/dist/pivot.js +1 -1
  70. package/dist/resizer.cjs +1 -1
  71. package/dist/resizer.js +2 -2
  72. package/dist/stack.cjs +1 -1
  73. package/dist/stack.cjs.map +1 -1
  74. package/dist/stack.js +503 -762
  75. package/dist/stack.js.map +1 -1
  76. package/dist/sticky-header/calculateStickyMetrics.d.ts +28 -0
  77. package/dist/sticky-header.cjs +1 -1
  78. package/dist/sticky-header.cjs.map +1 -1
  79. package/dist/sticky-header.js +59 -51
  80. package/dist/sticky-header.js.map +1 -1
  81. package/dist/{styles-DPPuJ0sf.js → styles-NkjuMOVS.js} +13 -13
  82. package/dist/{styles-DPPuJ0sf.js.map → styles-NkjuMOVS.js.map} +1 -1
  83. package/dist/styles-qf6ptVLD.cjs.map +1 -1
  84. package/dist/types.d.ts +16 -0
  85. package/dist/useDocumentPointerEvents-DXxw3qWj.js +54 -0
  86. package/dist/useDocumentPointerEvents-DXxw3qWj.js.map +1 -0
  87. package/dist/useDocumentPointerEvents-DxDSOtip.cjs +2 -0
  88. package/dist/useDocumentPointerEvents-DxDSOtip.cjs.map +1 -0
  89. package/dist/useNativeGestureGuard-C7TSqEkr.cjs +2 -0
  90. package/dist/useNativeGestureGuard-C7TSqEkr.cjs.map +1 -0
  91. package/dist/useNativeGestureGuard-CGYo6O0r.js +347 -0
  92. package/dist/useNativeGestureGuard-CGYo6O0r.js.map +1 -0
  93. package/dist/window/index.d.ts +2 -0
  94. package/dist/window.cjs +1 -1
  95. package/dist/window.cjs.map +1 -1
  96. package/dist/window.js +114 -103
  97. package/dist/window.js.map +1 -1
  98. package/package.json +6 -1
  99. package/src/components/gesture/SwipeSafeZone.tsx +69 -0
  100. package/src/components/window/Drawer.tsx +249 -162
  101. package/src/components/window/DrawerLayers.tsx +13 -3
  102. package/src/components/window/drawerStyles.spec.ts +263 -0
  103. package/src/components/window/drawerStyles.ts +228 -0
  104. package/src/components/window/drawerSwipeConfig.spec.ts +131 -0
  105. package/src/components/window/drawerSwipeConfig.ts +112 -0
  106. package/src/components/window/useDrawerSwipeTransform.spec.ts +234 -0
  107. package/src/components/window/useDrawerSwipeTransform.ts +129 -0
  108. package/src/constants/styles.ts +19 -0
  109. package/src/demo/pages/Dialog/alerts/index.tsx +22 -0
  110. package/src/demo/pages/Dialog/card/index.tsx +22 -0
  111. package/src/demo/pages/Dialog/components/AlertDialogDemo.tsx +124 -0
  112. package/src/demo/pages/Dialog/components/CardExpandDemo.module.css +243 -0
  113. package/src/demo/pages/Dialog/components/CardExpandDemo.tsx +204 -0
  114. package/src/demo/pages/Dialog/components/CustomAlertDialogDemo.tsx +219 -0
  115. package/src/demo/pages/Dialog/components/DialogDemos.module.css +77 -0
  116. package/src/demo/pages/Dialog/components/ModalBasics.tsx +45 -0
  117. package/src/demo/pages/Dialog/components/SwipeDialogDemo.module.css +77 -0
  118. package/src/demo/pages/Dialog/components/SwipeDialogDemo.tsx +181 -0
  119. package/src/demo/pages/Dialog/custom-alert/index.tsx +22 -0
  120. package/src/demo/pages/Dialog/modal/index.tsx +17 -0
  121. package/src/demo/pages/Dialog/swipe/index.tsx +22 -0
  122. package/src/demo/pages/Drawer/components/DrawerSwipe.module.css +316 -0
  123. package/src/demo/pages/Drawer/components/DrawerSwipe.tsx +178 -0
  124. package/src/demo/pages/Drawer/swipe/index.tsx +17 -0
  125. package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +54 -23
  126. package/src/demo/pages/Pivot/swipe-debug/index.tsx +1 -1
  127. package/src/demo/pages/Stack/components/StackBasics.spec.tsx +152 -0
  128. package/src/demo/pages/Stack/components/StackBasics.tsx +179 -95
  129. package/src/demo/pages/Stack/components/StackTablet.spec.tsx +120 -0
  130. package/src/demo/pages/Stack/components/StackTablet.tsx +42 -21
  131. package/src/demo/routes.tsx +22 -1
  132. package/src/dialog/index.ts +85 -0
  133. package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +68 -64
  134. package/src/hooks/gesture/testing/createGestureSimulator.ts +112 -37
  135. package/src/hooks/gesture/types.ts +83 -6
  136. package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +22 -14
  137. package/src/hooks/gesture/useNativeGestureGuard.spec.ts +91 -31
  138. package/src/hooks/gesture/useNativeGestureGuard.ts +3 -1
  139. package/src/hooks/gesture/utils.ts +91 -0
  140. package/src/hooks/useAnimatedVisibility.spec.ts +44 -24
  141. package/src/hooks/useAnimatedVisibility.ts +28 -2
  142. package/src/hooks/useAnimationFrame.ts +8 -0
  143. package/src/hooks/useOperationContinuity.spec.ts +387 -0
  144. package/src/hooks/useOperationContinuity.ts +135 -0
  145. package/src/hooks/useResizeObserver.spec.tsx +277 -0
  146. package/src/hooks/useResizeObserver.tsx +108 -39
  147. package/src/hooks/useScrollContainer.ts +4 -10
  148. package/src/hooks/useSharedElementTransition.ts +333 -0
  149. package/src/hooks/useSwipeContentTransform.spec.ts +18 -18
  150. package/src/hooks/useSwipeContentTransform.ts +166 -28
  151. package/src/modules/dialog/AlertDialog.spec.tsx +387 -0
  152. package/src/modules/dialog/AlertDialog.tsx +221 -0
  153. package/src/modules/dialog/DialogContainer.spec.tsx +228 -0
  154. package/src/modules/dialog/DialogContainer.tsx +188 -0
  155. package/src/modules/dialog/Modal.spec.tsx +220 -0
  156. package/src/modules/dialog/Modal.tsx +182 -0
  157. package/src/modules/dialog/SwipeDialogContainer.tsx +208 -0
  158. package/src/modules/dialog/dialogAnimationUtils.spec.ts +253 -0
  159. package/src/modules/dialog/dialogAnimationUtils.ts +297 -0
  160. package/src/modules/dialog/types.ts +186 -0
  161. package/src/modules/dialog/useDialog.spec.tsx +447 -0
  162. package/src/modules/dialog/useDialog.ts +214 -0
  163. package/src/modules/dialog/useDialogContainer.spec.ts +331 -0
  164. package/src/modules/dialog/useDialogContainer.ts +150 -0
  165. package/src/modules/dialog/useDialogSwipeInput.spec.ts +157 -0
  166. package/src/modules/dialog/useDialogSwipeInput.ts +319 -0
  167. package/src/modules/dialog/useDialogTransform.spec.ts +370 -0
  168. package/src/modules/dialog/useDialogTransform.ts +407 -0
  169. package/src/modules/drawer/types.ts +102 -0
  170. package/src/modules/drawer/useDrawerSwipeInput.spec.ts +566 -0
  171. package/src/modules/drawer/useDrawerSwipeInput.ts +399 -0
  172. package/src/modules/panels/rendering/ContentRegistry.spec.tsx +21 -14
  173. package/src/modules/pivot/SwipePivotContent.position.spec.tsx +12 -8
  174. package/src/modules/pivot/SwipePivotContent.spec.tsx +55 -25
  175. package/src/modules/pivot/SwipePivotContent.tsx +2 -2
  176. package/src/modules/pivot/SwipePivotTabBar.spec.tsx +85 -68
  177. package/src/modules/pivot/SwipePivotTabBar.tsx +75 -15
  178. package/src/modules/pivot/scaleInputState.spec.ts +11 -2
  179. package/src/modules/pivot/usePivot.spec.ts +17 -3
  180. package/src/modules/pivot/usePivotSwipeInput.spec.ts +182 -123
  181. package/src/modules/stack/SwipeStackContent.spec.tsx +387 -100
  182. package/src/modules/stack/SwipeStackContent.tsx +43 -33
  183. package/src/modules/stack/SwipeStackOutlet.spec.tsx +14 -16
  184. package/src/modules/stack/SwipeStackOutlet.tsx +6 -6
  185. package/src/modules/stack/computeSwipeStackTransform.spec.ts +5 -5
  186. package/src/modules/stack/computeSwipeStackTransform.ts +3 -3
  187. package/src/modules/stack/swipeTransitionContinuity.spec.tsx +1133 -0
  188. package/src/modules/stack/useStackAnimationState.spec.ts +3 -1
  189. package/src/modules/stack/useStackAnimationState.ts +18 -13
  190. package/src/modules/stack/useStackNavigation.spec.ts +198 -3
  191. package/src/modules/stack/useStackNavigation.tsx +113 -56
  192. package/src/modules/stack/useStackSwipeInput.spec.ts +65 -32
  193. package/src/modules/stack/useStackSwipeInput.ts +1 -1
  194. package/src/sticky-header/StickyArea.tsx +29 -57
  195. package/src/sticky-header/calculateStickyMetrics.spec.ts +105 -0
  196. package/src/sticky-header/calculateStickyMetrics.ts +50 -0
  197. package/src/types.ts +18 -0
  198. package/src/window/index.ts +2 -0
  199. package/dist/FloatingWindow-BpdOpg_L.js +0 -400
  200. package/dist/FloatingWindow-BpdOpg_L.js.map +0 -1
  201. package/dist/FloatingWindow-TCDNY5gE.cjs +0 -2
  202. package/dist/FloatingWindow-TCDNY5gE.cjs.map +0 -1
  203. package/dist/GridLayout-B4VRsC0r.cjs +0 -2
  204. package/dist/ResizeHandle-CScipO5l.cjs +0 -2
  205. package/dist/SwipePivotTabBar-BGO9X94m.js +0 -407
  206. package/dist/SwipePivotTabBar-BGO9X94m.js.map +0 -1
  207. package/dist/SwipePivotTabBar-BrQismcZ.cjs +0 -2
  208. package/dist/SwipePivotTabBar-BrQismcZ.cjs.map +0 -1
  209. package/dist/useDocumentPointerEvents-CKdhGXd0.js +0 -46
  210. package/dist/useDocumentPointerEvents-CKdhGXd0.js.map +0 -1
  211. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs +0 -2
  212. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs.map +0 -1
  213. package/dist/useEffectEvent-Dp7HLCf0.js +0 -13
  214. package/dist/useEffectEvent-Dp7HLCf0.js.map +0 -1
  215. package/dist/useEffectEvent-huSsGUnl.cjs +0 -2
  216. package/dist/useEffectEvent-huSsGUnl.cjs.map +0 -1
@@ -8,67 +8,64 @@
8
8
  * 4. Button navigation: when navigationDepth changes without swipe, panels should animate
9
9
  */
10
10
  import { render, act } from "@testing-library/react";
11
- import { beforeEach, afterEach, vi } from "vitest";
12
11
  import { SwipeStackContent } from "./SwipeStackContent.js";
13
- import type { SwipeInputState } from "../../hooks/gesture/types.js";
12
+ import type { ContinuousOperationState } from "../../hooks/gesture/types.js";
14
13
 
15
14
  // Mock requestAnimationFrame for animation testing
16
- let rafCallbacks: FrameRequestCallback[] = [];
17
- let rafId = 0;
18
- let mockTimestamp = 0;
15
+ const rafState = {
16
+ callbacks: [] as FrameRequestCallback[],
17
+ id: 0,
18
+ mockTimestamp: 0,
19
+ originalRAF: globalThis.requestAnimationFrame,
20
+ originalCAF: globalThis.cancelAnimationFrame,
21
+ };
19
22
 
20
- const mockRAF = vi.fn((callback: FrameRequestCallback) => {
21
- rafCallbacks.push(callback);
22
- return ++rafId;
23
- });
23
+ const resetRafState = (): void => {
24
+ rafState.callbacks = [];
25
+ rafState.id = 0;
26
+ rafState.mockTimestamp = 0;
27
+ };
24
28
 
25
- const mockCAF = vi.fn(() => {
26
- // Cancel callback if needed
27
- });
29
+ const mockRAF = (callback: FrameRequestCallback): number => {
30
+ rafState.callbacks = [...rafState.callbacks, callback];
31
+ rafState.id += 1;
32
+ return rafState.id;
33
+ };
34
+
35
+ const mockCAF = (): void => {};
28
36
 
29
37
  /**
30
38
  * Flush all pending RAF callbacks.
31
39
  * @param advanceMs - How much to advance the mock timestamp (default: 400ms to complete 300ms animation)
32
40
  */
33
- const flushRAF = (advanceMs = 400) => {
34
- mockTimestamp += advanceMs;
35
- const callbacks = rafCallbacks;
36
- rafCallbacks = [];
37
- callbacks.forEach(cb => cb(mockTimestamp));
41
+ const flushRAF = (advanceMs = 400): void => {
42
+ rafState.mockTimestamp += advanceMs;
43
+ const callbacks = rafState.callbacks;
44
+ rafState.callbacks = [];
45
+ callbacks.forEach((cb) => cb(rafState.mockTimestamp));
38
46
  };
39
47
 
40
48
  beforeEach(() => {
41
- rafCallbacks = [];
42
- rafId = 0;
43
- mockTimestamp = 0;
44
- vi.stubGlobal("requestAnimationFrame", mockRAF);
45
- vi.stubGlobal("cancelAnimationFrame", mockCAF);
49
+ resetRafState();
50
+ globalThis.requestAnimationFrame = mockRAF;
51
+ globalThis.cancelAnimationFrame = mockCAF;
46
52
  });
47
53
 
48
54
  afterEach(() => {
49
- vi.unstubAllGlobals();
50
- vi.clearAllMocks();
55
+ globalThis.requestAnimationFrame = rafState.originalRAF;
56
+ globalThis.cancelAnimationFrame = rafState.originalCAF;
51
57
  });
52
58
 
53
- const IDLE_STATE: SwipeInputState = {
59
+ const IDLE_STATE: ContinuousOperationState = {
54
60
  phase: "idle",
55
61
  displacement: { x: 0, y: 0 },
56
62
  velocity: { x: 0, y: 0 },
57
- direction: 0,
58
63
  };
59
64
 
60
- const createSwipingState = (displacementX: number): SwipeInputState => ({
61
- phase: "swiping",
65
+ const createOperatingState = (displacementX: number): ContinuousOperationState => ({
66
+ phase: "operating",
62
67
  displacement: { x: displacementX, y: 0 },
63
68
  velocity: { x: 0.5, y: 0 },
64
- direction: displacementX > 0 ? 1 : displacementX < 0 ? -1 : 0,
65
- });
66
-
67
- const createTrackingState = (displacementX: number): SwipeInputState => ({
68
- phase: "tracking",
69
- displacement: { x: displacementX, y: 0 },
70
- velocity: { x: 0.1, y: 0 },
71
- direction: 0,
72
69
  });
73
70
 
74
71
  describe("SwipeStackContent", () => {
@@ -80,7 +77,7 @@ describe("SwipeStackContent", () => {
80
77
  depth={0}
81
78
  navigationDepth={0}
82
79
  isActive={true}
83
- inputState={IDLE_STATE}
80
+ operationState={IDLE_STATE}
84
81
  containerSize={400}
85
82
  >
86
83
  <div>Test Content</div>
@@ -97,7 +94,7 @@ describe("SwipeStackContent", () => {
97
94
  depth={1}
98
95
  navigationDepth={1}
99
96
  isActive={true}
100
- inputState={IDLE_STATE}
97
+ operationState={IDLE_STATE}
101
98
  containerSize={400}
102
99
  >
103
100
  Content
@@ -118,7 +115,7 @@ describe("SwipeStackContent", () => {
118
115
  depth={0}
119
116
  navigationDepth={1}
120
117
  isActive={false}
121
- inputState={IDLE_STATE}
118
+ operationState={IDLE_STATE}
122
119
  containerSize={400}
123
120
  >
124
121
  Content
@@ -138,7 +135,7 @@ describe("SwipeStackContent", () => {
138
135
  depth={1}
139
136
  navigationDepth={1}
140
137
  isActive={true}
141
- inputState={IDLE_STATE}
138
+ operationState={IDLE_STATE}
142
139
  containerSize={400}
143
140
  >
144
141
  Content
@@ -156,7 +153,7 @@ describe("SwipeStackContent", () => {
156
153
  depth={0}
157
154
  navigationDepth={1}
158
155
  isActive={false}
159
- inputState={IDLE_STATE}
156
+ operationState={IDLE_STATE}
160
157
  containerSize={400}
161
158
  >
162
159
  Content
@@ -174,7 +171,7 @@ describe("SwipeStackContent", () => {
174
171
  depth={0}
175
172
  navigationDepth={1}
176
173
  isActive={false}
177
- inputState={createSwipingState(100)}
174
+ operationState={createOperatingState(100)}
178
175
  containerSize={400}
179
176
  >
180
177
  Content
@@ -194,7 +191,7 @@ describe("SwipeStackContent", () => {
194
191
  depth={1}
195
192
  navigationDepth={1}
196
193
  isActive={true}
197
- inputState={IDLE_STATE}
194
+ operationState={IDLE_STATE}
198
195
  containerSize={400}
199
196
  >
200
197
  Content
@@ -208,7 +205,7 @@ describe("SwipeStackContent", () => {
208
205
  depth={1}
209
206
  navigationDepth={1}
210
207
  isActive={true}
211
- inputState={createSwipingState(150)}
208
+ operationState={createOperatingState(150)}
212
209
  containerSize={400}
213
210
  >
214
211
  Content
@@ -226,7 +223,7 @@ describe("SwipeStackContent", () => {
226
223
  depth={0}
227
224
  navigationDepth={1}
228
225
  isActive={false}
229
- inputState={IDLE_STATE}
226
+ operationState={IDLE_STATE}
230
227
  containerSize={400}
231
228
  >
232
229
  Content
@@ -240,7 +237,7 @@ describe("SwipeStackContent", () => {
240
237
  depth={0}
241
238
  navigationDepth={1}
242
239
  isActive={false}
243
- inputState={createSwipingState(200)}
240
+ operationState={createOperatingState(200)}
244
241
  containerSize={400}
245
242
  >
246
243
  Content
@@ -261,7 +258,7 @@ describe("SwipeStackContent", () => {
261
258
  depth={3}
262
259
  navigationDepth={3}
263
260
  isActive={true}
264
- inputState={IDLE_STATE}
261
+ operationState={IDLE_STATE}
265
262
  containerSize={400}
266
263
  >
267
264
  Content
@@ -281,7 +278,7 @@ describe("SwipeStackContent", () => {
281
278
  depth={1}
282
279
  navigationDepth={1}
283
280
  isActive={true}
284
- inputState={IDLE_STATE}
281
+ operationState={IDLE_STATE}
285
282
  containerSize={400}
286
283
  >
287
284
  Content
@@ -299,7 +296,7 @@ describe("SwipeStackContent", () => {
299
296
  depth={0}
300
297
  navigationDepth={1}
301
298
  isActive={false}
302
- inputState={IDLE_STATE}
299
+ operationState={IDLE_STATE}
303
300
  containerSize={400}
304
301
  >
305
302
  Content
@@ -319,7 +316,7 @@ describe("SwipeStackContent", () => {
319
316
  depth={1}
320
317
  navigationDepth={1}
321
318
  isActive={true}
322
- inputState={IDLE_STATE}
319
+ operationState={IDLE_STATE}
323
320
  containerSize={400}
324
321
  >
325
322
  Content
@@ -339,7 +336,7 @@ describe("SwipeStackContent", () => {
339
336
  depth={1}
340
337
  navigationDepth={1}
341
338
  isActive={true}
342
- inputState={createTrackingState(50)}
339
+ operationState={createOperatingState(50)}
343
340
  containerSize={400}
344
341
  >
345
342
  Content
@@ -355,7 +352,7 @@ describe("SwipeStackContent", () => {
355
352
  depth={1}
356
353
  navigationDepth={1}
357
354
  isActive={true}
358
- inputState={createSwipingState(100)}
355
+ operationState={createOperatingState(100)}
359
356
  containerSize={400}
360
357
  >
361
358
  Content
@@ -370,7 +367,7 @@ describe("SwipeStackContent", () => {
370
367
  depth={1}
371
368
  navigationDepth={1}
372
369
  isActive={true}
373
- inputState={createSwipingState(250)}
370
+ operationState={createOperatingState(250)}
374
371
  containerSize={400}
375
372
  >
376
373
  Content
@@ -386,7 +383,7 @@ describe("SwipeStackContent", () => {
386
383
  depth={0}
387
384
  navigationDepth={1}
388
385
  isActive={false}
389
- inputState={IDLE_STATE}
386
+ operationState={IDLE_STATE}
390
387
  containerSize={400}
391
388
  >
392
389
  Content
@@ -406,7 +403,7 @@ describe("SwipeStackContent", () => {
406
403
  depth={0}
407
404
  navigationDepth={1}
408
405
  isActive={false}
409
- inputState={createSwipingState(100)}
406
+ operationState={createOperatingState(100)}
410
407
  containerSize={400}
411
408
  >
412
409
  Content
@@ -423,7 +420,7 @@ describe("SwipeStackContent", () => {
423
420
  depth={0}
424
421
  navigationDepth={1}
425
422
  isActive={false}
426
- inputState={createSwipingState(200)}
423
+ operationState={createOperatingState(200)}
427
424
  containerSize={400}
428
425
  >
429
426
  Content
@@ -438,7 +435,7 @@ describe("SwipeStackContent", () => {
438
435
  depth={0}
439
436
  navigationDepth={1}
440
437
  isActive={false}
441
- inputState={createSwipingState(400)}
438
+ operationState={createOperatingState(400)}
442
439
  containerSize={400}
443
440
  >
444
441
  Content
@@ -454,7 +451,7 @@ describe("SwipeStackContent", () => {
454
451
  depth={1}
455
452
  navigationDepth={1}
456
453
  isActive={true}
457
- inputState={IDLE_STATE}
454
+ operationState={IDLE_STATE}
458
455
  containerSize={400}
459
456
  >
460
457
  Content
@@ -470,7 +467,7 @@ describe("SwipeStackContent", () => {
470
467
  depth={1}
471
468
  navigationDepth={1}
472
469
  isActive={true}
473
- inputState={createSwipingState(-100)}
470
+ operationState={createOperatingState(-100)}
474
471
  containerSize={400}
475
472
  >
476
473
  Content
@@ -488,7 +485,7 @@ describe("SwipeStackContent", () => {
488
485
  depth={1}
489
486
  navigationDepth={1}
490
487
  isActive={true}
491
- inputState={IDLE_STATE}
488
+ operationState={IDLE_STATE}
492
489
  containerSize={400}
493
490
  >
494
491
  Content
@@ -504,7 +501,7 @@ describe("SwipeStackContent", () => {
504
501
  depth={1}
505
502
  navigationDepth={1}
506
503
  isActive={true}
507
- inputState={createSwipingState(150)}
504
+ operationState={createOperatingState(150)}
508
505
  containerSize={400}
509
506
  >
510
507
  Content
@@ -519,7 +516,7 @@ describe("SwipeStackContent", () => {
519
516
  depth={1}
520
517
  navigationDepth={1}
521
518
  isActive={true}
522
- inputState={IDLE_STATE}
519
+ operationState={IDLE_STATE}
523
520
  containerSize={400}
524
521
  >
525
522
  Content
@@ -543,7 +540,7 @@ describe("SwipeStackContent", () => {
543
540
  depth={0}
544
541
  navigationDepth={1}
545
542
  isActive={false}
546
- inputState={IDLE_STATE}
543
+ operationState={IDLE_STATE}
547
544
  containerSize={400}
548
545
  >
549
546
  Content
@@ -559,7 +556,7 @@ describe("SwipeStackContent", () => {
559
556
  depth={0}
560
557
  navigationDepth={1}
561
558
  isActive={false}
562
- inputState={createSwipingState(200)}
559
+ operationState={createOperatingState(200)}
563
560
  containerSize={400}
564
561
  >
565
562
  Content
@@ -575,7 +572,7 @@ describe("SwipeStackContent", () => {
575
572
  depth={0}
576
573
  navigationDepth={1}
577
574
  isActive={false}
578
- inputState={IDLE_STATE}
575
+ operationState={IDLE_STATE}
579
576
  containerSize={400}
580
577
  >
581
578
  Content
@@ -601,7 +598,7 @@ describe("SwipeStackContent", () => {
601
598
  depth={0}
602
599
  navigationDepth={1}
603
600
  isActive={false}
604
- inputState={IDLE_STATE}
601
+ operationState={IDLE_STATE}
605
602
  containerSize={400}
606
603
  >
607
604
  Content
@@ -619,7 +616,7 @@ describe("SwipeStackContent", () => {
619
616
  depth={0}
620
617
  navigationDepth={0}
621
618
  isActive={true}
622
- inputState={IDLE_STATE}
619
+ operationState={IDLE_STATE}
623
620
  containerSize={400}
624
621
  >
625
622
  Content
@@ -647,7 +644,7 @@ describe("SwipeStackContent", () => {
647
644
  depth={1}
648
645
  navigationDepth={1}
649
646
  isActive={true}
650
- inputState={IDLE_STATE}
647
+ operationState={IDLE_STATE}
651
648
  containerSize={400}
652
649
  >
653
650
  Content
@@ -665,7 +662,7 @@ describe("SwipeStackContent", () => {
665
662
  depth={1}
666
663
  navigationDepth={0}
667
664
  isActive={false}
668
- inputState={IDLE_STATE}
665
+ operationState={IDLE_STATE}
669
666
  containerSize={400}
670
667
  >
671
668
  Content
@@ -697,7 +694,7 @@ describe("SwipeStackContent", () => {
697
694
  depth={1}
698
695
  navigationDepth={1}
699
696
  isActive={true}
700
- inputState={IDLE_STATE}
697
+ operationState={IDLE_STATE}
701
698
  containerSize={400}
702
699
  animateOnMount={true}
703
700
  >
@@ -729,7 +726,7 @@ describe("SwipeStackContent", () => {
729
726
  depth={1}
730
727
  navigationDepth={0}
731
728
  isActive={false}
732
- inputState={IDLE_STATE}
729
+ operationState={IDLE_STATE}
733
730
  containerSize={400}
734
731
  >
735
732
  Content
@@ -747,7 +744,7 @@ describe("SwipeStackContent", () => {
747
744
  depth={1}
748
745
  navigationDepth={1}
749
746
  isActive={true}
750
- inputState={IDLE_STATE}
747
+ operationState={IDLE_STATE}
751
748
  containerSize={400}
752
749
  >
753
750
  Content
@@ -775,7 +772,7 @@ describe("SwipeStackContent", () => {
775
772
  depth={0}
776
773
  navigationDepth={0}
777
774
  isActive={true}
778
- inputState={IDLE_STATE}
775
+ operationState={IDLE_STATE}
779
776
  containerSize={400}
780
777
  >
781
778
  Content
@@ -793,7 +790,7 @@ describe("SwipeStackContent", () => {
793
790
  depth={0}
794
791
  navigationDepth={1}
795
792
  isActive={false}
796
- inputState={IDLE_STATE}
793
+ operationState={IDLE_STATE}
797
794
  containerSize={400}
798
795
  >
799
796
  Content
@@ -828,7 +825,7 @@ describe("SwipeStackContent", () => {
828
825
  depth={1}
829
826
  navigationDepth={1}
830
827
  isActive={true}
831
- inputState={IDLE_STATE}
828
+ operationState={IDLE_STATE}
832
829
  containerSize={400}
833
830
  animateOnMount={true}
834
831
  >
@@ -857,7 +854,7 @@ describe("SwipeStackContent", () => {
857
854
  depth={1}
858
855
  navigationDepth={0}
859
856
  isActive={false}
860
- inputState={IDLE_STATE}
857
+ operationState={IDLE_STATE}
861
858
  containerSize={400}
862
859
  animateOnMount={true}
863
860
  >
@@ -889,7 +886,7 @@ describe("SwipeStackContent", () => {
889
886
  depth={0}
890
887
  navigationDepth={0}
891
888
  isActive={true}
892
- inputState={IDLE_STATE}
889
+ operationState={IDLE_STATE}
893
890
  containerSize={400}
894
891
  >
895
892
  Content
@@ -906,7 +903,7 @@ describe("SwipeStackContent", () => {
906
903
  depth={0}
907
904
  navigationDepth={1}
908
905
  isActive={false}
909
- inputState={IDLE_STATE}
906
+ operationState={IDLE_STATE}
910
907
  containerSize={400}
911
908
  >
912
909
  Content
@@ -931,7 +928,7 @@ describe("SwipeStackContent", () => {
931
928
  depth={0}
932
929
  navigationDepth={0}
933
930
  isActive={true}
934
- inputState={IDLE_STATE}
931
+ operationState={IDLE_STATE}
935
932
  containerSize={400}
936
933
  >
937
934
  Content
@@ -959,7 +956,7 @@ describe("SwipeStackContent", () => {
959
956
  depth={1}
960
957
  navigationDepth={1}
961
958
  isActive={true}
962
- inputState={IDLE_STATE}
959
+ operationState={IDLE_STATE}
963
960
  containerSize={400}
964
961
  >
965
962
  Content
@@ -977,7 +974,7 @@ describe("SwipeStackContent", () => {
977
974
  depth={0}
978
975
  navigationDepth={0}
979
976
  isActive={true}
980
- inputState={IDLE_STATE}
977
+ operationState={IDLE_STATE}
981
978
  containerSize={400}
982
979
  >
983
980
  Content
@@ -995,7 +992,7 @@ describe("SwipeStackContent", () => {
995
992
  depth={0}
996
993
  navigationDepth={1}
997
994
  isActive={false}
998
- inputState={IDLE_STATE}
995
+ operationState={IDLE_STATE}
999
996
  containerSize={400}
1000
997
  >
1001
998
  Content
@@ -1013,7 +1010,7 @@ describe("SwipeStackContent", () => {
1013
1010
  depth={1}
1014
1011
  navigationDepth={1}
1015
1012
  isActive={true}
1016
- inputState={IDLE_STATE}
1013
+ operationState={IDLE_STATE}
1017
1014
  containerSize={400}
1018
1015
  showShadow={false}
1019
1016
  >
@@ -1034,7 +1031,7 @@ describe("SwipeStackContent", () => {
1034
1031
  depth={0}
1035
1032
  navigationDepth={1}
1036
1033
  isActive={false}
1037
- inputState={IDLE_STATE}
1034
+ operationState={IDLE_STATE}
1038
1035
  containerSize={400}
1039
1036
  displayMode="stack"
1040
1037
  >
@@ -1054,7 +1051,7 @@ describe("SwipeStackContent", () => {
1054
1051
  depth={1}
1055
1052
  navigationDepth={1}
1056
1053
  isActive={true}
1057
- inputState={IDLE_STATE}
1054
+ operationState={IDLE_STATE}
1058
1055
  containerSize={400}
1059
1056
  displayMode="stack"
1060
1057
  >
@@ -1074,7 +1071,7 @@ describe("SwipeStackContent", () => {
1074
1071
  depth={0}
1075
1072
  navigationDepth={1}
1076
1073
  isActive={false}
1077
- inputState={IDLE_STATE}
1074
+ operationState={IDLE_STATE}
1078
1075
  containerSize={400}
1079
1076
  displayMode="overlay"
1080
1077
  >
@@ -1096,7 +1093,7 @@ describe("SwipeStackContent", () => {
1096
1093
  depth={0}
1097
1094
  navigationDepth={1}
1098
1095
  isActive={false}
1099
- inputState={IDLE_STATE}
1096
+ operationState={IDLE_STATE}
1100
1097
  containerSize={400}
1101
1098
  >
1102
1099
  Content
@@ -1114,7 +1111,7 @@ describe("SwipeStackContent", () => {
1114
1111
  depth={1}
1115
1112
  navigationDepth={1}
1116
1113
  isActive={true}
1117
- inputState={IDLE_STATE}
1114
+ operationState={IDLE_STATE}
1118
1115
  containerSize={400}
1119
1116
  >
1120
1117
  Content
@@ -1132,7 +1129,7 @@ describe("SwipeStackContent", () => {
1132
1129
  depth={0}
1133
1130
  navigationDepth={1}
1134
1131
  isActive={false}
1135
- inputState={IDLE_STATE}
1132
+ operationState={IDLE_STATE}
1136
1133
  containerSize={400}
1137
1134
  >
1138
1135
  Content
@@ -1140,9 +1137,8 @@ describe("SwipeStackContent", () => {
1140
1137
  );
1141
1138
 
1142
1139
  // At rest, should have dimming
1143
- let overlay = container.querySelector("[data-dimming-overlay]") as HTMLElement;
1144
- expect(overlay).toBeInTheDocument();
1145
- const initialOpacity = overlay.style.backgroundColor;
1140
+ const initialOverlay = container.querySelector("[data-dimming-overlay]") as HTMLElement;
1141
+ expect(initialOverlay).toBeInTheDocument();
1146
1142
 
1147
1143
  // During swipe at 100% progress, dimming should be gone
1148
1144
  rerender(
@@ -1151,16 +1147,16 @@ describe("SwipeStackContent", () => {
1151
1147
  depth={0}
1152
1148
  navigationDepth={1}
1153
1149
  isActive={false}
1154
- inputState={createSwipingState(400)}
1150
+ operationState={createOperatingState(400)}
1155
1151
  containerSize={400}
1156
1152
  >
1157
1153
  Content
1158
1154
  </SwipeStackContent>,
1159
1155
  );
1160
1156
 
1161
- overlay = container.querySelector("[data-dimming-overlay]") as HTMLElement;
1157
+ const overlayAfter = container.querySelector("[data-dimming-overlay]") as HTMLElement;
1162
1158
  // At 100% swipe, opacity should be 0 (no overlay)
1163
- expect(overlay).not.toBeInTheDocument();
1159
+ expect(overlayAfter).not.toBeInTheDocument();
1164
1160
  });
1165
1161
 
1166
1162
  it("can disable dimming with showDimming=false", () => {
@@ -1170,7 +1166,7 @@ describe("SwipeStackContent", () => {
1170
1166
  depth={0}
1171
1167
  navigationDepth={1}
1172
1168
  isActive={false}
1173
- inputState={IDLE_STATE}
1169
+ operationState={IDLE_STATE}
1174
1170
  containerSize={400}
1175
1171
  showDimming={false}
1176
1172
  >
@@ -1183,6 +1179,297 @@ describe("SwipeStackContent", () => {
1183
1179
  });
1184
1180
  });
1185
1181
 
1182
+ describe("navigation during animation", () => {
1183
+ it("handles push during back animation", () => {
1184
+ // Scenario: Panel is animating back (going from active to hidden)
1185
+ // User quickly clicks to push forward again
1186
+ const { container, rerender } = render(
1187
+ <SwipeStackContent
1188
+ id="panel1"
1189
+ depth={1}
1190
+ navigationDepth={1}
1191
+ isActive={true}
1192
+ operationState={IDLE_STATE}
1193
+ containerSize={400}
1194
+ >
1195
+ Content
1196
+ </SwipeStackContent>,
1197
+ );
1198
+
1199
+ const element = container.firstChild as HTMLElement;
1200
+ expect(element.style.transform).toBe("translateX(0px)");
1201
+
1202
+ // Step 1: Go back - panel becomes hidden, starts animating to off-screen
1203
+ rerender(
1204
+ <SwipeStackContent
1205
+ id="panel1"
1206
+ depth={1}
1207
+ navigationDepth={0}
1208
+ isActive={false}
1209
+ operationState={IDLE_STATE}
1210
+ containerSize={400}
1211
+ >
1212
+ Content
1213
+ </SwipeStackContent>,
1214
+ );
1215
+
1216
+ // Start animation but don't complete it
1217
+ act(() => {
1218
+ flushRAF(0);
1219
+ flushRAF(100); // Partial animation
1220
+ });
1221
+
1222
+ // Panel should be somewhere between 0 and 400
1223
+ const midAnimationTransform = element.style.transform;
1224
+ expect(midAnimationTransform).not.toBe("translateX(0px)");
1225
+ expect(midAnimationTransform).not.toBe("translateX(400px)");
1226
+
1227
+ // Step 2: Push again - panel becomes active again DURING animation
1228
+ rerender(
1229
+ <SwipeStackContent
1230
+ id="panel1"
1231
+ depth={1}
1232
+ navigationDepth={1}
1233
+ isActive={true}
1234
+ operationState={IDLE_STATE}
1235
+ containerSize={400}
1236
+ >
1237
+ Content
1238
+ </SwipeStackContent>,
1239
+ );
1240
+
1241
+ // Complete all pending animations
1242
+ act(() => {
1243
+ flushRAF(0);
1244
+ flushRAF(400);
1245
+ });
1246
+
1247
+ // Panel should end up at center (0), visible
1248
+ expect(element.style.transform).toBe("translateX(0px)");
1249
+ expect(element.style.visibility).toBe("visible");
1250
+ });
1251
+
1252
+ it("handles back during push animation", () => {
1253
+ // Scenario: New panel is animating in from off-screen
1254
+ // User quickly clicks back before animation completes
1255
+ const { container, rerender } = render(
1256
+ <SwipeStackContent
1257
+ id="panel1"
1258
+ depth={1}
1259
+ navigationDepth={1}
1260
+ isActive={true}
1261
+ operationState={IDLE_STATE}
1262
+ containerSize={400}
1263
+ animateOnMount={true}
1264
+ >
1265
+ Content
1266
+ </SwipeStackContent>,
1267
+ );
1268
+
1269
+ const element = container.firstChild as HTMLElement;
1270
+
1271
+ // Panel starts off-screen
1272
+ expect(element.style.transform).toBe("translateX(400px)");
1273
+
1274
+ // Start animation but don't complete it
1275
+ act(() => {
1276
+ flushRAF(0);
1277
+ flushRAF(100); // Partial animation
1278
+ });
1279
+
1280
+ // Panel should be somewhere between 400 and 0
1281
+ const midAnimationTransform = element.style.transform;
1282
+ expect(midAnimationTransform).not.toBe("translateX(400px)");
1283
+ expect(midAnimationTransform).not.toBe("translateX(0px)");
1284
+
1285
+ // Go back during animation
1286
+ rerender(
1287
+ <SwipeStackContent
1288
+ id="panel1"
1289
+ depth={1}
1290
+ navigationDepth={0}
1291
+ isActive={false}
1292
+ operationState={IDLE_STATE}
1293
+ containerSize={400}
1294
+ animateOnMount={true}
1295
+ >
1296
+ Content
1297
+ </SwipeStackContent>,
1298
+ );
1299
+
1300
+ // Complete all pending animations
1301
+ act(() => {
1302
+ flushRAF(0);
1303
+ flushRAF(400);
1304
+ });
1305
+
1306
+ // Panel should end up off-screen (400), hidden
1307
+ expect(element.style.transform).toBe("translateX(400px)");
1308
+ });
1309
+
1310
+ it("handles rapid back-push-back sequence during animations", () => {
1311
+ const { container, rerender } = render(
1312
+ <SwipeStackContent
1313
+ id="panel1"
1314
+ depth={1}
1315
+ navigationDepth={1}
1316
+ isActive={true}
1317
+ operationState={IDLE_STATE}
1318
+ containerSize={400}
1319
+ >
1320
+ Content
1321
+ </SwipeStackContent>,
1322
+ );
1323
+
1324
+ const element = container.firstChild as HTMLElement;
1325
+ expect(element.style.transform).toBe("translateX(0px)");
1326
+
1327
+ // Back
1328
+ rerender(
1329
+ <SwipeStackContent
1330
+ id="panel1"
1331
+ depth={1}
1332
+ navigationDepth={0}
1333
+ isActive={false}
1334
+ operationState={IDLE_STATE}
1335
+ containerSize={400}
1336
+ >
1337
+ Content
1338
+ </SwipeStackContent>,
1339
+ );
1340
+
1341
+ act(() => {
1342
+ flushRAF(0);
1343
+ flushRAF(50);
1344
+ });
1345
+
1346
+ // Push (before back animation completes)
1347
+ rerender(
1348
+ <SwipeStackContent
1349
+ id="panel1"
1350
+ depth={1}
1351
+ navigationDepth={1}
1352
+ isActive={true}
1353
+ operationState={IDLE_STATE}
1354
+ containerSize={400}
1355
+ >
1356
+ Content
1357
+ </SwipeStackContent>,
1358
+ );
1359
+
1360
+ act(() => {
1361
+ flushRAF(0);
1362
+ flushRAF(50);
1363
+ });
1364
+
1365
+ // Back again (before push animation completes)
1366
+ rerender(
1367
+ <SwipeStackContent
1368
+ id="panel1"
1369
+ depth={1}
1370
+ navigationDepth={0}
1371
+ isActive={false}
1372
+ operationState={IDLE_STATE}
1373
+ containerSize={400}
1374
+ >
1375
+ Content
1376
+ </SwipeStackContent>,
1377
+ );
1378
+
1379
+ // Complete all animations
1380
+ act(() => {
1381
+ flushRAF(0);
1382
+ flushRAF(400);
1383
+ });
1384
+
1385
+ // Final state: should be off-screen (hidden)
1386
+ expect(element.style.transform).toBe("translateX(400px)");
1387
+ });
1388
+
1389
+ it("panel remains visible and usable after rapid navigation", () => {
1390
+ // This is the bug scenario: after rapid back-and-forth, panel becomes permanently hidden
1391
+ const { container, rerender } = render(
1392
+ <SwipeStackContent
1393
+ id="panel1"
1394
+ depth={1}
1395
+ navigationDepth={1}
1396
+ isActive={true}
1397
+ operationState={IDLE_STATE}
1398
+ containerSize={400}
1399
+ >
1400
+ Content
1401
+ </SwipeStackContent>,
1402
+ );
1403
+
1404
+ const element = container.firstChild as HTMLElement;
1405
+
1406
+ // Rapid sequence without waiting for animations
1407
+ for (let i = 0; i < 5; i++) {
1408
+ // Go back
1409
+ rerender(
1410
+ <SwipeStackContent
1411
+ id="panel1"
1412
+ depth={1}
1413
+ navigationDepth={0}
1414
+ isActive={false}
1415
+ operationState={IDLE_STATE}
1416
+ containerSize={400}
1417
+ >
1418
+ Content
1419
+ </SwipeStackContent>,
1420
+ );
1421
+
1422
+ act(() => {
1423
+ flushRAF(0);
1424
+ flushRAF(30);
1425
+ });
1426
+
1427
+ // Push forward
1428
+ rerender(
1429
+ <SwipeStackContent
1430
+ id="panel1"
1431
+ depth={1}
1432
+ navigationDepth={1}
1433
+ isActive={true}
1434
+ operationState={IDLE_STATE}
1435
+ containerSize={400}
1436
+ >
1437
+ Content
1438
+ </SwipeStackContent>,
1439
+ );
1440
+
1441
+ act(() => {
1442
+ flushRAF(0);
1443
+ flushRAF(30);
1444
+ });
1445
+ }
1446
+
1447
+ // Final state: panel should be active
1448
+ rerender(
1449
+ <SwipeStackContent
1450
+ id="panel1"
1451
+ depth={1}
1452
+ navigationDepth={1}
1453
+ isActive={true}
1454
+ operationState={IDLE_STATE}
1455
+ containerSize={400}
1456
+ >
1457
+ Content
1458
+ </SwipeStackContent>,
1459
+ );
1460
+
1461
+ // Complete all animations
1462
+ act(() => {
1463
+ flushRAF(0);
1464
+ flushRAF(400);
1465
+ });
1466
+
1467
+ // Panel should be visible at center
1468
+ expect(element.style.transform).toBe("translateX(0px)");
1469
+ expect(element.style.visibility).toBe("visible");
1470
+ });
1471
+ });
1472
+
1186
1473
  describe("swipe commit (navigation changes)", () => {
1187
1474
  it("active panel moves off-screen when navigation depth decreases", () => {
1188
1475
  const { container, rerender } = render(
@@ -1191,7 +1478,7 @@ describe("SwipeStackContent", () => {
1191
1478
  depth={1}
1192
1479
  navigationDepth={1}
1193
1480
  isActive={true}
1194
- inputState={IDLE_STATE}
1481
+ operationState={IDLE_STATE}
1195
1482
  containerSize={400}
1196
1483
  >
1197
1484
  Content
@@ -1209,7 +1496,7 @@ describe("SwipeStackContent", () => {
1209
1496
  depth={1}
1210
1497
  navigationDepth={0}
1211
1498
  isActive={false}
1212
- inputState={IDLE_STATE}
1499
+ operationState={IDLE_STATE}
1213
1500
  containerSize={400}
1214
1501
  >
1215
1502
  Content
@@ -1236,7 +1523,7 @@ describe("SwipeStackContent", () => {
1236
1523
  depth={0}
1237
1524
  navigationDepth={1}
1238
1525
  isActive={false}
1239
- inputState={IDLE_STATE}
1526
+ operationState={IDLE_STATE}
1240
1527
  containerSize={400}
1241
1528
  >
1242
1529
  Content
@@ -1254,7 +1541,7 @@ describe("SwipeStackContent", () => {
1254
1541
  depth={0}
1255
1542
  navigationDepth={0}
1256
1543
  isActive={true}
1257
- inputState={IDLE_STATE}
1544
+ operationState={IDLE_STATE}
1258
1545
  containerSize={400}
1259
1546
  >
1260
1547
  Content