@wallarm-org/design-system 1.23.2 → 1.23.3-rc-fix-remote-shell-breadcrumb-transition.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.
- package/dist/components/RemoteShell/NavPanelContent.d.ts +6 -0
- package/dist/components/RemoteShell/NavPanelContent.js +4 -2
- package/dist/components/RemoteShell/RemoteShellPanel.js +12 -4
- package/dist/components/RemoteShell/model/useDrillTransition.d.ts +4 -1
- package/dist/components/RemoteShell/model/useDrillTransition.js +21 -11
- package/dist/metadata/components.json +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
+
import type { NavStackEntry } from './model';
|
|
3
|
+
interface NavigationSnapshot {
|
|
4
|
+
navStack: NavStackEntry[];
|
|
5
|
+
activeItemId: string | null;
|
|
6
|
+
}
|
|
2
7
|
interface NavPanelContentProps {
|
|
3
8
|
level: number;
|
|
9
|
+
navigationSnapshot?: NavigationSnapshot;
|
|
4
10
|
}
|
|
5
11
|
export declare const NavPanelContent: FC<NavPanelContentProps>;
|
|
6
12
|
export {};
|
|
@@ -4,8 +4,10 @@ import { Text } from "../Text/index.js";
|
|
|
4
4
|
import { HeaderActions } from "./HeaderActions.js";
|
|
5
5
|
import { findDrillNode, useRemoteShellContext } from "./model/index.js";
|
|
6
6
|
import { NavItemsList } from "./NavItemsList.js";
|
|
7
|
-
const NavPanelContent = ({ level: rawLevel })=>{
|
|
8
|
-
const { config, navStack, effectiveActiveItemId, navigate, drillInto, goBack } = useRemoteShellContext();
|
|
7
|
+
const NavPanelContent = ({ level: rawLevel, navigationSnapshot })=>{
|
|
8
|
+
const { config, navStack: currentNavStack, effectiveActiveItemId: currentActiveItemId, navigate, drillInto, goBack } = useRemoteShellContext();
|
|
9
|
+
const navStack = navigationSnapshot?.navStack ?? currentNavStack;
|
|
10
|
+
const effectiveActiveItemId = navigationSnapshot ? navigationSnapshot.activeItemId : currentActiveItemId;
|
|
9
11
|
const level = Math.min(rawLevel, navStack.length - 1);
|
|
10
12
|
const entry = navStack[level];
|
|
11
13
|
const hasHeaderActions = !!config.headerActions?.length;
|
|
@@ -7,8 +7,8 @@ import { DRILL_ANIMATION_DURATION, DRILL_ANIMATION_EASING, useDrillTransition }
|
|
|
7
7
|
import { NavPanelContent } from "./NavPanelContent.js";
|
|
8
8
|
const RemoteShellPanel = ({ ref, className, resizable, isLoading, loaderCount = 6, ...props })=>{
|
|
9
9
|
const testId = useTestId('panel');
|
|
10
|
-
const { config, drillLevel } = useRemoteShellContext();
|
|
11
|
-
const { transition, clearTransition } = useDrillTransition(drillLevel);
|
|
10
|
+
const { config, drillLevel, navStack, effectiveActiveItemId } = useRemoteShellContext();
|
|
11
|
+
const { transition, clearTransition } = useDrillTransition(drillLevel, navStack, effectiveActiveItemId);
|
|
12
12
|
if (isLoading) return /*#__PURE__*/ jsx("div", {
|
|
13
13
|
...props,
|
|
14
14
|
ref: ref,
|
|
@@ -53,7 +53,11 @@ const RemoteShellPanel = ({ ref, className, resizable, isLoading, loaderCount =
|
|
|
53
53
|
animation: `${isForward ? 'ds-nav-blur-out' : 'ds-nav-blur-in'} ${timing}`
|
|
54
54
|
},
|
|
55
55
|
children: /*#__PURE__*/ jsx(NavPanelContent, {
|
|
56
|
-
level: isForward ? transition.fromLevel : drillLevel
|
|
56
|
+
level: isForward ? transition.fromLevel : drillLevel,
|
|
57
|
+
navigationSnapshot: isForward ? {
|
|
58
|
+
navStack: transition.fromNavStack,
|
|
59
|
+
activeItemId: transition.fromActiveItemId
|
|
60
|
+
} : void 0
|
|
57
61
|
})
|
|
58
62
|
}),
|
|
59
63
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -62,7 +66,11 @@ const RemoteShellPanel = ({ ref, className, resizable, isLoading, loaderCount =
|
|
|
62
66
|
animation: `${isForward ? 'ds-nav-blur-in' : 'ds-nav-blur-out'} ${timing}`
|
|
63
67
|
},
|
|
64
68
|
children: /*#__PURE__*/ jsx(NavPanelContent, {
|
|
65
|
-
level: isForward ? drillLevel : transition.fromLevel
|
|
69
|
+
level: isForward ? drillLevel : transition.fromLevel,
|
|
70
|
+
navigationSnapshot: isForward ? void 0 : {
|
|
71
|
+
navStack: transition.fromNavStack,
|
|
72
|
+
activeItemId: transition.fromActiveItemId
|
|
73
|
+
}
|
|
66
74
|
})
|
|
67
75
|
})
|
|
68
76
|
]
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { NavStackEntry } from './types';
|
|
1
2
|
export declare const DRILL_ANIMATION_DURATION = "220ms";
|
|
2
3
|
export declare const DRILL_ANIMATION_EASING = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
3
4
|
export interface DrillTransition {
|
|
4
5
|
fromLevel: number;
|
|
5
6
|
direction: 'forward' | 'backward';
|
|
7
|
+
fromNavStack: NavStackEntry[];
|
|
8
|
+
fromActiveItemId: string | null;
|
|
6
9
|
}
|
|
7
|
-
export declare const useDrillTransition: (drillLevel: number) => {
|
|
10
|
+
export declare const useDrillTransition: (drillLevel: number, navStack: NavStackEntry[], activeItemId: string | null) => {
|
|
8
11
|
transition: DrillTransition | null;
|
|
9
12
|
clearTransition: () => void;
|
|
10
13
|
};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
const DRILL_ANIMATION_DURATION = '220ms';
|
|
3
3
|
const DRILL_ANIMATION_EASING = 'cubic-bezier(0.4, 0, 0.2, 1)';
|
|
4
|
-
const useDrillTransition = (drillLevel)=>{
|
|
5
|
-
const
|
|
4
|
+
const useDrillTransition = (drillLevel, navStack, activeItemId)=>{
|
|
5
|
+
const previousRef = useRef({
|
|
6
|
+
drillLevel,
|
|
7
|
+
navStack,
|
|
8
|
+
activeItemId
|
|
9
|
+
});
|
|
6
10
|
const [transition, setTransition] = useState(null);
|
|
7
11
|
useLayoutEffect(()=>{
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const previous = previousRef.current;
|
|
13
|
+
if (previous.drillLevel !== drillLevel) setTransition({
|
|
14
|
+
fromLevel: previous.drillLevel,
|
|
15
|
+
direction: drillLevel > previous.drillLevel ? 'forward' : 'backward',
|
|
16
|
+
fromNavStack: previous.navStack,
|
|
17
|
+
fromActiveItemId: previous.activeItemId
|
|
18
|
+
});
|
|
19
|
+
previousRef.current = {
|
|
20
|
+
drillLevel,
|
|
21
|
+
navStack,
|
|
22
|
+
activeItemId
|
|
23
|
+
};
|
|
16
24
|
}, [
|
|
17
|
-
|
|
25
|
+
activeItemId,
|
|
26
|
+
drillLevel,
|
|
27
|
+
navStack
|
|
18
28
|
]);
|
|
19
29
|
const clearTransition = ()=>setTransition(null);
|
|
20
30
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wallarm-org/design-system",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.3-rc-fix-remote-shell-breadcrumb-transition.1",
|
|
4
4
|
"description": "Core design system library with React components and Storybook documentation",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|