@seed-design/stackflow 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AppBar/AppBar.cjs +2 -2
- package/lib/components/AppBar/AppBar.d.ts +2 -2
- package/lib/components/AppBar/AppBar.js +2 -2
- package/lib/components/AppScreen/AppScreen.cjs +3 -3
- package/lib/components/AppScreen/AppScreen.d.ts +4 -0
- package/lib/components/AppScreen/AppScreen.js +3 -3
- package/lib/primitive/AppBar/AppBar.cjs +2 -2
- package/lib/primitive/AppBar/AppBar.js +2 -2
- package/lib/primitive/AppBar/useAppBar.d.ts +1 -1
- package/lib/primitive/AppScreen/AppScreen.cjs +1 -1
- package/lib/primitive/AppScreen/AppScreen.js +1 -1
- package/lib/primitive/AppScreen/useAppScreen.d.ts +4 -4
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.cjs +4 -3
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.d.ts +1 -1
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.js +4 -3
- package/lib/primitive/GlobalInteraction/useSwipeBack.cjs +0 -5
- package/lib/primitive/GlobalInteraction/useSwipeBack.js +0 -5
- package/package.json +6 -4
- package/src/components/AppBar/AppBar.tsx +2 -3
- package/src/components/AppScreen/AppScreen.tsx +9 -4
- package/src/primitive/AppBar/AppBar.tsx +2 -2
- package/src/primitive/AppScreen/AppScreen.tsx +1 -1
- package/src/primitive/GlobalInteraction/useGlobalInteraction.ts +5 -6
- package/src/primitive/GlobalInteraction/useSwipeBack.ts +0 -5
|
@@ -5,15 +5,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
const reactSlot = require('@radix-ui/react-slot');
|
|
8
|
+
const appBar = require('@seed-design/css/recipes/app-bar');
|
|
9
|
+
const appBarMain = require('@seed-design/css/recipes/app-bar-main');
|
|
8
10
|
const domUtils = require('@seed-design/dom-utils');
|
|
9
11
|
const reactPrimitive = require('@seed-design/react-primitive');
|
|
10
|
-
const appBar = require('@seed-design/css/recipes/app-bar');
|
|
11
12
|
const clsx = require('clsx');
|
|
12
13
|
const React = require('react');
|
|
13
14
|
const AppBar = require('../../primitive/AppBar/AppBar.cjs');
|
|
14
15
|
const useAppBarContext = require('../../primitive/AppBar/useAppBarContext.cjs');
|
|
15
16
|
const createStyleContext = require('../../utils/createStyleContext.cjs');
|
|
16
|
-
const appBarMain = require('@seed-design/css/recipes/app-bar-main');
|
|
17
17
|
|
|
18
18
|
const { PropsProvider, ClassNamesProvider, useProps, withContext, useClassNames } = createStyleContext.createStyleContext(appBar.appBar);
|
|
19
19
|
const {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PrimitiveProps } from '@seed-design/react-primitive';
|
|
2
1
|
import { AppBarVariantProps, AppBarVariant } from '@seed-design/css/recipes/app-bar';
|
|
3
|
-
import { AppBar as AppBarPrimitive } from '../../primitive';
|
|
4
2
|
import { AppBarMainVariantProps } from '@seed-design/css/recipes/app-bar-main';
|
|
3
|
+
import { PrimitiveProps } from '@seed-design/react-primitive';
|
|
4
|
+
import { AppBar as AppBarPrimitive } from '../../primitive';
|
|
5
5
|
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
6
6
|
export declare const AppBarPropsProvider: ({ children, value }: {
|
|
7
7
|
children: React.ReactNode;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { appBar } from '@seed-design/css/recipes/app-bar';
|
|
5
|
+
import { appBarMain } from '@seed-design/css/recipes/app-bar-main';
|
|
4
6
|
import { mergeProps } from '@seed-design/dom-utils';
|
|
5
7
|
import { Primitive } from '@seed-design/react-primitive';
|
|
6
|
-
import { appBar } from '@seed-design/css/recipes/app-bar';
|
|
7
8
|
import clsx from 'clsx';
|
|
8
9
|
import { forwardRef } from 'react';
|
|
9
10
|
import { AppBarLeft as AppBarLeft$1, AppBarMain as AppBarMain$1, AppBarRight as AppBarRight$1, AppBarRoot as AppBarRoot$1 } from '../../primitive/AppBar/AppBar.js';
|
|
10
11
|
import { useAppBarContext } from '../../primitive/AppBar/useAppBarContext.js';
|
|
11
12
|
import { createStyleContext } from '../../utils/createStyleContext.js';
|
|
12
|
-
import { appBarMain } from '@seed-design/css/recipes/app-bar-main';
|
|
13
13
|
|
|
14
14
|
const { PropsProvider, ClassNamesProvider, useProps, withContext, useClassNames } = createStyleContext(appBar);
|
|
15
15
|
const {
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
const appScreen = require('@seed-design/css/recipes/app-screen');
|
|
8
|
+
const domUtils = require('@seed-design/dom-utils');
|
|
8
9
|
const React = require('react');
|
|
9
10
|
const AppScreen = require('../../primitive/AppScreen/AppScreen.cjs');
|
|
10
11
|
const createStyleContext = require('../../utils/createStyleContext.cjs');
|
|
11
12
|
const AppBar = require('../AppBar/AppBar.cjs');
|
|
12
|
-
const domUtils = require('@seed-design/dom-utils');
|
|
13
13
|
|
|
14
14
|
const { ClassNamesProvider, PropsProvider, withContext, useProps } = createStyleContext.createStyleContext(appScreen.appScreen);
|
|
15
15
|
const AppScreenPropsProvider = PropsProvider;
|
|
@@ -25,8 +25,8 @@ const AppScreenRoot = React.forwardRef((props, ref) => {
|
|
|
25
25
|
AppBar.AppBarPropsProvider,
|
|
26
26
|
{
|
|
27
27
|
value: React.useMemo(
|
|
28
|
-
() => ({ theme: variantProps.theme, transitionStyle }),
|
|
29
|
-
[variantProps.theme, transitionStyle]
|
|
28
|
+
() => ({ theme: variantProps.theme, transitionStyle, tone: variantProps.tone }),
|
|
29
|
+
[variantProps.theme, transitionStyle, variantProps.tone]
|
|
30
30
|
),
|
|
31
31
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
32
|
AppScreen.AppScreenRoot,
|
|
@@ -6,6 +6,10 @@ export declare const AppScreenPropsProvider: ({ children, value }: {
|
|
|
6
6
|
value: Partial< AppScreenVariant>;
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export interface AppScreenRootProps extends AppScreenVariantProps, AppScreenPrimitive.RootProps {
|
|
9
|
+
/**
|
|
10
|
+
* @default "layer"
|
|
11
|
+
*/
|
|
12
|
+
tone?: "layer" | "transparent";
|
|
9
13
|
}
|
|
10
14
|
export declare const AppScreenRoot: ForwardRefExoticComponent<AppScreenRootProps & RefAttributes<HTMLDivElement>>;
|
|
11
15
|
export interface AppScreenDimProps extends AppScreenPrimitive.DimProps {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { appScreen } from '@seed-design/css/recipes/app-screen';
|
|
4
|
+
import { mergeProps } from '@seed-design/dom-utils';
|
|
4
5
|
import { forwardRef, useMemo } from 'react';
|
|
5
6
|
import { AppScreenDim as AppScreenDim$1, AppScreenEdge as AppScreenEdge$1, AppScreenLayer as AppScreenLayer$1, AppScreenRoot as AppScreenRoot$1 } from '../../primitive/AppScreen/AppScreen.js';
|
|
6
7
|
import { createStyleContext } from '../../utils/createStyleContext.js';
|
|
7
8
|
import { AppBarPropsProvider } from '../AppBar/AppBar.js';
|
|
8
|
-
import { mergeProps } from '@seed-design/dom-utils';
|
|
9
9
|
|
|
10
10
|
const { ClassNamesProvider, PropsProvider, withContext, useProps } = createStyleContext(appScreen);
|
|
11
11
|
const AppScreenPropsProvider = PropsProvider;
|
|
@@ -21,8 +21,8 @@ const AppScreenRoot = forwardRef((props, ref) => {
|
|
|
21
21
|
AppBarPropsProvider,
|
|
22
22
|
{
|
|
23
23
|
value: useMemo(
|
|
24
|
-
() => ({ theme: variantProps.theme, transitionStyle }),
|
|
25
|
-
[variantProps.theme, transitionStyle]
|
|
24
|
+
() => ({ theme: variantProps.theme, transitionStyle, tone: variantProps.tone }),
|
|
25
|
+
[variantProps.theme, transitionStyle, variantProps.tone]
|
|
26
26
|
),
|
|
27
27
|
children: /* @__PURE__ */ jsx(
|
|
28
28
|
AppScreenRoot$1,
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
5
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const reactComposeRefs = require('@radix-ui/react-compose-refs');
|
|
8
|
+
const domUtils = require('@seed-design/dom-utils');
|
|
7
9
|
const reactPrimitive = require('@seed-design/react-primitive');
|
|
8
10
|
const React = require('react');
|
|
9
11
|
const useAppBar = require('./useAppBar.cjs');
|
|
10
12
|
const useAppBarContext = require('./useAppBarContext.cjs');
|
|
11
|
-
const domUtils = require('@seed-design/dom-utils');
|
|
12
|
-
const reactComposeRefs = require('@radix-ui/react-compose-refs');
|
|
13
13
|
|
|
14
14
|
const AppBarRoot = React.forwardRef((props, ref) => {
|
|
15
15
|
const { ...otherProps } = props;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
4
|
+
import { mergeProps } from '@seed-design/dom-utils';
|
|
3
5
|
import { Primitive } from '@seed-design/react-primitive';
|
|
4
6
|
import { forwardRef } from 'react';
|
|
5
7
|
import { useAppBar } from './useAppBar.js';
|
|
6
8
|
import { useAppBarContext, AppBarProvider } from './useAppBarContext.js';
|
|
7
|
-
import { mergeProps } from '@seed-design/dom-utils';
|
|
8
|
-
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
9
9
|
|
|
10
10
|
const AppBarRoot = forwardRef((props, ref) => {
|
|
11
11
|
const { ...otherProps } = props;
|
|
@@ -58,7 +58,7 @@ export declare function useAppBar(_props: UseAppBarProps): {
|
|
|
58
58
|
results?: number | undefined | undefined;
|
|
59
59
|
security?: string | undefined | undefined;
|
|
60
60
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
61
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
61
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
62
62
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
63
63
|
popoverTarget?: string | undefined | undefined;
|
|
64
64
|
inert?: boolean | undefined | undefined;
|
|
@@ -7,10 +7,10 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
7
7
|
const reactComposeRefs = require('@radix-ui/react-compose-refs');
|
|
8
8
|
const domUtils = require('@seed-design/dom-utils');
|
|
9
9
|
const reactPrimitive = require('@seed-design/react-primitive');
|
|
10
|
+
const reactUiCore = require('@stackflow/react-ui-core');
|
|
10
11
|
const React = require('react');
|
|
11
12
|
const useAppScreen = require('./useAppScreen.cjs');
|
|
12
13
|
const useAppScreenContext = require('./useAppScreenContext.cjs');
|
|
13
|
-
const reactUiCore = require('@stackflow/react-ui-core');
|
|
14
14
|
|
|
15
15
|
const AppScreenRoot = React.forwardRef((props, ref) => {
|
|
16
16
|
const {
|
|
@@ -3,10 +3,10 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
4
4
|
import { mergeProps } from '@seed-design/dom-utils';
|
|
5
5
|
import { Primitive } from '@seed-design/react-primitive';
|
|
6
|
+
import { usePreventTouchDuringTransition } from '@stackflow/react-ui-core';
|
|
6
7
|
import { forwardRef, useRef } from 'react';
|
|
7
8
|
import { useAppScreen } from './useAppScreen.js';
|
|
8
9
|
import { useAppScreenContext, AppScreenProvider } from './useAppScreenContext.js';
|
|
9
|
-
import { usePreventTouchDuringTransition } from '@stackflow/react-ui-core';
|
|
10
10
|
|
|
11
11
|
const AppScreenRoot = forwardRef((props, ref) => {
|
|
12
12
|
const {
|
|
@@ -56,7 +56,7 @@ export declare function useAppScreen(props: UseAppScreenProps): {
|
|
|
56
56
|
results?: number | undefined | undefined;
|
|
57
57
|
security?: string | undefined | undefined;
|
|
58
58
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
59
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
59
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
60
60
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
61
61
|
popoverTarget?: string | undefined | undefined;
|
|
62
62
|
inert?: boolean | undefined | undefined;
|
|
@@ -338,7 +338,7 @@ export declare function useAppScreen(props: UseAppScreenProps): {
|
|
|
338
338
|
results?: number | undefined | undefined;
|
|
339
339
|
security?: string | undefined | undefined;
|
|
340
340
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
341
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
341
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
342
342
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
343
343
|
popoverTarget?: string | undefined | undefined;
|
|
344
344
|
inert?: boolean | undefined | undefined;
|
|
@@ -620,7 +620,7 @@ export declare function useAppScreen(props: UseAppScreenProps): {
|
|
|
620
620
|
results?: number | undefined | undefined;
|
|
621
621
|
security?: string | undefined | undefined;
|
|
622
622
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
623
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
623
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
624
624
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
625
625
|
popoverTarget?: string | undefined | undefined;
|
|
626
626
|
inert?: boolean | undefined | undefined;
|
|
@@ -902,7 +902,7 @@ export declare function useAppScreen(props: UseAppScreenProps): {
|
|
|
902
902
|
results?: number | undefined | undefined;
|
|
903
903
|
security?: string | undefined | undefined;
|
|
904
904
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
905
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
905
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
906
906
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
907
907
|
popoverTarget?: string | undefined | undefined;
|
|
908
908
|
inert?: boolean | undefined | undefined;
|
|
@@ -46,7 +46,7 @@ function useGlobalInteraction() {
|
|
|
46
46
|
displacementRatio: 0,
|
|
47
47
|
velocity: 0
|
|
48
48
|
});
|
|
49
|
-
setSwipeBackState("swiping");
|
|
49
|
+
setSwipeBackState((prev) => prev === "swiping" ? prev : "swiping");
|
|
50
50
|
onSwipeStart?.();
|
|
51
51
|
},
|
|
52
52
|
[onSwipeStart]
|
|
@@ -62,7 +62,7 @@ function useGlobalInteraction() {
|
|
|
62
62
|
displacementRatio,
|
|
63
63
|
velocity
|
|
64
64
|
});
|
|
65
|
-
setSwipeBackState("swiping");
|
|
65
|
+
setSwipeBackState((prev) => prev === "swiping" ? prev : "swiping");
|
|
66
66
|
onSwipeMove?.({ displacement, displacementRatio });
|
|
67
67
|
},
|
|
68
68
|
[onSwipeMove]
|
|
@@ -72,10 +72,11 @@ function useGlobalInteraction() {
|
|
|
72
72
|
const swiped = swipeBackContextRef.current.displacementRatio > displacementRatioThreshold || swipeBackContextRef.current.velocity > velocityThreshold;
|
|
73
73
|
if (swiped) {
|
|
74
74
|
stackRef.current?.style.setProperty("--swipe-back-target", "100%");
|
|
75
|
+
setSwipeBackState("completing");
|
|
75
76
|
} else {
|
|
76
77
|
stackRef.current?.style.setProperty("--swipe-back-target", "0");
|
|
78
|
+
setSwipeBackState("canceling");
|
|
77
79
|
}
|
|
78
|
-
setSwipeBackState("transitioning");
|
|
79
80
|
onSwipeEnd?.({ swiped });
|
|
80
81
|
},
|
|
81
82
|
[onSwipeEnd, displacementRatioThreshold, velocityThreshold]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject, Dispatch, SetStateAction, HTMLAttributes } from 'react';
|
|
2
|
-
export type SwipeBackState = "idle" | "swiping" | "
|
|
2
|
+
export type SwipeBackState = "idle" | "swiping" | "canceling" | "completing";
|
|
3
3
|
export type UseGlobalInteractionReturn = ReturnType<typeof useGlobalInteraction>;
|
|
4
4
|
export interface SwipeBackContext {
|
|
5
5
|
x0: number;
|
|
@@ -42,7 +42,7 @@ function useGlobalInteraction() {
|
|
|
42
42
|
displacementRatio: 0,
|
|
43
43
|
velocity: 0
|
|
44
44
|
});
|
|
45
|
-
setSwipeBackState("swiping");
|
|
45
|
+
setSwipeBackState((prev) => prev === "swiping" ? prev : "swiping");
|
|
46
46
|
onSwipeStart?.();
|
|
47
47
|
},
|
|
48
48
|
[onSwipeStart]
|
|
@@ -58,7 +58,7 @@ function useGlobalInteraction() {
|
|
|
58
58
|
displacementRatio,
|
|
59
59
|
velocity
|
|
60
60
|
});
|
|
61
|
-
setSwipeBackState("swiping");
|
|
61
|
+
setSwipeBackState((prev) => prev === "swiping" ? prev : "swiping");
|
|
62
62
|
onSwipeMove?.({ displacement, displacementRatio });
|
|
63
63
|
},
|
|
64
64
|
[onSwipeMove]
|
|
@@ -68,10 +68,11 @@ function useGlobalInteraction() {
|
|
|
68
68
|
const swiped = swipeBackContextRef.current.displacementRatio > displacementRatioThreshold || swipeBackContextRef.current.velocity > velocityThreshold;
|
|
69
69
|
if (swiped) {
|
|
70
70
|
stackRef.current?.style.setProperty("--swipe-back-target", "100%");
|
|
71
|
+
setSwipeBackState("completing");
|
|
71
72
|
} else {
|
|
72
73
|
stackRef.current?.style.setProperty("--swipe-back-target", "0");
|
|
74
|
+
setSwipeBackState("canceling");
|
|
73
75
|
}
|
|
74
|
-
setSwipeBackState("transitioning");
|
|
75
76
|
onSwipeEnd?.({ swiped });
|
|
76
77
|
},
|
|
77
78
|
[onSwipeEnd, displacementRatioThreshold, velocityThreshold]
|
|
@@ -20,11 +20,6 @@ function useSwipeBack(props) {
|
|
|
20
20
|
"data-swipe-back": ""
|
|
21
21
|
},
|
|
22
22
|
layerProps: {
|
|
23
|
-
onTransitionEnd: (e) => {
|
|
24
|
-
if (e.target === e.currentTarget) {
|
|
25
|
-
events.reset();
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
23
|
onAnimationEnd: (e) => {
|
|
29
24
|
if (e.target === e.currentTarget) {
|
|
30
25
|
events.reset();
|
|
@@ -16,11 +16,6 @@ function useSwipeBack(props) {
|
|
|
16
16
|
"data-swipe-back": ""
|
|
17
17
|
},
|
|
18
18
|
layerProps: {
|
|
19
|
-
onTransitionEnd: (e) => {
|
|
20
|
-
if (e.target === e.currentTarget) {
|
|
21
|
-
events.reset();
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
19
|
onAnimationEnd: (e) => {
|
|
25
20
|
if (e.target === e.currentTarget) {
|
|
26
21
|
events.reset();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/stackflow",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -35,19 +35,21 @@
|
|
|
35
35
|
"clsx": "^2.1.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@seed-design/css": "1.
|
|
38
|
+
"@seed-design/css": "1.1.0",
|
|
39
39
|
"@stackflow/core": "^1.2.0",
|
|
40
40
|
"@stackflow/react": "^1.5.1",
|
|
41
41
|
"@stackflow/react-ui-core": "^1.3.2",
|
|
42
|
+
"@types/react": "^19.2.2",
|
|
43
|
+
"@types/react-dom": "^19.2.1",
|
|
42
44
|
"@vitejs/plugin-react": "^5.0.0",
|
|
43
|
-
"globby": "^
|
|
45
|
+
"globby": "^15.0.0",
|
|
44
46
|
"react": "^19.1.0",
|
|
45
47
|
"react-dom": "^19.1.0",
|
|
46
48
|
"vite": "^7.0.0",
|
|
47
49
|
"vite-plugin-dts": "^4.5.3"
|
|
48
50
|
},
|
|
49
51
|
"peerDependencies": {
|
|
50
|
-
"@seed-design/css": ">=1.
|
|
52
|
+
"@seed-design/css": ">=1.1.0",
|
|
51
53
|
"@stackflow/core": ">=1.1.0",
|
|
52
54
|
"@stackflow/react": ">=1.4.1",
|
|
53
55
|
"@stackflow/react-ui-core": ">=1.3.2",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import { appBar, type AppBarVariantProps } from "@seed-design/css/recipes/app-bar";
|
|
3
|
+
import { appBarMain, type AppBarMainVariantProps } from "@seed-design/css/recipes/app-bar-main";
|
|
2
4
|
import { mergeProps } from "@seed-design/dom-utils";
|
|
3
5
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
4
|
-
import { type AppBarVariantProps, appBar } from "@seed-design/css/recipes/app-bar";
|
|
5
6
|
import clsx from "clsx";
|
|
6
7
|
import { forwardRef } from "react";
|
|
7
8
|
import { AppBar as AppBarPrimitive } from "../../primitive";
|
|
8
9
|
import { useAppBarContext } from "../../primitive/AppBar/useAppBarContext";
|
|
9
10
|
import { createStyleContext } from "../../utils/createStyleContext";
|
|
10
|
-
import { appBarMain, type AppBarMainVariantProps } from "@seed-design/css/recipes/app-bar-main";
|
|
11
11
|
|
|
12
12
|
const { PropsProvider, ClassNamesProvider, useProps, withContext, useClassNames } =
|
|
13
13
|
createStyleContext(appBar);
|
|
@@ -24,7 +24,6 @@ export interface AppBarProps extends AppBarVariantProps, AppBarPrimitive.RootPro
|
|
|
24
24
|
export const AppBarRoot = forwardRef<HTMLDivElement, AppBarProps>((props, ref) => {
|
|
25
25
|
const contextProps = useProps();
|
|
26
26
|
const [variantProps, otherProps] = appBar.splitVariantProps({ ...contextProps, ...props });
|
|
27
|
-
|
|
28
27
|
const classNames = appBar(variantProps);
|
|
29
28
|
|
|
30
29
|
return (
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { appScreen, type AppScreenVariantProps } from "@seed-design/css/recipes/app-screen";
|
|
2
|
+
import { mergeProps } from "@seed-design/dom-utils";
|
|
2
3
|
import { forwardRef, useMemo } from "react";
|
|
3
4
|
import { AppScreen as AppScreenPrimitive } from "../../primitive";
|
|
4
5
|
import { createStyleContext } from "../../utils/createStyleContext";
|
|
5
6
|
import { AppBarPropsProvider } from "../AppBar/AppBar";
|
|
6
|
-
import { mergeProps } from "@seed-design/dom-utils";
|
|
7
7
|
|
|
8
8
|
const { ClassNamesProvider, PropsProvider, withContext, useProps } = createStyleContext(appScreen);
|
|
9
9
|
|
|
10
10
|
export const AppScreenPropsProvider = PropsProvider;
|
|
11
11
|
|
|
12
|
-
export interface AppScreenRootProps extends AppScreenVariantProps, AppScreenPrimitive.RootProps {
|
|
12
|
+
export interface AppScreenRootProps extends AppScreenVariantProps, AppScreenPrimitive.RootProps {
|
|
13
|
+
/**
|
|
14
|
+
* @default "layer"
|
|
15
|
+
*/
|
|
16
|
+
tone?: "layer" | "transparent";
|
|
17
|
+
}
|
|
13
18
|
|
|
14
19
|
export const AppScreenRoot = forwardRef<HTMLDivElement, AppScreenRootProps>((props, ref) => {
|
|
15
20
|
const contextProps = useProps();
|
|
@@ -29,8 +34,8 @@ export const AppScreenRoot = forwardRef<HTMLDivElement, AppScreenRootProps>((pro
|
|
|
29
34
|
<ClassNamesProvider value={classNames}>
|
|
30
35
|
<AppBarPropsProvider
|
|
31
36
|
value={useMemo(
|
|
32
|
-
() => ({ theme: variantProps.theme, transitionStyle }),
|
|
33
|
-
[variantProps.theme, transitionStyle],
|
|
37
|
+
() => ({ theme: variantProps.theme, transitionStyle, tone: variantProps.tone }),
|
|
38
|
+
[variantProps.theme, transitionStyle, variantProps.tone],
|
|
34
39
|
)}
|
|
35
40
|
>
|
|
36
41
|
<AppScreenPrimitive.Root
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
2
|
+
import { mergeProps } from "@seed-design/dom-utils";
|
|
1
3
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
2
4
|
import { forwardRef } from "react";
|
|
3
5
|
import { useAppBar, type UseAppBarProps } from "./useAppBar";
|
|
4
6
|
import { AppBarProvider, useAppBarContext } from "./useAppBarContext";
|
|
5
|
-
import { mergeProps } from "@seed-design/dom-utils";
|
|
6
|
-
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
7
7
|
|
|
8
8
|
export interface AppBarRootProps
|
|
9
9
|
extends PrimitiveProps,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
2
2
|
import { mergeProps } from "@seed-design/dom-utils";
|
|
3
3
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
4
|
+
import { usePreventTouchDuringTransition } from "@stackflow/react-ui-core";
|
|
4
5
|
import { forwardRef, useRef } from "react";
|
|
5
6
|
import { useAppScreen, type UseAppScreenProps } from "./useAppScreen";
|
|
6
7
|
import { AppScreenProvider, useAppScreenContext } from "./useAppScreenContext";
|
|
7
|
-
import { usePreventTouchDuringTransition } from "@stackflow/react-ui-core";
|
|
8
8
|
|
|
9
9
|
export interface AppScreenRootProps
|
|
10
10
|
extends PrimitiveProps,
|
|
@@ -2,7 +2,7 @@ import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
|
|
|
2
2
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { useTopActivity } from "../private/useTopActivity";
|
|
4
4
|
|
|
5
|
-
export type SwipeBackState = "idle" | "swiping" | "
|
|
5
|
+
export type SwipeBackState = "idle" | "swiping" | "canceling" | "completing";
|
|
6
6
|
|
|
7
7
|
export type UseGlobalInteractionReturn = ReturnType<typeof useGlobalInteraction>;
|
|
8
8
|
|
|
@@ -88,8 +88,7 @@ export function useGlobalInteraction() {
|
|
|
88
88
|
displacementRatio: 0,
|
|
89
89
|
velocity: 0,
|
|
90
90
|
});
|
|
91
|
-
setSwipeBackState("swiping");
|
|
92
|
-
|
|
91
|
+
setSwipeBackState((prev) => (prev === "swiping" ? prev : "swiping"));
|
|
93
92
|
onSwipeStart?.();
|
|
94
93
|
},
|
|
95
94
|
[onSwipeStart],
|
|
@@ -106,8 +105,7 @@ export function useGlobalInteraction() {
|
|
|
106
105
|
displacementRatio,
|
|
107
106
|
velocity,
|
|
108
107
|
});
|
|
109
|
-
setSwipeBackState("swiping");
|
|
110
|
-
|
|
108
|
+
setSwipeBackState((prev) => (prev === "swiping" ? prev : "swiping"));
|
|
111
109
|
onSwipeMove?.({ displacement, displacementRatio });
|
|
112
110
|
},
|
|
113
111
|
[onSwipeMove],
|
|
@@ -121,11 +119,12 @@ export function useGlobalInteraction() {
|
|
|
121
119
|
|
|
122
120
|
if (swiped) {
|
|
123
121
|
stackRef.current?.style.setProperty("--swipe-back-target", "100%");
|
|
122
|
+
setSwipeBackState("completing");
|
|
124
123
|
} else {
|
|
125
124
|
stackRef.current?.style.setProperty("--swipe-back-target", "0");
|
|
125
|
+
setSwipeBackState("canceling");
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
setSwipeBackState("transitioning");
|
|
129
128
|
onSwipeEnd?.({ swiped });
|
|
130
129
|
},
|
|
131
130
|
[onSwipeEnd, displacementRatioThreshold, velocityThreshold],
|
|
@@ -20,11 +20,6 @@ export function useSwipeBack(props: UseSwipeBackProps) {
|
|
|
20
20
|
"data-swipe-back": "",
|
|
21
21
|
} as React.HTMLAttributes<HTMLDivElement>,
|
|
22
22
|
layerProps: {
|
|
23
|
-
onTransitionEnd: (e) => {
|
|
24
|
-
if (e.target === e.currentTarget) {
|
|
25
|
-
events.reset();
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
23
|
onAnimationEnd: (e) => {
|
|
29
24
|
if (e.target === e.currentTarget) {
|
|
30
25
|
events.reset();
|