@stackflow/plugin-basic-ui 1.10.1 → 1.11.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.
@@ -1,8 +1,6 @@
1
1
  import { useActions } from "@stackflow/react";
2
- import { assignInlineVars } from "@vanilla-extract/dynamic";
3
- import { createContext, useContext, useMemo, useRef } from "react";
4
-
5
2
  import {
3
+ useActivityDataAttributes,
6
4
  useLazy,
7
5
  useMounted,
8
6
  useNullableActivity,
@@ -11,6 +9,8 @@ import {
11
9
  useStyleEffectSwipeBack,
12
10
  useZIndexBase,
13
11
  } from "@stackflow/react-ui-core";
12
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
13
+ import { createContext, useContext, useMemo, useRef } from "react";
14
14
  import { useGlobalOptions } from "../basicUIPlugin";
15
15
  import type { GlobalVars } from "../basicUIPlugin.css";
16
16
  import { globalVars } from "../basicUIPlugin.css";
@@ -60,6 +60,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
60
60
  }) => {
61
61
  const globalOptions = useGlobalOptions();
62
62
  const activity = useNullableActivity();
63
+ const activityDataAttributes = useActivityDataAttributes();
63
64
  const mounted = useMounted();
64
65
 
65
66
  const { pop } = useActions();
@@ -146,6 +147,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
146
147
  dimRef,
147
148
  edgeRef,
148
149
  paperRef,
150
+ appBarRef,
149
151
  offset: OFFSET_PX_CUPERTINO,
150
152
  transitionDuration: globalVars.transitionDuration,
151
153
  preventSwipeBack:
@@ -173,8 +175,10 @@ const AppScreen: React.FC<AppScreenProps> = ({
173
175
 
174
176
  return null;
175
177
  },
176
- onSwiped() {
177
- pop();
178
+ onSwipeEnd({ swiped }) {
179
+ if (swiped) {
180
+ pop();
181
+ }
178
182
  },
179
183
  });
180
184
 
@@ -236,13 +240,15 @@ const AppScreen: React.FC<AppScreenProps> = ({
236
240
  }),
237
241
  )}
238
242
  data-stackflow-component-name="AppScreen"
239
- data-stackflow-activity-id={mounted ? activity?.id : undefined}
240
- data-stackflow-activity-is-active={
241
- mounted ? activity?.isActive : undefined
242
- }
243
+ {...activityDataAttributes}
243
244
  >
244
245
  {activityEnterStyle !== "slideInLeft" && (
245
- <div className={css.dim} ref={dimRef} />
246
+ <div
247
+ ref={dimRef}
248
+ className={css.dim}
249
+ data-part="dim"
250
+ {...activityDataAttributes}
251
+ />
246
252
  )}
247
253
  {appBar && (
248
254
  <AppBar
@@ -255,19 +261,26 @@ const AppScreen: React.FC<AppScreenProps> = ({
255
261
  )}
256
262
  <div
257
263
  key={activity?.id}
264
+ ref={paperRef}
258
265
  className={css.paper({
259
266
  hasAppBar,
260
267
  modalPresentationStyle,
261
268
  activityEnterStyle,
262
269
  })}
263
- ref={paperRef}
270
+ data-part="paper"
271
+ {...activityDataAttributes}
264
272
  >
265
273
  {children}
266
274
  </div>
267
275
  {!activity?.isRoot &&
268
276
  globalOptions.theme === "cupertino" &&
269
277
  !isSwipeBackPrevented && (
270
- <div className={css.edge({ hasAppBar })} ref={edgeRef} />
278
+ <div
279
+ ref={edgeRef}
280
+ className={css.edge({ hasAppBar })}
281
+ data-part="edge"
282
+ {...activityDataAttributes}
283
+ />
271
284
  )}
272
285
  </div>
273
286
  </Context.Provider>