Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(ui): compose drawer close controls with IconButton (#43267)

yyhe48680f32b12
diff --git a/packages/dify-ui/src/drawer/__tests__/index.spec.tsx b/packages/dify-ui/src/drawer/__tests__/index.spec.tsx
index 1601885f20f..da77476a2dc 100644
--- a/packages/dify-ui/src/drawer/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/drawer/__tests__/index.spec.tsx
@@ -1,8 +1,9 @@
import { render } from 'vitest-browser-react'
+import { IconButton } from '../../icon-button'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerDescription,
DrawerPopup,
@@ -16,7 +17,7 @@ const asHTMLElement = (element: HTMLElement | SVGElement) => element as HTMLElem
describe('Drawer wrapper', () => {
describe('User Interactions', () => {
- it('should open a portalled drawer and close it with the default close button', async () => {
+ it('should open a portalled drawer and close it with a composed close button', async () => {
const screen = await render(
<Drawer>
<DrawerTrigger>Open settings</DrawerTrigger>
@@ -28,7 +29,13 @@ describe('Drawer wrapper', () => {
<DrawerDescription>Configure the current workspace.</DrawerDescription>
<DrawerContent>
<p>Workspace controls</p>
- <DrawerCloseButton />
+ <DrawerClose
+ render={
+ <IconButton aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</DrawerContent>
</DrawerPopup>
</DrawerViewport>
diff --git a/packages/dify-ui/src/drawer/index.stories.tsx b/packages/dify-ui/src/drawer/index.stories.tsx
index f485c987f0e..13baf234663 100644
--- a/packages/dify-ui/src/drawer/index.stories.tsx
+++ b/packages/dify-ui/src/drawer/index.stories.tsx
@@ -6,7 +6,6 @@ import {
Drawer,
DrawerBackdrop,
DrawerClose,
- DrawerCloseButton,
DrawerContent,
DrawerDescription,
DrawerIndent,
@@ -21,6 +20,7 @@ import {
} from '.'
import { Button } from '../button'
import { cn } from '../cn'
+import { IconButton } from '../icon-button'
import { Input } from '../input'
import {
ScrollArea,
@@ -47,7 +47,7 @@ const meta = {
docs: {
description: {
component:
- 'Compound drawer built on Base UI Drawer. Use it for side panels, bottom sheets, nested editor panels, snap-point sheets, and mobile navigation surfaces that need swipe gestures. If the panel only needs modal focus management without gestures, use Dialog instead.',
+ 'Compound drawer built on Base UI Drawer. Use it for side panels, bottom sheets, nested editor panels, snap-point sheets, and mobile navigation surfaces that need swipe gestures. If the panel only needs modal focus management without gestures, use Dialog instead. DrawerClose is unstyled anatomy: compose it with IconButton for an icon-only control or Button for a visible action.',
},
},
},
@@ -83,7 +83,13 @@ export const Default: Story = {
Review the key runtime defaults for this workspace.
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton className="shrink-0" aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
<div className="grid gap-3">
@@ -135,7 +141,13 @@ function ControlledDemo() {
events.
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton className="shrink-0" aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
<label
@@ -189,7 +201,13 @@ export const Positions: Story = {
popup styles.
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton className="shrink-0" aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
<div className="rounded-xl border-[0.5px] border-divider-subtle bg-components-panel-bg-alt p-4 text-sm/5 text-text-secondary">
@@ -224,7 +242,13 @@ export const Positions: Story = {
popup styles.
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton className="shrink-0" aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
<div className="rounded-xl border-[0.5px] border-divider-subtle bg-components-panel-bg-alt p-4 text-sm/5 text-text-secondary">
@@ -658,7 +682,13 @@ function NonModalDemo() {
Focus is not trapped and outside pointer dismissal is disabled.
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton className="shrink-0" aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
<div className="rounded-xl border-[0.5px] border-divider-subtle bg-background-section-burn p-3 text-sm/5 text-text-secondary">
@@ -838,7 +868,13 @@ function SwipeToOpenDemo() {
Swipe from the edge whenever you want to jump back into a panel.
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton className="shrink-0" aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1" />
<div className="flex shrink-0 items-center justify-end gap-2 border-t-[0.5px] border-divider-subtle px-6 py-4">
@@ -996,7 +1032,13 @@ function DetachedTriggersDemo() {
'This drawer is opened by a trigger outside Drawer.Root.'}
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton className="shrink-0" aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
<div className="mb-3 rounded-xl bg-state-accent-hover px-3 py-2 text-xs font-medium text-text-accent">
@@ -1054,7 +1096,13 @@ export const StackingAndAnimations: Story = {
nested data attributes.
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton className="shrink-0" aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
<div className="grid gap-3">
@@ -1082,7 +1130,17 @@ export const StackingAndAnimations: Story = {
swipe transition classes.
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton
+ className="shrink-0"
+ aria-label="Close drawer"
+ size="lg"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
<div className="rounded-xl bg-background-section-burn p-3 text-sm/5 text-text-secondary">
@@ -1147,7 +1205,13 @@ export const InstantRightPanel: Story = {
clicks.
</DrawerDescription>
</div>
- <DrawerCloseButton className="shrink-0" />
+ <DrawerClose
+ render={
+ <IconButton className="shrink-0" aria-label="Close drawer" size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-6">
<div className="rounded-xl border-[0.5px] border-divider-subtle bg-background-section-burn p-3 text-sm/5 text-text-secondary">
diff --git a/packages/dify-ui/src/drawer/index.tsx b/packages/dify-ui/src/drawer/index.tsx
index ce011901974..6bca9b88d6d 100644
--- a/packages/dify-ui/src/drawer/index.tsx
+++ b/packages/dify-ui/src/drawer/index.tsx
@@ -1,9 +1,7 @@
'use client'
-import type * as React from 'react'
import { Drawer as BaseDrawer } from '@base-ui/react/drawer'
import { cn } from '../cn'
-import { iconButtonVariants } from '../icon-button/variants'
import { resolveClassName } from '../internals/resolve-class-name'
const Drawer = BaseDrawer.Root
@@ -104,41 +102,11 @@ function DrawerContent({ className, ...props }: DrawerContentProps) {
)
}
-type DrawerCloseButtonProps = Omit<BaseDrawer.Close.Props, 'children'> & {
- children?: React.ReactNode
-}
-
-function DrawerCloseButton({
- className,
- children,
- type = 'button',
- 'aria-label': ariaLabel = 'Close drawer',
- ...props
-}: DrawerCloseButtonProps) {
- return (
- <BaseDrawer.Close
- type={type}
- aria-label={ariaLabel}
- className={(state) =>
- cn(
- iconButtonVariants({ size: 'lg' }),
- 'focus-visible:bg-state-base-hover disabled:cursor-not-allowed disabled:opacity-50 data-disabled:text-text-tertiary',
- resolveClassName(className, state),
- )
- }
- {...props}
- >
- {children ?? <span aria-hidden="true" className="i-ri-close-line size-4" />}
- </BaseDrawer.Close>
- )
-}
-
export {
createDrawerHandle,
Drawer,
DrawerBackdrop,
DrawerClose,
- DrawerCloseButton,
DrawerContent,
DrawerDescription,
DrawerIndent,
@@ -154,7 +122,6 @@ export {
export type {
DrawerBackdropProps,
- DrawerCloseButtonProps,
DrawerCloseProps,
DrawerContentProps,
DrawerDescriptionProps,
diff --git a/web/app/components/app/annotation/add-annotation-modal/index.tsx b/web/app/components/app/annotation/add-annotation-modal/index.tsx
index 12837318839..01b4c6dbc7e 100644
--- a/web/app/components/app/annotation/add-annotation-modal/index.tsx
+++ b/web/app/components/app/annotation/add-annotation-modal/index.tsx
@@ -6,13 +6,14 @@ import { Checkbox } from '@langgenius/dify-ui/checkbox'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
DrawerTitle,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import * as React from 'react'
@@ -107,9 +108,15 @@ const AddAnnotationModal: FC<Props> = ({ isShow, onHide, onAdd }) => {
<DrawerTitle className="min-w-0 truncate system-xl-semibold text-text-primary">
{t(($) => $['addModal.title'], { ns: 'appAnnotation' })}
</DrawerTitle>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
</div>
diff --git a/web/app/components/app/annotation/edit-annotation-modal/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/index.tsx
index 52c351adb86..4b8c812bc68 100644
--- a/web/app/components/app/annotation/edit-annotation-modal/index.tsx
+++ b/web/app/components/app/annotation/edit-annotation-modal/index.tsx
@@ -11,13 +11,14 @@ import {
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
DrawerTitle,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import * as React from 'react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -101,9 +102,15 @@ const EditAnnotationModal: FC<Props> = ({
<DrawerTitle className="min-w-0 truncate system-xl-semibold text-text-primary">
{t(($) => $['editModal.title'], { ns: 'appAnnotation' })}
</DrawerTitle>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
</div>
diff --git a/web/app/components/app/annotation/view-annotation-modal/index.tsx b/web/app/components/app/annotation/view-annotation-modal/index.tsx
index 091c22fe747..2ee5a2253ef 100644
--- a/web/app/components/app/annotation/view-annotation-modal/index.tsx
+++ b/web/app/components/app/annotation/view-annotation-modal/index.tsx
@@ -13,13 +13,14 @@ import { cn } from '@langgenius/dify-ui/cn'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
DrawerTitle,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Pagination } from '@langgenius/dify-ui/pagination'
import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'
import * as React from 'react'
@@ -239,9 +240,15 @@ const ViewAnnotationModal: FC<Props> = ({ appId, isShow, onHide, item, onSave, o
)}
</TabsTab>
</TabsList>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto">
diff --git a/web/app/components/app/configuration/configuration-view/index.tsx b/web/app/components/app/configuration/configuration-view/index.tsx
index a9311985a10..5e67467df15 100644
--- a/web/app/components/app/configuration/configuration-view/index.tsx
+++ b/web/app/components/app/configuration/configuration-view/index.tsx
@@ -16,12 +16,13 @@ import { Button } from '@langgenius/dify-ui/button'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Separator } from '@langgenius/dify-ui/separator'
import { produce } from 'immer'
import * as React from 'react'
@@ -254,9 +255,15 @@ const ConfigurationView: FC<ConfigurationViewModel> = ({
<DrawerPopup className="data-[swipe-direction=right]:w-full data-[swipe-direction=right]:max-w-sm">
<DrawerContent className="flex min-h-0 flex-1 flex-col">
<div className="mb-4 flex shrink-0 justify-end">
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
<Debug
diff --git a/web/app/components/base/features/new-feature-panel/index.tsx b/web/app/components/base/features/new-feature-panel/index.tsx
index d9e77fb3f4c..76cf9fdae5f 100644
--- a/web/app/components/base/features/new-feature-panel/index.tsx
+++ b/web/app/components/base/features/new-feature-panel/index.tsx
@@ -2,7 +2,8 @@ import type { ReactNode } from 'react'
import type { OnFeaturesChange } from '@/app/components/base/features/types'
import type { InputVar } from '@/app/components/workflow/types'
import type { PromptVariable } from '@/models/debug'
-import { DrawerCloseButton, DrawerTitle } from '@langgenius/dify-ui/drawer'
+import { DrawerClose, DrawerTitle } from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useQueryState } from 'nuqs'
import { useTranslation } from 'react-i18next'
import AnnotationReply from '@/app/components/base/features/new-feature-panel/annotation-reply'
@@ -83,9 +84,12 @@ const NewFeaturePanel = ({
{description ?? t(($) => $['common.featuresDescription'], { ns: 'workflow' })}
</div>
</div>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-8 p-2"
+ <DrawerClose
+ render={
+ <IconButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
{/* list */}
diff --git a/web/app/components/base/float-right-container/index.tsx b/web/app/components/base/float-right-container/index.tsx
index 21b76222778..5a8ac99f5aa 100644
--- a/web/app/components/base/float-right-container/index.tsx
+++ b/web/app/components/base/float-right-container/index.tsx
@@ -4,13 +4,14 @@ import { cn } from '@langgenius/dify-ui/cn'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
DrawerTitle,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useTranslation } from 'react-i18next'
type IFloatRightContainerProps = {
@@ -68,9 +69,15 @@ const FloatRightContainer = ({
</DrawerTitle>
)}
{showClose && (
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
)}
</div>
diff --git a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx
index 17f2cd8a2e9..dc998425013 100644
--- a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx
+++ b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx
@@ -16,7 +16,7 @@ import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
@@ -230,9 +230,15 @@ const DatasetMetadataDrawer: FC<Props> = ({
<DrawerTitle className="text-lg/6 font-medium text-text-primary">
{t(($) => $['metadata.metadata'], { ns: 'dataset' })}
</DrawerTitle>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-4 pb-6">
diff --git a/web/app/components/integrations/index.tsx b/web/app/components/integrations/index.tsx
index 130041d2a16..d1380e71874 100644
--- a/web/app/components/integrations/index.tsx
+++ b/web/app/components/integrations/index.tsx
@@ -9,7 +9,7 @@ import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '@langgenius/d
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
@@ -17,6 +17,7 @@ import {
DrawerTrigger,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import {
ScrollArea,
ScrollAreaContent,
@@ -397,8 +398,15 @@ export default function IntegrationsPage({
<DrawerPopup className="data-[swipe-direction=left]:w-80 data-[swipe-direction=left]:max-w-full">
<div className="flex shrink-0 items-center justify-between gap-2 px-3 py-2">
<DrawerTitle className="system-md-semibold">{integrationsTitle}</DrawerTitle>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="lg"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
<DrawerContent className="min-h-0 flex-1 p-0 pb-0">{sidebar}</DrawerContent>
diff --git a/web/app/components/main-nav/responsive-main-nav.tsx b/web/app/components/main-nav/responsive-main-nav.tsx
index d21a2d213f2..473483f5ded 100644
--- a/web/app/components/main-nav/responsive-main-nav.tsx
+++ b/web/app/components/main-nav/responsive-main-nav.tsx
@@ -5,7 +5,7 @@ import { Button } from '@langgenius/dify-ui/button'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
@@ -13,6 +13,7 @@ import {
DrawerTrigger,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useSyncExternalStore } from 'react'
import { useTranslation } from 'react-i18next'
import { MainNav } from '.'
@@ -47,7 +48,13 @@ export function ResponsiveMainNav({ initialPlatform }: Pick<MainNavProps, 'initi
<DrawerTitle className="system-md-semibold">
{t(($) => $['navigation.primary'])}
</DrawerTitle>
- <DrawerCloseButton aria-label={t(($) => $['operation.close'])} />
+ <DrawerClose
+ render={
+ <IconButton aria-label={t(($) => $['operation.close'])} size="lg">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
<DrawerContent className="touch-auto p-0 pb-0">
<MainNav
diff --git a/web/app/components/plugins/readme-panel/drawer.tsx b/web/app/components/plugins/readme-panel/drawer.tsx
index 732cacb88da..e091c3cd344 100644
--- a/web/app/components/plugins/readme-panel/drawer.tsx
+++ b/web/app/components/plugins/readme-panel/drawer.tsx
@@ -4,13 +4,14 @@ import type { ReadmePanelState } from './store'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
DrawerTitle,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useTranslation } from 'react-i18next'
import { ReadmePanelContent } from './content'
@@ -45,8 +46,15 @@ export function ReadmeDrawer({ detail, open, onOpenChange, triggerId }: ReadmeDr
</DrawerTitle>
}
closeButton={
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="lg"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
}
/>
diff --git a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx
index a7ac36b3e68..a3d3bbc68bf 100644
--- a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx
+++ b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx
@@ -5,7 +5,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
@@ -14,6 +14,7 @@ import {
} from '@langgenius/dify-ui/drawer'
import { Field, FieldItem, FieldLabel } from '@langgenius/dify-ui/field'
import { Fieldset, FieldsetLegend } from '@langgenius/dify-ui/fieldset'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Infotip, InfotipContent, InfotipTrigger } from '@langgenius/dify-ui/infotip'
import { Input } from '@langgenius/dify-ui/input'
import { Radio, RadioGroup } from '@langgenius/dify-ui/radio-group'
@@ -119,9 +120,15 @@ export default function ConfigCredential({ positionCenter, credential, onChange,
<DrawerTitle className="min-w-0 truncate system-xl-semibold text-text-primary">
{t(($) => $['createTool.authMethod.title'], { ns: 'tools' })}
</DrawerTitle>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
</div>
diff --git a/web/app/components/tools/edit-custom-collection-modal/index.tsx b/web/app/components/tools/edit-custom-collection-modal/index.tsx
index 63fbe67df80..b15f5b18a53 100644
--- a/web/app/components/tools/edit-custom-collection-modal/index.tsx
+++ b/web/app/components/tools/edit-custom-collection-modal/index.tsx
@@ -6,7 +6,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
@@ -232,9 +232,15 @@ const EditCustomCollectionModal: FC<Props> = ({
<DrawerTitle className="min-w-0 truncate system-xl-semibold text-text-primary">
{t(($) => $[`createTool.${isAdd ? 'title' : 'editTitle'}`], { ns: 'tools' })}
</DrawerTitle>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
</div>
diff --git a/web/app/components/tools/edit-custom-collection-modal/test-api.tsx b/web/app/components/tools/edit-custom-collection-modal/test-api.tsx
index 1e0a145f62b..29c4c5a5e22 100644
--- a/web/app/components/tools/edit-custom-collection-modal/test-api.tsx
+++ b/web/app/components/tools/edit-custom-collection-modal/test-api.tsx
@@ -10,13 +10,14 @@ import { cn } from '@langgenius/dify-ui/cn'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
DrawerTitle,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { RiSettings2Line } from '@remixicon/react'
import * as React from 'react'
@@ -99,9 +100,15 @@ const TestApi: FC<Props> = ({ positionCenter, customCollection, tool, onHide })
<DrawerTitle className="min-w-0 truncate system-xl-semibold text-text-primary">
{`${t(($) => $['test.title'], { ns: 'tools' })} ${toolName}`}
</DrawerTitle>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
</div>
diff --git a/web/app/components/tools/setting/build-in/config-credentials.tsx b/web/app/components/tools/setting/build-in/config-credentials.tsx
index bc16c4db37e..92b644a4e17 100644
--- a/web/app/components/tools/setting/build-in/config-credentials.tsx
+++ b/web/app/components/tools/setting/build-in/config-credentials.tsx
@@ -6,7 +6,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerDescription,
DrawerPopup,
@@ -14,6 +14,7 @@ import {
DrawerTitle,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { noop } from 'es-toolkit/function'
import * as React from 'react'
import { useEffect, useState } from 'react'
@@ -101,9 +102,15 @@ const ConfigCredential: FC<Props> = ({
<DrawerTitle className="min-w-0 truncate system-xl-semibold text-text-primary">
{t(($) => $['auth.setupModalTitle'], { ns: 'tools' })}
</DrawerTitle>
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
<DrawerDescription className="pr-10 pl-6 system-xs-regular text-text-tertiary">
diff --git a/web/app/components/tools/workflow-tool/index.tsx b/web/app/components/tools/workflow-tool/index.tsx
index ca856a549c8..f3a8b09f499 100644
--- a/web/app/components/tools/workflow-tool/index.tsx
+++ b/web/app/components/tools/workflow-tool/index.tsx
@@ -13,7 +13,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
@@ -21,6 +21,7 @@ import {
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Infotip, InfotipContent, InfotipTrigger } from '@langgenius/dify-ui/infotip'
import { Input } from '@langgenius/dify-ui/input'
import { Textarea } from '@langgenius/dify-ui/textarea'
@@ -122,7 +123,13 @@ const WorkflowToolDrawerFrame = ({
<DrawerTitle className="min-w-0 truncate system-xl-semibold text-text-primary">
{title}
</DrawerTitle>
- <DrawerCloseButton className="size-6 rounded-md" aria-label={closeLabel} />
+ <DrawerClose
+ render={
+ <IconButton aria-label={closeLabel} size="md">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
</div>
</div>
<div className="grow overflow-hidden">{children}</div>
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx
index a423f22781b..eb0926ec7df 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx
@@ -12,7 +12,7 @@ import {
} from '@langgenius/dify-ui/dialog'
import {
Drawer,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerPopup,
DrawerPortal,
@@ -26,6 +26,7 @@ import {
DropdownMenuTrigger,
} from '@langgenius/dify-ui/dropdown-menu'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '@langgenius/dify-ui/popover'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -248,9 +249,15 @@ function AgentRosterDrawer({
</div>
</>
)}
- <DrawerCloseButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="size-6 rounded-md"
+ <DrawerClose
+ render={
+ <IconButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="md"
+ >
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
</div>
diff --git a/web/features/new-rag/processing-tasks-drawer.tsx b/web/features/new-rag/processing-tasks-drawer.tsx
index 3ebb99c1ec4..6c3af74612e 100644
--- a/web/features/new-rag/processing-tasks-drawer.tsx
+++ b/web/features/new-rag/processing-tasks-drawer.tsx
@@ -9,7 +9,7 @@ import { Button } from '@langgenius/dify-ui/button'
import {
Drawer,
DrawerBackdrop,
- DrawerCloseButton,
+ DrawerClose,
DrawerContent,
DrawerDescription,
DrawerPopup,
@@ -17,6 +17,7 @@ import {
DrawerTitle,
DrawerViewport,
} from '@langgenius/dify-ui/drawer'
+import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useMutation } from '@tanstack/react-query'
import { useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
import { useTranslation } from 'react-i18next'
@@ -394,10 +395,13 @@ export function ProcessingTasksDrawer({
<DrawerTitle className="system-md-semibold text-text-primary">
{t(($) => $['newKnowledge.backgroundTasks'])}
</DrawerTitle>
- <DrawerCloseButton
+ <DrawerClose
ref={drawerCloseButtonRef}
- aria-label={tCommon(($) => $['operation.close'])}
- className="size-6 rounded-md"
+ render={
+ <IconButton aria-label={tCommon(($) => $['operation.close'])} size="md">
+ <span aria-hidden="true" className="i-ri-close-line size-4" />
+ </IconButton>
+ }
/>
</div>
<DrawerDescription className="mt-1 system-xs-regular text-text-tertiary">