Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

♻️ refactor(ui): move DraggablePanel to the antd-free base-ui build (#19365)

Innei84b089450c33
diff --git a/apps/share/src/features/topic/SharePortal.tsx b/apps/share/src/features/topic/SharePortal.tsx
index 8dec45411cf..f969d38ca18 100644
--- a/apps/share/src/features/topic/SharePortal.tsx
+++ b/apps/share/src/features/topic/SharePortal.tsx
@@ -1,6 +1,6 @@
'use client';
-import { DraggablePanel } from '@lobehub/ui';
+import { DraggablePanel } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
diff --git a/package.json b/package.json
index 5b5290ef00e..d8f733512f7 100644
--- a/package.json
+++ b/package.json
@@ -314,7 +314,7 @@
"@lobehub/icons": "^5.18.0",
"@lobehub/market-sdk": "0.41.0",
"@lobehub/tts": "^5.1.2",
- "@lobehub/ui": "^5.40.3",
+ "@lobehub/ui": "^5.42.2",
"@modelcontextprotocol/sdk": "^1.30.0",
"@neondatabase/serverless": "^1.1.0",
"@next/third-parties": "^16.3.0",
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 14ffbddd704..cfda0a58d79 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -28,7 +28,7 @@ packages:
- apps/workbench
minimumReleaseAgeExclude:
- - '@lobehub/[email protected]'
+ - '@lobehub/*'
# Build scripts run one at a time. Several peer-variant copies of
# @lobehub/editor resolve in this workspace and every copy's postinstall
diff --git a/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx b/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx
index b8e8268e40b..f72e163f0f9 100644
--- a/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx
+++ b/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx
@@ -1,7 +1,7 @@
'use client';
-import { DraggablePanel, Flexbox, Icon } from '@lobehub/ui';
-import { Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { DraggablePanel, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, useResponsive } from 'antd-style';
import { PanelRightOpen } from 'lucide-react';
import { useTranslation } from 'react-i18next';
@@ -158,7 +158,6 @@ const AcceptanceLedgerRail = () => {
</AcceptanceDrawer>
) : (
<DraggablePanel
- stableLayout
defaultSize={{ width: 340 }}
expand={expand}
minWidth={300}
diff --git a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx
index f76b663f661..8f6abe0c1fb 100644
--- a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx
+++ b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx
@@ -1,22 +1,14 @@
'use client';
-import {
- Accordion,
- AccordionItem,
- Center,
- DraggablePanel,
- DraggablePanelContainer,
- type DraggablePanelProps,
- Empty,
- Flexbox,
- Icon,
-} from '@lobehub/ui';
-import type { DropdownItem } from '@lobehub/ui/base-ui';
+import { Accordion, AccordionItem, Center, Empty, Flexbox, Icon } from '@lobehub/ui';
+import type { DraggablePanelProps, DropdownItem } from '@lobehub/ui/base-ui';
import {
ActionIcon,
Button,
Checkbox,
confirmModal,
+ DraggablePanel,
+ DraggablePanelContainer,
DropdownMenu,
Text,
toast,
diff --git a/src/features/AgentBuilder/index.tsx b/src/features/AgentBuilder/index.tsx
index 9cc2c8ac853..7df9eba6b29 100644
--- a/src/features/AgentBuilder/index.tsx
+++ b/src/features/AgentBuilder/index.tsx
@@ -28,7 +28,6 @@ const AgentBuilder = memo(() => {
return (
<RightPanel
- stableLayout
collapseThreshold={320}
defaultWidth={width}
expand={showAgentBuilderPanel}
diff --git a/src/features/ChatTerminal/index.test.tsx b/src/features/ChatTerminal/index.test.tsx
index 9709ff391b1..4c1646c9179 100644
--- a/src/features/ChatTerminal/index.test.tsx
+++ b/src/features/ChatTerminal/index.test.tsx
@@ -12,7 +12,7 @@ vi.mock('@lobechat/const', async (importOriginal) => ({
isDesktop: true,
}));
-vi.mock('@lobehub/ui', async (importOriginal) => ({
+vi.mock('@lobehub/ui/base-ui', async (importOriginal) => ({
...(await importOriginal<object>()),
DraggablePanel: ({ children, expand }: { children?: ReactNode; expand?: boolean }) => (
<div data-expand={String(expand)} data-testid="terminal-panel">
diff --git a/src/features/ChatTerminal/index.tsx b/src/features/ChatTerminal/index.tsx
index 4a20c7c0288..1e70f8e1e5e 100644
--- a/src/features/ChatTerminal/index.tsx
+++ b/src/features/ChatTerminal/index.tsx
@@ -1,8 +1,8 @@
'use client';
import { isDesktop } from '@lobechat/const';
-import { DraggablePanel } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
+import { DraggablePanel } from '@lobehub/ui/base-ui';
+import { cssVar } from 'antd-style';
import { lazy, memo, Suspense, useEffect, useState } from 'react';
import { useToggleTerminalPanelHotkey } from '@/hooks/useHotkeys';
@@ -13,20 +13,9 @@ import { systemStatusSelectors } from '@/store/global/selectors';
// panel is actually opened.
const Content = lazy(() => import('./Content'));
-const styles = createStaticStyles(({ css }) => ({
- // DraggablePanel hard-codes `transition: all 0.2s` on its inner panel. The
- // doubled selector out-specifies that without !important, so the component's
- // own inline `transition: none` still wins while dragging (no lag on resize).
- smoothResize: css`
- && {
- transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
- }
- `,
-}));
-
-// Keep in sync with the 0.3s height transition above: the panel must finish
-// collapsing before the terminal is torn down.
-const COLLAPSE_UNMOUNT_DELAY = 300;
+// Keep in sync with DraggablePanel's own collapse duration: the panel must
+// finish collapsing before the terminal is torn down.
+const COLLAPSE_UNMOUNT_DELAY = 250;
/**
* Codex-style built-in terminal: a full-width bottom panel on the chat page
@@ -61,7 +50,6 @@ const ChatTerminalPanel = memo(() => {
return (
<DraggablePanel
backgroundColor={cssVar.colorBgContainer}
- classNames={{ content: styles.smoothResize }}
expand={show}
expandable={false}
maxHeight={720}
diff --git a/src/features/Conversation/WorkingSidebar/index.tsx b/src/features/Conversation/WorkingSidebar/index.tsx
index 75e83ccb57c..00650d59538 100644
--- a/src/features/Conversation/WorkingSidebar/index.tsx
+++ b/src/features/Conversation/WorkingSidebar/index.tsx
@@ -978,7 +978,6 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
<>
{overviewPanel}
<RightPanel
- stableLayout
collapseThreshold={320}
defaultWidth={renderWidth}
expand={Boolean(showRightPanel) && fits}
@@ -988,8 +987,7 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
width={renderWidth}
onSizeChange={(size) => {
if (!size?.width) return;
- // DraggablePanel emits width as a `"420px"` string on drag-stop; parse it so
- // the controlled width actually updates (otherwise the panel snaps back).
+ // The size type allows a string on either axis, so narrow before storing.
const w = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
if (!Number.isFinite(w) || w === storedWidth) return;
updateSystemStatus({ workingSidebarWidth: w });
diff --git a/src/features/HeteroSessionImport/SidebarTree.tsx b/src/features/HeteroSessionImport/SidebarTree.tsx
index 5659b6e03f0..a98eb6bb074 100644
--- a/src/features/HeteroSessionImport/SidebarTree.tsx
+++ b/src/features/HeteroSessionImport/SidebarTree.tsx
@@ -1,7 +1,7 @@
import type { HeteroSessionDirGroup, HeteroSessionDirPref } from '@lobechat/types';
import { ClaudeCode, Codex } from '@lobehub/icons';
-import { DraggablePanel, Flexbox, Icon, ScrollShadow, Tooltip } from '@lobehub/ui';
-import { ActionIcon, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon, ScrollShadow, Tooltip } from '@lobehub/ui';
+import { ActionIcon, DraggablePanel, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { ChevronRight, Eye, EyeOff, Folder, FolderGit2, Timer, X } from 'lucide-react';
import { memo, useState } from 'react';
diff --git a/src/features/NavPanel/components/NavPanelDraggable.tsx b/src/features/NavPanel/components/NavPanelDraggable.tsx
index e314ae8fe8d..a5498a8e0e4 100644
--- a/src/features/NavPanel/components/NavPanelDraggable.tsx
+++ b/src/features/NavPanel/components/NavPanelDraggable.tsx
@@ -1,6 +1,6 @@
'use client';
-import { DraggablePanel } from '@lobehub/ui';
+import { DraggablePanel } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { type ReactNode } from 'react';
import { memo, Suspense, useMemo, useRef } from 'react';
diff --git a/src/features/NavPanel/hooks/useNavPanel.ts b/src/features/NavPanel/hooks/useNavPanel.ts
index ee870506790..a0bf6dbd93d 100644
--- a/src/features/NavPanel/hooks/useNavPanel.ts
+++ b/src/features/NavPanel/hooks/useNavPanel.ts
@@ -1,6 +1,6 @@
'use client';
-import { type DraggablePanelProps } from '@lobehub/ui';
+import { type DraggablePanelProps } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { useTypeScriptHappyCallback } from '@/hooks/useTypeScriptHappyCallback';
diff --git a/src/features/RightPanel/index.tsx b/src/features/RightPanel/index.tsx
index 6f5ec160bfb..ce133793332 100644
--- a/src/features/RightPanel/index.tsx
+++ b/src/features/RightPanel/index.tsx
@@ -1,5 +1,4 @@
-import { type DraggablePanelProps } from '@lobehub/ui';
-import { DraggablePanel } from '@lobehub/ui';
+import { DraggablePanel, type DraggablePanelProps } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo, Suspense, useState } from 'react';
diff --git a/src/routes/(main)/agent/features/Portal/features/Portal.tsx b/src/routes/(main)/agent/features/Portal/features/Portal.tsx
index 5bb2a3b412f..dd6f679186d 100644
--- a/src/routes/(main)/agent/features/Portal/features/Portal.tsx
+++ b/src/routes/(main)/agent/features/Portal/features/Portal.tsx
@@ -1,7 +1,6 @@
'use client';
-import { type DraggablePanelProps } from '@lobehub/ui';
-import { DraggablePanel } from '@lobehub/ui';
+import { DraggablePanel, type DraggablePanelProps } from '@lobehub/ui/base-ui';
import { createStaticStyles, useResponsive } from 'antd-style';
import { type PropsWithChildren } from 'react';
import { Activity, memo, useState } from 'react';
diff --git a/src/routes/(main)/group/profile/features/AgentBuilder/index.tsx b/src/routes/(main)/group/profile/features/AgentBuilder/index.tsx
index 29df5438097..744357b3888 100644
--- a/src/routes/(main)/group/profile/features/AgentBuilder/index.tsx
+++ b/src/routes/(main)/group/profile/features/AgentBuilder/index.tsx
@@ -1,5 +1,5 @@
import { BUILTIN_AGENT_SLUGS } from '@lobechat/builtin-agents';
-import { DraggablePanel } from '@lobehub/ui';
+import { DraggablePanel } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo } from 'react';