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.

refactor(dify-ui): compose dialogs from the Design Kit anatomy (#44221)

yyh311a708c1e59
diff --git a/e2e/features/step-definitions/agent-v2/access-point-service-api.steps.ts b/e2e/features/step-definitions/agent-v2/access-point-service-api.steps.ts
index cd43476ecff..31929a78157 100644
--- a/e2e/features/step-definitions/agent-v2/access-point-service-api.steps.ts
+++ b/e2e/features/step-definitions/agent-v2/access-point-service-api.steps.ts
@@ -84,7 +84,7 @@ When('I create a new Agent v2 API key', async function (this: DifyWorld) {
})
Then('I should see the newly generated Agent v2 API key', async function (this: DifyWorld) {
- const generatedKeyDialog = this.getPage().getByRole('alertdialog', {
+ const generatedKeyDialog = this.getPage().getByRole('dialog', {
name: CREATED_API_KEY_DIALOG_NAME,
})
const generatedKey = generatedKeyDialog.getByRole('textbox', { name: 'Secret Key' })
@@ -95,7 +95,7 @@ Then('I should see the newly generated Agent v2 API key', async function (this:
})
When('I copy the newly generated Agent v2 API key', async function (this: DifyWorld) {
- const generatedKeyDialog = this.getPage().getByRole('alertdialog', {
+ const generatedKeyDialog = this.getPage().getByRole('dialog', {
name: CREATED_API_KEY_DIALOG_NAME,
})
@@ -105,7 +105,7 @@ When('I copy the newly generated Agent v2 API key', async function (this: DifyWo
Then(
'the newly generated Agent v2 API key should show it was copied',
async function (this: DifyWorld) {
- const generatedKeyDialog = this.getPage().getByRole('alertdialog', {
+ const generatedKeyDialog = this.getPage().getByRole('dialog', {
name: CREATED_API_KEY_DIALOG_NAME,
})
@@ -117,7 +117,7 @@ Then(
When('I close the newly generated Agent v2 API key', async function (this: DifyWorld) {
const page = this.getPage()
- const generatedKeyDialog = page.getByRole('alertdialog', { name: CREATED_API_KEY_DIALOG_NAME })
+ const generatedKeyDialog = page.getByRole('dialog', { name: CREATED_API_KEY_DIALOG_NAME })
await generatedKeyDialog.getByRole('button', { name: 'I have saved this key' }).click()
await expect(generatedKeyDialog).not.toBeVisible()
diff --git a/lint.config.ts b/lint.config.ts
index 3b59024ce89..fbb2bad8498 100644
--- a/lint.config.ts
+++ b/lint.config.ts
@@ -8,11 +8,11 @@ const webPackageJson = path.resolve(rootDir, 'web/package.json')
const difyUiPackageJson = path.resolve(rootDir, 'packages/dify-ui/package.json')
const enableTailwindCanonicalClasses = process.env.TAILWIND_CANONICAL_CLASSES === 'true'
-export const hintContentRules = {
+export const stylingContractRules = {
'shadcn/no-restyle': [
'error',
{
- componentImports: ['^@langgenius/dify-ui/(tooltip|infotip)$'],
+ componentImports: ['^@langgenius/dify-ui/(tooltip|infotip|dialog|alert-dialog)$'],
allow: ['*'],
contracts: [
{
@@ -29,6 +29,66 @@ export const hintContentRules = {
message:
'"{{className}}" is outside the InfotipContent styling contract. Use the default hint surface, spacing, typography, and wrapping from packages/dify-ui/src/infotip/index.tsx; callers may constrain width or preserve content line breaks.',
},
+ {
+ pattern: '^(Dialog|AlertDialog)Content$',
+ // A fixed-height surface may stop scrolling itself (`overflow-hidden`) and hand its
+ // remaining height to content that scrolls (`flex flex-col`).
+ allow: [
+ 'w-*',
+ 'min-w-*',
+ 'max-w-*',
+ 'h-*',
+ 'min-h-*',
+ 'max-h-*',
+ 'flex',
+ 'flex-col',
+ 'overflow-hidden',
+ ],
+ deny: [
+ 'flex-1',
+ 'flex-auto',
+ 'flex-initial',
+ 'flex-none',
+ 'flex-row',
+ 'flex-row-reverse',
+ 'flex-col-reverse',
+ 'flex-wrap',
+ 'flex-nowrap',
+ ],
+ message:
+ '"{{className}}" is outside the {{component}} styling contract. The surface owns position, chrome and scrolling, and its parts own spacing; callers may only size it. Compose DialogPortal, DialogBackdrop and DialogPopup for a custom surface.',
+ },
+ {
+ pattern: '^DialogPopup$',
+ allow: ['*'],
+ deny: ['top-1/2', 'left-1/2', '-translate-x-1/2', '-translate-y-1/2'],
+ message:
+ '"{{className}}" recreates the DialogContent centering. Use DialogContent for a centered dialog; DialogPopup is for a surface that places itself.',
+ },
+ {
+ pattern: '^(Dialog|AlertDialog)(Title|Description)$',
+ allow: ['sr-only'],
+ message:
+ '"{{className}}" is outside the {{component}} styling contract. Use its default typography and colour; callers may only hide it visually.',
+ },
+ {
+ pattern: '^(DialogHeader|AlertDialogHeader|AlertDialogFooter)$',
+ allow: [],
+ message:
+ '"{{className}}" is outside the {{component}} styling contract. The part owns its spacing and layout.',
+ },
+ {
+ pattern: '^DialogFooter$',
+ allow: ['flex-col', 'items-stretch'],
+ message:
+ '"{{className}}" is outside the DialogFooter styling contract. The footer owns its spacing and alignment; callers may stack full-width actions.',
+ },
+ {
+ pattern: '^DialogBody$',
+ allow: ['layout', 'gap-*', 'space-x-*', 'space-y-*'],
+ message:
+ '"{{className}}" is outside the DialogBody styling contract. The body owns the content gutter; callers may lay out its content.',
+ },
],
},
],
@@ -825,7 +885,7 @@ export const lintConfig = {
},
{
files: ['web/**/*.{jsx,tsx}'],
- rules: hintContentRules,
+ rules: stylingContractRules,
},
{
files: ['web/**/*.stories.{js,cjs,mjs,jsx,ts,tsx}', 'web/**/*.story.{js,cjs,mjs,jsx,ts,tsx}'],
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index cbc135142b4..8e8dc1f1015 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -42,6 +42,11 @@
"count": 3
}
},
+ "web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
"web/app/(shareLayout)/webapp-signin/normalForm.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 2
@@ -50,6 +55,11 @@
"count": 2
}
},
+ "web/app/account/(commonLayout)/delete-account/index.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
"web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -110,6 +120,21 @@
"count": 5
}
},
+ "web/app/components/app/app-access-control/__tests__/access-control.spec.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "web/app/components/app/app-access-control/access-control-dialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "web/app/components/app/app-access-control/access-control-form.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
"web/app/components/app/configuration/config-prompt/__tests__/index.spec.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -219,6 +244,9 @@
"web/app/components/app/configuration/dataset-config/params-config/index.tsx": {
"eslint-react/set-state-in-effect": {
"count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 1
}
},
"web/app/components/app/configuration/dataset-config/settings-modal/index.tsx": {
@@ -288,6 +316,16 @@
"count": 1
}
},
+ "web/app/components/app/deploy/shared/deployment-configuration/index.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "web/app/components/app/deploy/shared/version-selection/index.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
"web/app/components/app/in-site-message/__tests__/notification.spec.tsx": {
"@tanstack/query/prefer-query-options": {
"count": 1
@@ -1297,6 +1335,11 @@
"count": 2
}
},
+ "web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
"web/app/components/datasets/documents/detail/completed/components/segment-list-content.tsx": {
"typescript/no-non-null-asserted-optional-chain": {
"count": 1
@@ -1584,6 +1627,11 @@
"count": 2
}
},
+ "web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
"web/app/components/plugins/marketplace/home/home-trending.tsx": {
"jsx-a11y/no-static-element-interactions": {
"count": 1
@@ -1699,6 +1747,11 @@
"count": 8
}
},
+ "web/app/components/plugins/update-plugin/from-market-place.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
"web/app/components/rag-pipeline/components/panel/input-field/editor/form/__tests__/hidden-fields.spec.tsx": {
"eslint-react/static-components": {
"count": 4
@@ -3371,11 +3424,6 @@
"count": 1
}
},
- "web/hooks/use-pay.tsx": {
- "eslint-react/set-state-in-effect": {
- "count": 4
- }
- },
"web/i18n/index.ts": {
"no-barrel-files/no-barrel-files": {
"count": 1
diff --git a/packages/dify-ui/src/alert-dialog/index.tsx b/packages/dify-ui/src/alert-dialog/index.tsx
index 0fe831ab394..065c95e6032 100644
--- a/packages/dify-ui/src/alert-dialog/index.tsx
+++ b/packages/dify-ui/src/alert-dialog/index.tsx
@@ -59,7 +59,8 @@ function AlertDialogContent({
<BaseAlertDialog.Popup
className={(state) =>
cn(
- 'fixed top-1/2 left-1/2 max-h-[calc(100vh-2rem)] w-120 max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg',
+ // Radius, border and surface match DialogPopup; change both together.
+ 'fixed top-1/2 left-1/2 max-h-[calc(100dvh-2rem)] w-120 max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg',
modalPopupAnimationClassName,
resolveClassName(className, state),
)
@@ -85,6 +86,7 @@ function AlertDialogTitle({ className, ...props }: AlertDialogTitleProps) {
<BaseAlertDialog.Title
className={(state) =>
cn(
+ // Same look as DialogTitle; change both together.
'title-2xl-semi-bold wrap-break-word text-text-primary',
resolveClassName(className, state),
)
diff --git a/packages/dify-ui/src/dialog/index.stories.tsx b/packages/dify-ui/src/dialog/index.stories.tsx
index e9f6842386b..3b21614f780 100644
--- a/packages/dify-ui/src/dialog/index.stories.tsx
+++ b/packages/dify-ui/src/dialog/index.stories.tsx
@@ -5,9 +5,13 @@ import {
createDialogHandle,
Dialog,
DialogBackdrop,
+ DialogBody,
DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogPopup,
DialogPortal,
DialogTitle,
@@ -35,7 +39,7 @@ const meta = {
docs: {
description: {
component:
- 'Compound modal dialog built on Base UI Dialog. Use it for focused flows that interrupt the user, such as editing settings, confirming non-destructive actions, or collecting short-form input. `DialogClose` is unstyled anatomy: compose it with `IconButton` for an icon-only control or `Button` for a visible action.',
+ 'Compound modal dialog built on Base UI Dialog. Use it for focused flows that interrupt the user, such as editing settings, confirming non-destructive actions, or collecting short-form input. Compose `DialogHeader`, `DialogBody` and `DialogFooter` inside `DialogContent`; the parts own the spacing, so call sites only arrange their content. `DialogCloseButton` is the header close icon; `DialogClose` stays unstyled for visible actions such as Cancel.',
},
},
},
@@ -51,37 +55,19 @@ const releaseNoteItems = Array.from({ length: 24 }, (_, index) => ({
body: 'Refined a workflow behavior so long content naturally overflows and scrolls inside the dialog.',
}))
-function ReleaseNoteHeader({ title, description }: { title: string; description: string }) {
- return (
- <div className="flex shrink-0 flex-col gap-2 p-6 pr-12 pb-4">
- <DialogTitle className="text-lg leading-7 font-semibold text-text-primary">
- {title}
- </DialogTitle>
- <DialogDescription className="text-sm leading-5 text-text-secondary">
- {description}
- </DialogDescription>
- </div>
- )
-}
-
function ReleaseNoteSections() {
return (
- <div className="flex flex-col gap-3 px-6 py-2 text-sm leading-5 text-text-secondary">
+ <DialogBody className="flex flex-col gap-3">
{releaseNoteItems.map((item) => (
- <section key={item.id} className="rounded-lg bg-background-default-subtle px-3 py-2">
- <h3 className="font-medium text-text-primary">{item.title}</h3>
+ <section
+ key={item.id}
+ className="rounded-lg bg-background-default-subtle px-3 py-2 system-sm-regular text-text-secondary"
+ >
+ <h3 className="system-sm-medium text-text-primary">{item.title}</h3>
<p>{item.body}</p>
</section>
))}
- </div>
- )
-}
-
-function ReleaseNoteFooter() {
- return (
- <div className="flex shrink-0 justify-end border-t border-divider-subtle p-4">
- <DialogClose render={<Button />}>Close</DialogClose>
- </div>
+ </DialogBody>
)
}
@@ -90,30 +76,22 @@ export const Default: Story = {
<Dialog>
<DialogTrigger render={<Button />}>Open dialog</DialogTrigger>
<DialogContent>
- <DialogClose
- render={
- <IconButton aria-label="Close dialog" size="lg" className="absolute inset-e-6 top-6">
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="flex flex-col gap-2 pr-8">
- <DialogTitle className="text-lg leading-7 font-semibold text-text-primary">
- Invite collaborators
- </DialogTitle>
- <DialogDescription className="text-sm leading-5 text-text-secondary">
+ <DialogHeader>
+ <DialogTitle>Invite collaborators</DialogTitle>
+ <DialogDescription>
Add teammates by email to share this workspace. They will receive an invitation link.
</DialogDescription>
- </div>
- <div className="mt-5 flex flex-col gap-2">
- <label className="text-xs font-medium text-text-tertiary" htmlFor="invite-email">
- Email address
- </label>
- <Input id="invite-email" type="email" placeholder="[email protected]" />
- </div>
- <div className="mt-6 flex items-center justify-end">
+ <DialogCloseButton aria-label="Close dialog" />
+ </DialogHeader>
+ <DialogBody>
+ <Field name="email">
+ <FieldLabel>Email address</FieldLabel>
+ <Input type="email" placeholder="[email protected]" />
+ </Field>
+ </DialogBody>
+ <DialogFooter>
<Button variant="primary">Send invite</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
),
@@ -142,19 +120,17 @@ export const WithoutCloseButton: Story = {
<Dialog>
<DialogTrigger render={<Button />}>Start onboarding</DialogTrigger>
<DialogContent>
- <div className="flex flex-col gap-2">
- <DialogTitle className="text-lg leading-7 font-semibold text-text-primary">
- Welcome to Dify
- </DialogTitle>
- <DialogDescription className="text-sm leading-5 text-text-secondary">
+ <DialogHeader>
+ <DialogTitle>Welcome to Dify</DialogTitle>
+ <DialogDescription>
Let's get your workspace ready. This takes about a minute and sets up your default
models, datasets, and API keys.
</DialogDescription>
- </div>
- <div className="mt-6 flex items-center justify-end gap-2">
- <Button variant="secondary">Skip for now</Button>
+ </DialogHeader>
+ <DialogFooter>
+ <DialogClose render={<Button />}>Skip for now</DialogClose>
<Button variant="primary">Start setup</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
),
@@ -171,30 +147,25 @@ function ControlledDemo() {
<span className="text-xs text-text-tertiary">State: {open ? 'open' : 'closed'}</span>
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent>
- <DialogClose
- render={
- <IconButton aria-label="Close dialog" size="lg" className="absolute inset-e-6 top-6">
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="flex flex-col gap-2 pr-8">
- <DialogTitle className="text-lg leading-7 font-semibold text-text-primary">
- Rename workspace
- </DialogTitle>
- <DialogDescription className="text-sm leading-5 text-text-secondary">
+ <DialogHeader>
+ <DialogTitle>Rename workspace</DialogTitle>
+ <DialogDescription>
The workspace URL will stay the same, but the display name updates everywhere.
</DialogDescription>
- </div>
- <Input type="text" defaultValue="Acme Workspace" className="mt-4" />
- <div className="mt-6 flex items-center justify-end gap-2">
- <Button variant="secondary" onClick={() => setOpen(false)}>
- Cancel
- </Button>
+ <DialogCloseButton aria-label="Close dialog" />
+ </DialogHeader>
+ <DialogBody>
+ <Field name="name">
+ <FieldLabel>Workspace name</FieldLabel>
+ <Input type="text" defaultValue="Acme Workspace" />
+ </Field>
+ </DialogBody>
+ <DialogFooter>
+ <Button onClick={() => setOpen(false)}>Cancel</Button>
<Button variant="primary" onClick={() => setOpen(false)}>
Save
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
</div>
@@ -236,27 +207,18 @@ function DetachedTriggersDemo() {
<Dialog handle={dialogHandle}>
{({ payload }) => (
<DialogContent>
- <DialogClose
- render={
- <IconButton
- aria-label="Close dialog"
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="grid gap-2 pr-8">
- <DialogTitle className="text-lg leading-7 font-semibold text-text-primary">
- {payload ? `Edit ${payload.name}` : 'Edit workspace'}
- </DialogTitle>
- <DialogDescription className="text-sm leading-5 text-text-secondary">
+ <DialogHeader>
+ <DialogTitle>{payload ? `Edit ${payload.name}` : 'Edit workspace'}</DialogTitle>
+ <DialogDescription>
{payload
? `${payload.memberCount} members currently have access to this workspace.`
: 'Choose a workspace to edit.'}
</DialogDescription>
- </div>
+ <DialogCloseButton aria-label="Close dialog" />
+ </DialogHeader>
+ <DialogFooter>
+ <DialogClose render={<Button variant="primary" />}>Done</DialogClose>
+ </DialogFooter>
</DialogContent>
)}
</Dialog>
@@ -281,31 +243,20 @@ function FormDialogDemo() {
return (
<Dialog open={open} onOpenChange={setOpen} disablePointerDismissal>
<DialogTrigger render={<Button />}>Configure API extension</DialogTrigger>
- <DialogPortal>
- <DialogBackdrop forceRender />
- <DialogPopup
- initialFocus={nameInputRef}
- className="fixed top-1/2 left-1/2 max-h-[80dvh] w-160 max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain p-6"
- >
- <DialogClose
- render={
- <IconButton aria-label="Close dialog" size="lg" className="absolute inset-e-6 top-6">
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="grid gap-2 pr-8">
- <DialogTitle className="text-lg leading-7 font-semibold text-text-primary">
- Configure API extension
- </DialogTitle>
- <DialogDescription className="text-sm leading-5 text-text-secondary">
- Save the endpoint and credentials used by this workspace integration.
- </DialogDescription>
- </div>
- <Form<ApiExtensionFormValues>
- className="grid gap-4 pt-5"
- onFormSubmit={() => setOpen(false)}
- >
+ <DialogContent
+ initialFocus={nameInputRef}
+ className="w-160"
+ backdropProps={{ forceRender: true }}
+ >
+ <DialogHeader>
+ <DialogTitle>Configure API extension</DialogTitle>
+ <DialogDescription>
+ Save the endpoint and credentials used by this workspace integration.
+ </DialogDescription>
+ <DialogCloseButton aria-label="Close dialog" />
+ </DialogHeader>
+ <Form<ApiExtensionFormValues> onFormSubmit={() => setOpen(false)}>
+ <DialogBody className="flex flex-col gap-4">
<Field name="name">
<FieldLabel>Name</FieldLabel>
<Input ref={nameInputRef} required placeholder="Production API" />
@@ -341,17 +292,15 @@ function FormDialogDemo() {
<FieldError match="valueMissing">API key is required.</FieldError>
<FieldError match="customError" />
</Field>
- <div className="mt-2 flex items-center justify-end gap-2">
- <Button type="button" onClick={() => setOpen(false)}>
- Cancel
- </Button>
- <Button type="submit" variant="primary">
- Save
- </Button>
- </div>
- </Form>
- </DialogPopup>
- </DialogPortal>
+ </DialogBody>
+ <DialogFooter>
+ <DialogClose render={<Button />}>Cancel</DialogClose>
+ <Button type="submit" variant="primary">
+ Save
+ </Button>
+ </DialogFooter>
+ </Form>
+ </DialogContent>
</Dialog>
)
}
@@ -391,23 +340,18 @@ function OutsideScrollingContentDemo() {
initialFocus={popupRef}
className="relative mx-auto flex w-120 max-w-[calc(100vw-2rem)] flex-col overflow-hidden outline-hidden transition-[translate] duration-700 ease-[cubic-bezier(0.45,1.005,0,1.005)] data-ending-style:translate-y-[max(100dvh,100%)] data-ending-style:scale-100 data-ending-style:opacity-100 data-ending-style:duration-350 data-ending-style:ease-[cubic-bezier(0.375,0.015,0.545,0.455)] data-starting-style:translate-y-[100dvh] data-starting-style:scale-100 data-starting-style:opacity-100"
>
- <DialogClose
- render={
- <IconButton
- aria-label="Close dialog"
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <ReleaseNoteHeader
- title="Long release notes"
- description="This layout lets the outer dialog viewport scroll while the popup keeps its natural height."
- />
+ <DialogHeader>
+ <DialogTitle>Long release notes</DialogTitle>
+ <DialogDescription>
+ This layout lets the outer dialog viewport scroll while the popup keeps its
+ natural height.
+ </DialogDescription>
+ <DialogCloseButton aria-label="Close dialog" />
+ </DialogHeader>
<ReleaseNoteSections />
- <ReleaseNoteFooter />
+ <DialogFooter>
+ <DialogClose render={<Button />}>Close</DialogClose>
+ </DialogFooter>
</DialogPopup>
</ScrollAreaContent>
</ScrollAreaViewport>
@@ -475,21 +419,11 @@ function InsideScrollingContentDemo() {
<DialogBackdrop />
<DialogViewport className="flex items-center justify-center overflow-hidden p-4">
<DialogPopup className="relative flex h-[min(44rem,calc(100dvh-2rem))] min-h-0 w-120 max-w-[calc(100vw-2rem)] flex-col overflow-hidden">
- <DialogClose
- render={
- <IconButton
- aria-label="Close dialog"
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <ReleaseNoteHeader
- title="Release notes"
- description="Highlights from the latest workspace update."
- />
+ <DialogHeader>
+ <DialogTitle>Release notes</DialogTitle>
+ <DialogDescription>Highlights from the latest workspace update.</DialogDescription>
+ <DialogCloseButton aria-label="Close dialog" />
+ </DialogHeader>
<ScrollArea className="flex min-h-0 flex-auto overflow-hidden">
<ScrollAreaViewport
aria-label="Release note improvements"
@@ -504,7 +438,9 @@ function InsideScrollingContentDemo() {
<ScrollAreaThumb />
</ScrollAreaScrollbar>
</ScrollArea>
- <ReleaseNoteFooter />
+ <DialogFooter>
+ <DialogClose render={<Button />}>Close</DialogClose>
+ </DialogFooter>
</DialogPopup>
</DialogViewport>
</DialogPortal>
diff --git a/packages/dify-ui/src/dialog/index.tsx b/packages/dify-ui/src/dialog/index.tsx
index 942157a118a..0207d70a8ed 100644
--- a/packages/dify-ui/src/dialog/index.tsx
+++ b/packages/dify-ui/src/dialog/index.tsx
@@ -3,13 +3,12 @@
import type * as React from 'react'
import { Dialog as BaseDialog } from '@base-ui/react/dialog'
import { cn } from '../cn'
+import { IconButton } from '../icon-button'
import { focusRingClassName } from '../internal/focus'
import { modalBackdropClassName, modalPopupAnimationClassName } from '../internal/overlay'
import { resolveClassName } from '../internal/resolve-class-name'
const Dialog = BaseDialog.Root
-const DialogTitle = BaseDialog.Title
-const DialogDescription = BaseDialog.Description
const DialogPortal = BaseDialog.Portal
const DialogClose = BaseDialog.Close
const createDialogHandle = BaseDialog.createHandle
@@ -31,7 +30,37 @@ function DialogTrigger<Payload = unknown>({ className, ...props }: DialogTrigger
)
}
type DialogTitleProps = BaseDialog.Title.Props
+
+function DialogTitle({ className, ...props }: DialogTitleProps) {
+ return (
+ <BaseDialog.Title
+ className={(state) =>
+ cn(
+ // Same look as AlertDialogTitle; change both together.
+ 'title-2xl-semi-bold wrap-break-word text-text-primary',
+ resolveClassName(className, state),
+ )
+ }
+ {...props}
+ />
+ )
+}
+
type DialogDescriptionProps = BaseDialog.Description.Props
+
+function DialogDescription({ className, ...props }: DialogDescriptionProps) {
+ return (
+ <BaseDialog.Description
+ className={(state) =>
+ cn(
+ 'system-xs-regular wrap-break-word text-text-tertiary',
+ resolveClassName(className, state),
+ )
+ }
+ {...props}
+ />
+ )
+}
type DialogPortalProps = BaseDialog.Portal.Props
type DialogCloseProps = BaseDialog.Close.Props
@@ -64,6 +93,7 @@ function DialogPopup({ className, ...props }: DialogPopupProps) {
<BaseDialog.Popup
className={(state) =>
cn(
+ // Radius, border and surface match AlertDialogContent; change both together.
'rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl',
modalPopupAnimationClassName,
resolveClassName(className, state),
@@ -86,7 +116,7 @@ function DialogContent({ children, className, backdropProps, ...props }: DialogC
<DialogPopup
className={(state) =>
cn(
- 'fixed top-1/2 left-1/2 max-h-[80dvh] w-120 max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain p-6',
+ 'fixed top-1/2 left-1/2 max-h-[80dvh] w-120 max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain',
resolveClassName(className, state),
)
}
@@ -98,13 +128,68 @@ function DialogContent({ children, className, backdropProps, ...props }: DialogC
)
}
+type DialogHeaderProps = React.ComponentProps<'div'>
+
+function DialogHeader({ className, ...props }: DialogHeaderProps) {
+ return (
+ <div
+ className={cn(
+ 'sticky top-0 z-1 flex flex-col gap-1 bg-components-panel-bg ps-6 pe-14 pt-6 pb-3',
+ className,
+ )}
+ {...props}
+ />
+ )
+}
+
+type DialogCloseButtonProps = Omit<DialogCloseProps, 'render' | 'children' | 'className'> & {
+ 'aria-label': string
+}
+
+function DialogCloseButton({ 'aria-label': ariaLabel, ...props }: DialogCloseButtonProps) {
+ return (
+ <BaseDialog.Close
+ {...props}
+ render={
+ <IconButton aria-label={ariaLabel} size="lg" className="absolute inset-e-5 top-5">
+ <span aria-hidden className="i-ri-close-line size-4.5" />
+ </IconButton>
+ }
+ />
+ )
+}
+
+type DialogBodyProps = React.ComponentProps<'div'>
+
+function DialogBody({ className, ...props }: DialogBodyProps) {
+ return <div className={cn('px-6 py-3', className)} {...props} />
+}
+
+type DialogFooterProps = React.ComponentProps<'div'>
+
+function DialogFooter({ className, ...props }: DialogFooterProps) {
+ return (
+ <div
+ className={cn(
+ 'sticky bottom-0 flex items-center justify-end gap-2 bg-components-panel-bg px-6 pt-5 pb-6',
+ className,
+ )}
+ {...props}
+ />
+ )
+}
+
export {
createDialogHandle,
Dialog,
DialogBackdrop,
+ DialogBody,
DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogPopup,
DialogPortal,
DialogTitle,
@@ -115,12 +200,16 @@ export {
export type {
DialogActions,
DialogBackdropProps,
+ DialogBodyProps,
DialogChangeEventDetails,
DialogChangeEventReason,
+ DialogCloseButtonProps,
DialogCloseProps,
DialogContentProps,
DialogDescriptionProps,
+ DialogFooterProps,
DialogHandle,
+ DialogHeaderProps,
DialogPopupProps,
DialogPortalProps,
DialogProps,
diff --git a/web/__tests__/api-key-management.spec.tsx b/web/__tests__/api-key-management.spec.tsx
index 0c34726d3be..eb910dfb5e9 100644
--- a/web/__tests__/api-key-management.spec.tsx
+++ b/web/__tests__/api-key-management.spec.tsx
@@ -222,7 +222,7 @@ describe('API key management', () => {
await screen.findByRole('textbox', { name: 'appApi.apiKeyModal.secretKey' }),
).toHaveValue('new-app-token-123')
expect(
- screen.getByRole('alertdialog', { name: 'appApi.apiKeyModal.createdTitle' }),
+ screen.getByRole('dialog', { name: 'appApi.apiKeyModal.createdTitle' }),
).toHaveAccessibleDescription('appApi.apiKeyModal.generateTips')
})
@@ -232,7 +232,7 @@ describe('API key management', () => {
const create = screen.getByRole('button', { name: 'appApi.apiKeyModal.createNewSecretKey' })
await user.click(create)
await user.click(screen.getByRole('button', { name: 'common.operation.create' }))
- const result = await screen.findByRole('alertdialog', {
+ const result = await screen.findByRole('dialog', {
name: 'appApi.apiKeyModal.createdTitle',
})
expect(apiMocks.createDataset).toHaveBeenCalledWith({ body: { dataset_ids: [] } })
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx
index f6d6425a28c..213986eb3ea 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx
@@ -357,10 +357,7 @@ const ConfigPopup: FC<PopupProps> = ({
)}
</div>
</div>
- <DialogContent
- initialFocus={firstInputRef}
- className="max-h-[calc(100dvh-2rem)] w-160 p-0"
- >
+ <DialogContent initialFocus={firstInputRef} className="max-h-[calc(100dvh-2rem)] w-160">
{provider && (
<ProviderConfigModal
appId={appId}
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx
index b5180f68678..b0289f122bb 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx
@@ -95,7 +95,7 @@ const ProviderConfigModal: FC<Props> = ({
return (
<>
<div className="flex items-center justify-between gap-4 px-8 pt-8 pb-4">
- <DialogTitle className="min-w-0 flex-1 title-2xl-semi-bold text-text-primary">
+ <DialogTitle className="min-w-0 flex-1">
{t(($) => $[`${I18N_PREFIX}.title`], { ns: 'app' })}
{t(($) => $[`tracing.${type}.title`], { ns: 'app' })}
</DialogTitle>
diff --git a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx
index 3c8a72bf434..49ce825099f 100644
--- a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx
+++ b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx
@@ -5,7 +5,14 @@ import type { ImageIconInputValue } from '@/app/components/base/icon-picker/imag
import type { ImageFile } from '@/types/app'
import { Avatar, AvatarFallback, AvatarImage } from '@langgenius/dify-ui/avatar'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Separator } from '@langgenius/dify-ui/separator'
import { useMutation } from '@tanstack/react-query'
import * as React from 'react'
@@ -130,7 +137,7 @@ const AvatarWithEdit = ({ avatar, name, size }: AvatarWithEditProps) => {
open={isShowAvatarPicker}
onOpenChange={(open) => !open && setIsShowAvatarPicker(false)}
>
- <DialogContent className="w-90.5! p-0!">
+ <DialogContent className="w-90.5">
<DialogTitle className="sr-only">
{t(($) => $['avatar.editAction'], { ns: 'common' })}
</DialogTitle>
@@ -164,15 +171,16 @@ const AvatarWithEdit = ({ avatar, name, size }: AvatarWithEditProps) => {
open={isShowDeleteConfirm}
onOpenChange={(open) => !open && setIsShowDeleteConfirm(false)}
>
- <DialogContent className="w-90.5! p-6!">
- <DialogTitle className="mb-3 title-2xl-semi-bold text-text-primary">
- {t(($) => $['avatar.deleteTitle'], { ns: 'common' })}
- </DialogTitle>
- <p className="mb-8 text-text-secondary">
- {t(($) => $['avatar.deleteDescription'], { ns: 'common' })}
- </p>
-
- <div className="flex w-full items-center justify-center gap-2">
+ <DialogContent className="w-90.5">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['avatar.deleteTitle'], { ns: 'common' })}</DialogTitle>
+ </DialogHeader>
+ <DialogBody>
+ <p className="text-text-secondary">
+ {t(($) => $['avatar.deleteDescription'], { ns: 'common' })}
+ </p>
+ </DialogBody>
+ <DialogFooter>
<Button className="w-full" onClick={() => setIsShowDeleteConfirm(false)}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
@@ -185,7 +193,7 @@ const AvatarWithEdit = ({ avatar, name, size }: AvatarWithEditProps) => {
>
{t(($) => $['operation.delete'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
</>
diff --git a/web/app/account/(commonLayout)/account-page/change-password-dialog.tsx b/web/app/account/(commonLayout)/account-page/change-password-dialog.tsx
index 7e70c32db25..9f56bac51c8 100644
--- a/web/app/account/(commonLayout)/account-page/change-password-dialog.tsx
+++ b/web/app/account/(commonLayout)/account-page/change-password-dialog.tsx
@@ -5,8 +5,11 @@ import type { DialogActions } from '@langgenius/dify-ui/dialog'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
+ DialogBody,
DialogClose,
DialogContent,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
@@ -34,15 +37,14 @@ type PasswordFieldProps = {
label: string
autoComplete: 'current-password' | 'new-password'
readOnly: boolean
- className?: string
}
-function PasswordField({ name, label, autoComplete, readOnly, className }: PasswordFieldProps) {
+function PasswordField({ name, label, autoComplete, readOnly }: PasswordFieldProps) {
const { t } = useTranslation(['login'])
const [visible, setVisible] = useState(false)
return (
- <Field name={name} className={className}>
+ <Field name={name}>
<FieldLabel className="system-sm-semibold">{label}</FieldLabel>
<InputGroup>
<InputGroupInput
@@ -106,39 +108,41 @@ function ChangePasswordForm({
return (
<Form<ChangePasswordFormValues> onFormSubmit={handleSubmit}>
- <DialogTitle className="mb-6 title-2xl-semi-bold text-text-primary">
- {isPasswordSet
- ? t(($) => $['account.resetPassword'], { ns: 'accountSettings' })
- : t(($) => $['account.setPassword'], { ns: 'accountSettings' })}
- </DialogTitle>
- {isPasswordSet && (
+ <DialogHeader>
+ <DialogTitle>
+ {isPasswordSet
+ ? t(($) => $['account.resetPassword'], { ns: 'accountSettings' })
+ : t(($) => $['account.setPassword'], { ns: 'accountSettings' })}
+ </DialogTitle>
+ </DialogHeader>
+ <DialogBody className="space-y-8">
+ {isPasswordSet && (
+ <PasswordField
+ name="current-password"
+ label={t(($) => $['account.currentPassword'], { ns: 'accountSettings' })}
+ autoComplete="current-password"
+ readOnly={isPending}
+ />
+ )}
+ <PasswordField
+ name="new-password"
+ label={
+ isPasswordSet
+ ? t(($) => $['account.newPassword'], { ns: 'accountSettings' })
+ : t(($) => $['account.password'], { ns: 'accountSettings' })
+ }
+ autoComplete="new-password"
+ readOnly={isPending}
+ />
<PasswordField
- name="current-password"
- label={t(($) => $['account.currentPassword'], { ns: 'accountSettings' })}
- autoComplete="current-password"
+ name="confirm-password"
+ label={t(($) => $['account.confirmPassword'], { ns: 'accountSettings' })}
+ autoComplete="new-password"
readOnly={isPending}
/>
- )}
- <PasswordField
- name="new-password"
- label={
- isPasswordSet
- ? t(($) => $['account.newPassword'], { ns: 'accountSettings' })
- : t(($) => $['account.password'], { ns: 'accountSettings' })
- }
- autoComplete="new-password"
- readOnly={isPending}
- className="mt-8"
- />
- <PasswordField
- name="confirm-password"
- label={t(($) => $['account.confirmPassword'], { ns: 'accountSettings' })}
- autoComplete="new-password"
- readOnly={isPending}
- className="mt-8"
- />
- <div className="mt-10 flex justify-end">
- <DialogClose render={<Button className="mr-2" disabled={isPending} />}>
+ </DialogBody>
+ <DialogFooter>
+ <DialogClose render={<Button disabled={isPending} />}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</DialogClose>
<Button type="submit" loading={isPending} variant="primary">
@@ -146,7 +150,7 @@ function ChangePasswordForm({
? t(($) => $['operation.reset'], { ns: 'common' })
: t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</Form>
)
}
@@ -190,7 +194,7 @@ export function ChangePasswordDialog({ isPasswordSet }: { isPasswordSet: boolean
? t(($) => $['account.resetPassword'], { ns: 'accountSettings' })
: t(($) => $['account.setPassword'], { ns: 'accountSettings' })}
</DialogTrigger>
- <DialogContent className="w-105! p-6!">
+ <DialogContent className="w-105">
<ChangePasswordForm
isPasswordSet={isPasswordSet}
isPending={updatePassword.isPending}
diff --git a/web/app/account/(commonLayout)/account-page/edit-account-name-dialog.tsx b/web/app/account/(commonLayout)/account-page/edit-account-name-dialog.tsx
index dc822127233..a5745d9a205 100644
--- a/web/app/account/(commonLayout)/account-page/edit-account-name-dialog.tsx
+++ b/web/app/account/(commonLayout)/account-page/edit-account-name-dialog.tsx
@@ -4,8 +4,11 @@ import type { DialogActions } from '@langgenius/dify-ui/dialog'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
+ DialogBody,
DialogClose,
DialogContent,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
@@ -35,28 +38,30 @@ function EditAccountNameForm({ name, isPending, onSave }: EditAccountNameFormPro
if (!isPending && draftName) void onSave(draftName)
}}
>
- <DialogTitle className="mb-6 title-2xl-semi-bold text-text-primary">
- {t(($) => $['account.editName'], { ns: 'accountSettings' })}
- </DialogTitle>
- <Field name="name" className="gap-0">
- <FieldLabel className="py-0 system-sm-semibold text-text-secondary">
- {t(($) => $['account.name'], { ns: 'accountSettings' })}
- </FieldLabel>
- <Input
- className="mt-2"
- value={draftName}
- onValueChange={setDraftName}
- readOnly={isPending}
- />
- </Field>
- <div className="mt-10 flex justify-end">
- <DialogClose render={<Button className="mr-2" disabled={isPending} />}>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['account.editName'], { ns: 'accountSettings' })}</DialogTitle>
+ </DialogHeader>
+ <DialogBody>
+ <Field name="name" className="gap-0">
+ <FieldLabel className="py-0 system-sm-semibold text-text-secondary">
+ {t(($) => $['account.name'], { ns: 'accountSettings' })}
+ </FieldLabel>
+ <Input
+ className="mt-2"
+ value={draftName}
+ onValueChange={setDraftName}
+ readOnly={isPending}
+ />
+ </Field>
+ </DialogBody>
+ <DialogFooter>
+ <DialogClose render={<Button disabled={isPending} />}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</DialogClose>
<Button type="submit" disabled={!draftName} loading={isPending} variant="primary">
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
)
}
@@ -89,7 +94,7 @@ export function EditAccountNameDialog({ name }: { name: string }) {
<DialogTrigger className="cursor-pointer rounded-lg bg-components-button-tertiary-bg px-3 py-2 system-sm-medium text-components-button-tertiary-text">
{t(($) => $['operation.edit'])}
</DialogTrigger>
- <DialogContent className="w-105 p-6">
+ <DialogContent className="w-105">
<EditAccountNameForm name={name} isPending={updateProfile.isPending} onSave={handleSave} />
</DialogContent>
</Dialog>
diff --git a/web/app/account/(commonLayout)/account-page/email-change-modal.tsx b/web/app/account/(commonLayout)/account-page/email-change-modal.tsx
index e9d486952e5..d452fb5701b 100644
--- a/web/app/account/(commonLayout)/account-page/email-change-modal.tsx
+++ b/web/app/account/(commonLayout)/account-page/email-change-modal.tsx
@@ -1,10 +1,16 @@
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { ORPCError } from '@orpc/client'
-import { RiCloseLine } from '@remixicon/react'
import { useDebounceFn } from 'ahooks'
import { useCallback, useEffect, useRef, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
@@ -189,7 +195,7 @@ const EmailChangeModal = ({ onClose, email }: Props) => {
return (
<Dialog open onOpenChange={(open) => !open && onClose()}>
- <DialogContent className="w-105! p-6!">
+ <DialogContent className="w-105">
<form
onSubmit={(event) => {
event.preventDefault()
@@ -199,77 +205,79 @@ const EmailChangeModal = ({ onClose, email }: Props) => {
else void submitNewEmail()
}}
>
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="absolute top-5 right-5 size-8"
- onClick={onClose}
- >
- <RiCloseLine aria-hidden className="size-5 text-text-tertiary" />
- </IconButton>
{step === STEP.start && (
<>
- <DialogTitle className="pb-3 title-2xl-semi-bold text-text-primary">
- {t(($) => $['account.changeEmail.title'], { ns: 'accountSettings' })}
- </DialogTitle>
- <div className="space-y-0.5 pt-1 pb-2">
- <div className="body-md-medium text-text-warning">
- {t(($) => $['account.changeEmail.authTip'], { ns: 'accountSettings' })}
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['account.changeEmail.title'], { ns: 'accountSettings' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="space-y-0.5 pt-1 pb-2">
+ <div className="body-md-medium text-text-warning">
+ {t(($) => $['account.changeEmail.authTip'], { ns: 'accountSettings' })}
+ </div>
+ <div className="body-md-regular text-text-secondary">
+ <Trans
+ i18nKey={($) => $['account.changeEmail.content1']}
+ ns="accountSettings"
+ components={{
+ email: <span className="body-md-medium text-text-primary"></span>,
+ }}
+ values={{ email }}
+ />
+ </div>
</div>
- <div className="body-md-regular text-text-secondary">
- <Trans
- i18nKey={($) => $['account.changeEmail.content1']}
- ns="accountSettings"
- components={{
- email: <span className="body-md-medium text-text-primary"></span>,
- }}
- values={{ email }}
- />
- </div>
- </div>
- <div className="pt-3"></div>
- <div className="space-y-2">
+ </DialogBody>
+ <DialogFooter className="flex-col items-stretch">
<Button className="w-full!" variant="primary" type="submit">
{t(($) => $['account.changeEmail.sendVerifyCode'], { ns: 'accountSettings' })}
</Button>
<Button className="w-full!" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</>
)}
{step === STEP.verifyOrigin && (
<>
- <DialogTitle className="pb-3 title-2xl-semi-bold text-text-primary">
- {t(($) => $['account.changeEmail.verifyEmail'], { ns: 'accountSettings' })}
- </DialogTitle>
- <div className="space-y-0.5 pt-1 pb-2">
- <div className="body-md-regular text-text-secondary">
- <Trans
- i18nKey={($) => $['account.changeEmail.content2']}
- ns="accountSettings"
- components={{
- email: <span className="body-md-medium text-text-primary"></span>,
- }}
- values={{ email }}
- />
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['account.changeEmail.verifyEmail'], { ns: 'accountSettings' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="space-y-0.5 pt-1 pb-2">
+ <div className="body-md-regular text-text-secondary">
+ <Trans
+ i18nKey={($) => $['account.changeEmail.content2']}
+ ns="accountSettings"
+ components={{
+ email: <span className="body-md-medium text-text-primary"></span>,
+ }}
+ values={{ email }}
+ />
+ </div>
</div>
- </div>
- <Field name="code" className="pt-3">
- <FieldLabel>
- {t(($) => $['account.changeEmail.codeLabel'], { ns: 'accountSettings' })}
- </FieldLabel>
- <Input
- className="w-full!"
- placeholder={t(($) => $['account.changeEmail.codePlaceholder'], {
- ns: 'accountSettings',
- })}
- value={code}
- onValueChange={(value) => setCode(value)}
- autoComplete="one-time-code"
- maxLength={6}
- />
- </Field>
- <div className="mt-3 space-y-2">
+ <Field name="code" className="pt-3">
+ <FieldLabel>
+ {t(($) => $['account.changeEmail.codeLabel'], { ns: 'accountSettings' })}
+ </FieldLabel>
+ <Input
+ className="w-full!"
+ placeholder={t(($) => $['account.changeEmail.codePlaceholder'], {
+ ns: 'accountSettings',
+ })}
+ value={code}
+ onValueChange={(value) => setCode(value)}
+ autoComplete="one-time-code"
+ maxLength={6}
+ />
+ </Field>
+ </DialogBody>
+ <DialogFooter className="flex-col items-stretch">
<Button
disabled={code.length !== 6}
className="w-full!"
@@ -281,67 +289,74 @@ const EmailChangeModal = ({ onClose, email }: Props) => {
<Button className="w-full!" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
- </div>
- <div className="mt-3 flex items-center gap-1 system-xs-regular text-text-tertiary">
- <span>
- {t(($) => $['account.changeEmail.resendTip'], { ns: 'accountSettings' })}
- </span>
- {time > 0 && (
+ <div className="flex items-center gap-1 system-xs-regular text-text-tertiary">
<span>
- {t(($) => $['account.changeEmail.resendCount'], {
- ns: 'accountSettings',
- count: time,
- })}
+ {t(($) => $['account.changeEmail.resendTip'], { ns: 'accountSettings' })}
</span>
- )}
- {!time && (
- <button
- type="button"
- onClick={sendCodeToOriginEmail}
- className="cursor-pointer rounded-sm system-xs-medium text-text-accent-secondary outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid"
- >
- {t(($) => $['account.changeEmail.resend'], { ns: 'accountSettings' })}
- </button>
- )}
- </div>
+ {time > 0 && (
+ <span>
+ {t(($) => $['account.changeEmail.resendCount'], {
+ ns: 'accountSettings',
+ count: time,
+ })}
+ </span>
+ )}
+ {!time && (
+ <button
+ type="button"
+ onClick={sendCodeToOriginEmail}
+ className="cursor-pointer rounded-sm system-xs-medium text-text-accent-secondary outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid"
+ >
+ {t(($) => $['account.changeEmail.resend'], { ns: 'accountSettings' })}
+ </button>
+ )}
+ </div>
+ </DialogFooter>
</>
)}
{step === STEP.newEmail && (
<>
- <DialogTitle className="pb-3 title-2xl-semi-bold text-text-primary">
- {t(($) => $['account.changeEmail.newEmail'], { ns: 'accountSettings' })}
- </DialogTitle>
- <div className="space-y-0.5 pt-1 pb-2">
- <div className="body-md-regular text-text-secondary">
- {t(($) => $['account.changeEmail.content3'], { ns: 'accountSettings' })}
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['account.changeEmail.newEmail'], { ns: 'accountSettings' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="space-y-0.5 pt-1 pb-2">
+ <div className="body-md-regular text-text-secondary">
+ {t(($) => $['account.changeEmail.content3'], { ns: 'accountSettings' })}
+ </div>
</div>
- </div>
- <Field name="email" invalid={newEmailExited || unAvailableEmail} className="pt-3">
- <FieldLabel>
- {t(($) => $['account.changeEmail.emailLabel'], { ns: 'accountSettings' })}
- </FieldLabel>
- <Input
- className="w-full!"
- placeholder={t(($) => $['account.changeEmail.emailPlaceholder'], {
- ns: 'accountSettings',
- })}
- value={mail}
- onValueChange={(value) => handleNewEmailValueChange(value)}
- type="email"
- autoComplete="email"
- />
- {newEmailExited && (
- <FieldError match>
- {t(($) => $['account.changeEmail.existingEmail'], { ns: 'accountSettings' })}
- </FieldError>
- )}
- {unAvailableEmail && (
- <FieldError match>
- {t(($) => $['account.changeEmail.unAvailableEmail'], { ns: 'accountSettings' })}
- </FieldError>
- )}
- </Field>
- <div className="mt-3 space-y-2">
+ <Field name="email" invalid={newEmailExited || unAvailableEmail} className="pt-3">
+ <FieldLabel>
+ {t(($) => $['account.changeEmail.emailLabel'], { ns: 'accountSettings' })}
+ </FieldLabel>
+ <Input
+ className="w-full!"
+ placeholder={t(($) => $['account.changeEmail.emailPlaceholder'], {
+ ns: 'accountSettings',
+ })}
+ value={mail}
+ onValueChange={(value) => handleNewEmailValueChange(value)}
+ type="email"
+ autoComplete="email"
+ />
+ {newEmailExited && (
+ <FieldError match>
+ {t(($) => $['account.changeEmail.existingEmail'], { ns: 'accountSettings' })}
+ </FieldError>
+ )}
+ {unAvailableEmail && (
+ <FieldError match>
+ {t(($) => $['account.changeEmail.unAvailableEmail'], {
+ ns: 'accountSettings',
+ })}
+ </FieldError>
+ )}
+ </Field>
+ </DialogBody>
+ <DialogFooter className="flex-col items-stretch">
<Button
disabled={isSendCodeDisabled}
className="w-full!"
@@ -353,42 +368,47 @@ const EmailChangeModal = ({ onClose, email }: Props) => {
<Button className="w-full!" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</>
)}
{step === STEP.verifyNew && (
<>
- <DialogTitle className="pb-3 title-2xl-semi-bold text-text-primary">
- {t(($) => $['account.changeEmail.verifyNew'], { ns: 'accountSettings' })}
- </DialogTitle>
- <div className="space-y-0.5 pt-1 pb-2">
- <div className="body-md-regular text-text-secondary">
- <Trans
- i18nKey={($) => $['account.changeEmail.content4']}
- ns="accountSettings"
- components={{
- email: <span className="body-md-medium text-text-primary"></span>,
- }}
- values={{ email: mail }}
- />
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['account.changeEmail.verifyNew'], { ns: 'accountSettings' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="space-y-0.5 pt-1 pb-2">
+ <div className="body-md-regular text-text-secondary">
+ <Trans
+ i18nKey={($) => $['account.changeEmail.content4']}
+ ns="accountSettings"
+ components={{
+ email: <span className="body-md-medium text-text-primary"></span>,
+ }}
+ values={{ email: mail }}
+ />
+ </div>
</div>
- </div>
- <Field name="code" className="pt-3">
- <FieldLabel>
- {t(($) => $['account.changeEmail.codeLabel'], { ns: 'accountSettings' })}
- </FieldLabel>
- <Input
- className="w-full!"
- placeholder={t(($) => $['account.changeEmail.codePlaceholder'], {
- ns: 'accountSettings',
- })}
- value={code}
- onValueChange={(value) => setCode(value)}
- autoComplete="one-time-code"
- maxLength={6}
- />
- </Field>
- <div className="mt-3 space-y-2">
+ <Field name="code" className="pt-3">
+ <FieldLabel>
+ {t(($) => $['account.changeEmail.codeLabel'], { ns: 'accountSettings' })}
+ </FieldLabel>
+ <Input
+ className="w-full!"
+ placeholder={t(($) => $['account.changeEmail.codePlaceholder'], {
+ ns: 'accountSettings',
+ })}
+ value={code}
+ onValueChange={(value) => setCode(value)}
+ autoComplete="one-time-code"
+ maxLength={6}
+ />
+ </Field>
+ </DialogBody>
+ <DialogFooter className="flex-col items-stretch">
<Button
disabled={code.length !== 6}
className="w-full!"
@@ -403,29 +423,29 @@ const EmailChangeModal = ({ onClose, email }: Props) => {
<Button className="w-full!" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
- </div>
- <div className="mt-3 flex items-center gap-1 system-xs-regular text-text-tertiary">
- <span>
- {t(($) => $['account.changeEmail.resendTip'], { ns: 'accountSettings' })}
- </span>
- {time > 0 && (
+ <div className="flex items-center gap-1 system-xs-regular text-text-tertiary">
<span>
- {t(($) => $['account.changeEmail.resendCount'], {
- ns: 'accountSettings',
- count: time,
- })}
+ {t(($) => $['account.changeEmail.resendTip'], { ns: 'accountSettings' })}
</span>
- )}
- {!time && (
- <button
- type="button"
- onClick={sendCodeToNewEmail}
- className="cursor-pointer rounded-sm system-xs-medium text-text-accent-secondary outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid"
- >
- {t(($) => $['account.changeEmail.resend'], { ns: 'accountSettings' })}
- </button>
- )}
- </div>
+ {time > 0 && (
+ <span>
+ {t(($) => $['account.changeEmail.resendCount'], {
+ ns: 'accountSettings',
+ count: time,
+ })}
+ </span>
+ )}
+ {!time && (
+ <button
+ type="button"
+ onClick={sendCodeToNewEmail}
+ className="cursor-pointer rounded-sm system-xs-medium text-text-accent-secondary outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid"
+ >
+ {t(($) => $['account.changeEmail.resend'], { ns: 'accountSettings' })}
+ </button>
+ )}
+ </div>
+ </DialogFooter>
</>
)}
</form>
diff --git a/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx b/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx
index 85321c08326..92b0df12353 100644
--- a/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx
+++ b/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx
@@ -1,6 +1,13 @@
'use client'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
import { Form } from '@langgenius/dify-ui/form'
import { Textarea } from '@langgenius/dify-ui/textarea'
@@ -62,36 +69,40 @@ export default function FeedBack(props: DeleteAccountProps) {
}}
>
<DialogContent
- className="max-w-120 overflow-hidden!"
+ className="max-w-120"
backdropProps={{ className: 'bg-background-overlay-backdrop backdrop-blur-[6px]' }}
>
- <DialogTitle className="pr-8 pb-3 title-2xl-semi-bold text-text-primary">
- {t(($) => $['account.feedbackTitle'], { ns: 'accountSettings' })}
- </DialogTitle>
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['account.feedbackTitle'], { ns: 'accountSettings' })}
+ </DialogTitle>
+ </DialogHeader>
<Form<FeedbackFormValues>
onFormSubmit={({ feedback }) => {
void handleSubmit(feedback)
}}
>
- <Field name="feedback" className="mt-3 gap-0">
- <FieldLabel className="system-sm-semibold">
- {t(($) => $['account.feedbackLabel'], { ns: 'accountSettings' })}
- </FieldLabel>
- <Textarea
- rows={6}
- placeholder={
- t(($) => $['account.feedbackPlaceholder'], { ns: 'accountSettings' }) as string
- }
- />
- </Field>
- <div className="mt-3 flex w-full flex-col gap-2">
+ <DialogBody>
+ <Field name="feedback" className="gap-0">
+ <FieldLabel className="system-sm-semibold">
+ {t(($) => $['account.feedbackLabel'], { ns: 'accountSettings' })}
+ </FieldLabel>
+ <Textarea
+ rows={6}
+ placeholder={
+ t(($) => $['account.feedbackPlaceholder'], { ns: 'accountSettings' }) as string
+ }
+ />
+ </Field>
+ </DialogBody>
+ <DialogFooter className="flex-col items-stretch">
<Button type="submit" className="w-full" loading={isPending} variant="primary">
{t(($) => $['operation.submit'], { ns: 'common' })}
</Button>
<Button type="button" className="w-full" onClick={handleSkip}>
{t(($) => $['operation.skip'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</Form>
</DialogContent>
</Dialog>
diff --git a/web/app/account/(commonLayout)/delete-account/index.tsx b/web/app/account/(commonLayout)/delete-account/index.tsx
index 0fcdc775470..984b3f4430f 100644
--- a/web/app/account/(commonLayout)/delete-account/index.tsx
+++ b/web/app/account/(commonLayout)/delete-account/index.tsx
@@ -38,10 +38,10 @@ export default function DeleteAccount(props: DeleteAccountProps) {
}}
>
<DialogContent
- className="max-w-120 overflow-hidden!"
+ className="max-w-120 overflow-hidden p-6"
backdropProps={{ className: 'bg-background-overlay-backdrop backdrop-blur-[6px]' }}
>
- <DialogTitle className="pr-8 pb-3 title-2xl-semi-bold text-text-primary">
+ <DialogTitle className="pr-8 pb-3">
{t(($) => $['account.delete'], { ns: 'accountSettings' })}
</DialogTitle>
{!showVerifyEmail && (
diff --git a/web/app/components/api-key/api-key-dialog-content.tsx b/web/app/components/api-key/api-key-dialog-content.tsx
index de3dbacd8d6..68c9467ea8a 100644
--- a/web/app/components/api-key/api-key-dialog-content.tsx
+++ b/web/app/components/api-key/api-key-dialog-content.tsx
@@ -3,12 +3,12 @@ import type { ButtonProps } from '@langgenius/dify-ui/button'
import type { DialogContentProps } from '@langgenius/dify-ui/dialog'
import { Button } from '@langgenius/dify-ui/button'
import {
- DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { QueryErrorResetBoundary } from '@tanstack/react-query'
import { Suspense, useId } from 'react'
import { useTranslation } from 'react-i18next'
@@ -28,28 +28,18 @@ export function ApiKeyDialogContent({
}: ApiKeyDialogContentProps) {
const { t } = useTranslation(['appApi', 'common'])
return (
- <DialogContent finalFocus={finalFocus} className="flex w-200 flex-col overflow-hidden p-0">
- <div className="flex shrink-0 flex-col gap-1 px-6 pt-6 pr-14 pb-4">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['apiKeyModal.apiSecretKey'])}
- </DialogTitle>
- <DialogDescription className="system-sm-regular text-text-tertiary">
+ <DialogContent finalFocus={finalFocus} className="flex w-200 flex-col overflow-hidden">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['apiKeyModal.apiSecretKey'])}</DialogTitle>
+ <DialogDescription>
{t(($) => $['apiKeyModal.apiSecretKeyTips'])}
{limitDescription && <span className="block">{limitDescription}</span>}
</DialogDescription>
- </div>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- disabled={closeDisabled}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
+ <DialogCloseButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ disabled={closeDisabled}
+ />
+ </DialogHeader>
<QueryErrorResetBoundary>
{({ reset }) => (
<ErrorBoundary
diff --git a/web/app/components/api-key/created-api-key-dialog.tsx b/web/app/components/api-key/created-api-key-dialog.tsx
index 8e17583093b..7c251f5a0f3 100644
--- a/web/app/components/api-key/created-api-key-dialog.tsx
+++ b/web/app/components/api-key/created-api-key-dialog.tsx
@@ -1,20 +1,23 @@
'use client'
-import type { AlertDialogContentProps, AlertDialogProps } from '@langgenius/dify-ui/alert-dialog'
+import type { DialogContentProps, DialogProps } from '@langgenius/dify-ui/dialog'
+import { Button } from '@langgenius/dify-ui/button'
import {
- AlertDialog,
- AlertDialogCancelButton,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogHeader,
- AlertDialogTitle,
-} from '@langgenius/dify-ui/alert-dialog'
+ Dialog,
+ DialogBody,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'
import { useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { CopyFeedback } from '@/app/components/base/copy-feedback'
-type CreatedApiKeyDialogProps = Required<Pick<AlertDialogProps, 'open' | 'onOpenChange'>> &
- Pick<AlertDialogContentProps, 'finalFocus'> & {
+type CreatedApiKeyDialogProps = Required<Pick<DialogProps, 'open' | 'onOpenChange'>> &
+ Pick<DialogContentProps, 'finalFocus'> & {
value: string | undefined
revealOnce?: boolean
}
@@ -30,30 +33,21 @@ export function CreatedApiKeyDialog({
const copyButtonRef = useRef<HTMLButtonElement>(null)
return (
- <AlertDialog
- open={open}
- onOpenChange={(nextOpen, details) => {
- if (!nextOpen && details.reason === 'escape-key') details.cancel()
- else onOpenChange(nextOpen, details)
- }}
- >
- <AlertDialogContent
+ <Dialog open={open} disablePointerDismissal onOpenChange={onOpenChange}>
+ <DialogContent
initialFocus={copyButtonRef}
finalFocus={finalFocus}
backdropProps={{ forceRender: true }}
- className="overflow-hidden"
>
- <AlertDialogHeader>
- <AlertDialogTitle>
- {t(($) => $['apiKeyModal.createdTitle'], { ns: 'appApi' })}
- </AlertDialogTitle>
- <AlertDialogDescription>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['apiKeyModal.createdTitle'], { ns: 'appApi' })}</DialogTitle>
+ <DialogDescription>
{revealOnce
? t(($) => $['apiKeyModal.revealOnceTips'], { ns: 'appApi' })
: t(($) => $['apiKeyModal.generateTips'], { ns: 'appApi' })}
- </AlertDialogDescription>
- </AlertDialogHeader>
- <div className="px-6 pb-4">
+ </DialogDescription>
+ </DialogHeader>
+ <DialogBody>
<InputGroup>
<InputGroupInput
aria-label={t(($) => $['apiKeyModal.secretKey'], { ns: 'appApi' })}
@@ -67,13 +61,13 @@ export function CreatedApiKeyDialog({
<CopyFeedback ref={copyButtonRef} content={value ?? ''} />
</InputGroupAddon>
</InputGroup>
- </div>
- <div className="flex justify-end px-6 pb-6">
- <AlertDialogCancelButton variant="primary">
+ </DialogBody>
+ <DialogFooter>
+ <DialogClose render={<Button variant="primary" />}>
{t(($) => $['apiKeyModal.saved'], { ns: 'appApi' })}
- </AlertDialogCancelButton>
- </div>
- </AlertDialogContent>
- </AlertDialog>
+ </DialogClose>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
)
}
diff --git a/web/app/components/api-key/dataset-scope-dialog.tsx b/web/app/components/api-key/dataset-scope-dialog.tsx
index 1f90661e9c7..4fb659b9311 100644
--- a/web/app/components/api-key/dataset-scope-dialog.tsx
+++ b/web/app/components/api-key/dataset-scope-dialog.tsx
@@ -18,9 +18,13 @@ import {
} from '@langgenius/dify-ui/combobox'
import {
Dialog,
+ DialogBody,
DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import { IconButton } from '@langgenius/dify-ui/icon-button'
@@ -59,7 +63,7 @@ export function DatasetScopeDialog({
<DialogContent
finalFocus={finalFocus}
backdropProps={{ forceRender: true }}
- className="flex w-140 flex-col overflow-hidden p-0"
+ className="w-140"
>
<DatasetScopeContent {...props} />
</DialogContent>
@@ -110,34 +114,23 @@ function DatasetScopeContent({
return (
<form
- className="flex min-h-0 flex-col"
onSubmit={(event) => {
event.preventDefault()
handleConfirm()
}}
>
- <div className="flex shrink-0 flex-col gap-1 px-6 pt-6 pr-14 pb-4">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['apiKeyModal.addTitle'], { ns: 'appApi' })}
- </DialogTitle>
- <DialogDescription className="system-sm-regular text-text-tertiary">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['apiKeyModal.addTitle'], { ns: 'appApi' })}</DialogTitle>
+ <DialogDescription>
{t(($) => $['apiKeyModal.addSubtitle'], { ns: 'appApi' })}
</DialogDescription>
- </div>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- disabled={isCreating}
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
+ <DialogCloseButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ disabled={isCreating}
+ />
+ </DialogHeader>
- <div className="flex min-h-0 flex-col gap-3 overflow-y-auto px-6 py-4">
+ <DialogBody className="flex flex-col gap-3">
<div id={scopeId} className="system-sm-semibold text-text-secondary">
{t(($) => $['apiKeyModal.knowledgeBaseAccess'], { ns: 'appApi' })}
</div>
@@ -290,16 +283,16 @@ function DatasetScopeContent({
</div>
</div>
)}
- </div>
+ </DialogBody>
- <div className="flex shrink-0 justify-end gap-2 px-6 pb-6">
+ <DialogFooter>
<DialogClose render={<Button variant="secondary" disabled={isCreating} />}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</DialogClose>
<Button type="submit" disabled={!canCreate} loading={isCreating}>
{t(($) => $['operation.create'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
)
}
diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx
index dc3872a5d05..4f4b90c1483 100644
--- a/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx
+++ b/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx
@@ -1,8 +1,15 @@
'use client'
import type { FC } from 'react'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
-import { RiCloseLine } from '@remixicon/react'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import * as React from 'react'
@@ -99,30 +106,30 @@ const BatchModal: FC<IBatchModalProps> = ({ appId, isShow, onCancel, onAdded })
}
return (
- <Dialog open={isShow}>
- <DialogContent className="w-full max-w-130! overflow-hidden! rounded-xl! border-none px-8 py-6 text-left align-middle">
- <div className="relative pb-1 system-xl-medium text-text-primary">
- {t(($) => $['batchModal.title'], { ns: 'appAnnotation' })}
- </div>
- <button
- type="button"
- className="absolute top-4 right-4 cursor-pointer border-none bg-transparent p-2 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- onClick={onCancel}
- >
- <RiCloseLine className="size-4 text-text-tertiary" aria-hidden="true" />
- </button>
- <CSVUploader file={currentCSV} updateFile={handleFile} />
- <CSVDownloader />
+ <Dialog
+ open={isShow}
+ disablePointerDismissal
+ onOpenChange={(open) => {
+ if (!open) onCancel()
+ }}
+ >
+ <DialogContent className="w-130">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['batchModal.title'], { ns: 'appAnnotation' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <CSVUploader file={currentCSV} updateFile={handleFile} />
+ <CSVDownloader />
- {isAnnotationFull && (
- <div className="mt-4">
- <AnnotationFull />
- </div>
- )}
-
- <div className="mt-7 flex justify-end pt-6">
- <Button className="mr-2 system-sm-medium text-text-tertiary" onClick={onCancel}>
+ {isAnnotationFull && (
+ <div className="mt-4">
+ <AnnotationFull />
+ </div>
+ )}
+ </DialogBody>
+ <DialogFooter>
+ <Button className="system-sm-medium text-text-tertiary" onClick={onCancel}>
{t(($) => $['batchModal.cancel'], { ns: 'appAnnotation' })}
</Button>
<Button
@@ -135,7 +142,7 @@ const BatchModal: FC<IBatchModalProps> = ({ appId, isShow, onCancel, onAdded })
>
{t(($) => $['batchModal.run'], { ns: 'appAnnotation' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/app/app-access-control/access-control-dialog.tsx b/web/app/components/app/app-access-control/access-control-dialog.tsx
index 27a92ca0e5a..6c451abb604 100644
--- a/web/app/components/app/app-access-control/access-control-dialog.tsx
+++ b/web/app/components/app/app-access-control/access-control-dialog.tsx
@@ -22,7 +22,7 @@ const AccessControlDialog = ({ className, children, show, onClose }: DialogProps
<Dialog open={show} disablePointerDismissal onOpenChange={(open) => !open && close()}>
<DialogContent
className={cn(
- 'h-auto max-h-[calc(100dvh-2rem)] min-h-80.75 w-150 max-w-none overflow-y-auto rounded-2xl border-none bg-components-panel-bg p-0 shadow-xl transition-all',
+ 'max-h-[calc(100dvh-2rem)] min-h-80.75 w-150 max-w-none transition-all',
className,
)}
>
diff --git a/web/app/components/app/app-access-control/access-control-form.tsx b/web/app/components/app/app-access-control/access-control-form.tsx
index da06d52bbff..da57ad81c31 100644
--- a/web/app/components/app/app-access-control/access-control-form.tsx
+++ b/web/app/components/app/app-access-control/access-control-form.tsx
@@ -55,10 +55,8 @@ export function AccessControlForm({
<AccessControlDialog show onClose={onClose}>
<div className="flex flex-col gap-y-3">
<div className="pt-6 pr-14 pb-3 pl-6">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['accessControlDialog.title'], { ns: 'app' })}
- </DialogTitle>
- <DialogDescription className="mt-1 system-xs-regular text-text-tertiary">
+ <DialogTitle>{t(($) => $['accessControlDialog.title'], { ns: 'app' })}</DialogTitle>
+ <DialogDescription className="mt-1">
{t(($) => $['accessControlDialog.description'], { ns: 'app' })}
</DialogDescription>
</div>
diff --git a/web/app/components/app/app-publisher/version-info-modal.tsx b/web/app/components/app/app-publisher/version-info-modal.tsx
index 1298f73d99b..e896c03e128 100644
--- a/web/app/components/app/app-publisher/version-info-modal.tsx
+++ b/web/app/components/app/app-publisher/version-info-modal.tsx
@@ -1,7 +1,15 @@
import type { WorkflowResponse } from '@dify/contracts/api/console/apps/types.gen'
import type { FC } from 'react'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
import { Input } from '@langgenius/dify-ui/input'
import { Textarea } from '@langgenius/dify-ui/textarea'
@@ -73,23 +81,16 @@ const VersionInfoModal: FC<VersionInfoModalProps> = ({
if (!open) onClose()
}}
>
- <DialogContent className="w-full max-w-120 overflow-hidden! border-none p-0 text-left align-middle">
- <div className="relative w-full p-6 pr-14 pb-4">
- <div className="title-2xl-semi-bold text-text-primary first-letter:capitalize">
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>
{versionInfo?.marked_name
? t(($) => $['versionHistory.editVersionInfo'], { ns: 'workflowHistory' })
: t(($) => $['versionHistory.nameThisVersion'], { ns: 'workflowHistory' })}
- </div>
- <button
- type="button"
- className="absolute top-5 right-5 flex size-8 cursor-pointer items-center justify-center border-none bg-transparent p-1.5 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- onClick={onClose}
- >
- <span className="i-ri-close-line h-4.5 w-4.5 text-text-tertiary" aria-hidden="true" />
- </button>
- </div>
- <div className="flex flex-col gap-y-4 px-6 py-3">
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="flex flex-col gap-y-4">
<Field name="title" invalid={titleError}>
<FieldLabel className="system-sm-semibold">
{t(($) => $['versionHistory.editField.title'], { ns: 'workflowHistory' })}
@@ -110,15 +111,13 @@ const VersionInfoModal: FC<VersionInfoModalProps> = ({
onValueChange={handleDescriptionChange}
/>
</Field>
- </div>
- <div className="flex justify-end p-6 pt-5">
- <div className="flex items-center gap-x-3">
- <Button onClick={onClose}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>
- <Button variant="primary" onClick={handlePublish}>
- {t(($) => $['operation.save'], { ns: 'common' })}
- </Button>
- </div>
- </div>
+ </DialogBody>
+ <DialogFooter>
+ <Button onClick={onClose}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>
+ <Button variant="primary" onClick={handlePublish}>
+ {t(($) => $['operation.save'], { ns: 'common' })}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.tsx b/web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.tsx
index e565433e5fa..3ad26656da9 100644
--- a/web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.tsx
+++ b/web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.tsx
@@ -2,7 +2,14 @@
import type { FC } from 'react'
import type { ConversationHistoriesRole } from '@/models/debug'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import * as React from 'react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -25,42 +32,47 @@ const EditModal: FC<Props> = ({ isShow, saveLoading, data, onClose, onSave }) =>
if (!open) onClose()
}}
>
- <DialogContent className="w-full max-w-120 overflow-hidden! border-none p-6 text-left align-middle">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['feature.conversationHistory.editModal.title'], { ns: 'appDebug' })}
- </DialogTitle>
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['feature.conversationHistory.editModal.title'], { ns: 'appDebug' })}
+ </DialogTitle>
+ </DialogHeader>
+ <DialogBody>
+ <div className="text-sm leading-5.25 font-medium text-text-primary">
+ {t(($) => $['feature.conversationHistory.editModal.userPrefix'], { ns: 'appDebug' })}
+ </div>
+ <input
+ className="mt-2 box-border h-10 w-full rounded-lg bg-components-input-bg-normal px-3 text-sm/10"
+ value={tempData.user_prefix}
+ onChange={(e) =>
+ setTempData({
+ ...tempData,
+ user_prefix: e.target.value,
+ })
+ }
+ />
- <div className="mt-6 text-sm leading-5.25 font-medium text-text-primary">
- {t(($) => $['feature.conversationHistory.editModal.userPrefix'], { ns: 'appDebug' })}
- </div>
- <input
- className="mt-2 box-border h-10 w-full rounded-lg bg-components-input-bg-normal px-3 text-sm/10"
- value={tempData.user_prefix}
- onChange={(e) =>
- setTempData({
- ...tempData,
- user_prefix: e.target.value,
- })
- }
- />
+ <div className="mt-6 text-sm leading-5.25 font-medium text-text-primary">
+ {t(($) => $['feature.conversationHistory.editModal.assistantPrefix'], {
+ ns: 'appDebug',
+ })}
+ </div>
+ <input
+ className="mt-2 box-border h-10 w-full rounded-lg bg-components-input-bg-normal px-3 text-sm/10"
+ value={tempData.assistant_prefix}
+ onChange={(e) =>
+ setTempData({
+ ...tempData,
+ assistant_prefix: e.target.value,
+ })
+ }
+ placeholder={t(($) => $['chat.conversationNamePlaceholder'], { ns: 'common' }) || ''}
+ />
+ </DialogBody>
- <div className="mt-6 text-sm leading-5.25 font-medium text-text-primary">
- {t(($) => $['feature.conversationHistory.editModal.assistantPrefix'], { ns: 'appDebug' })}
- </div>
- <input
- className="mt-2 box-border h-10 w-full rounded-lg bg-components-input-bg-normal px-3 text-sm/10"
- value={tempData.assistant_prefix}
- onChange={(e) =>
- setTempData({
- ...tempData,
- assistant_prefix: e.target.value,
- })
- }
- placeholder={t(($) => $['chat.conversationNamePlaceholder'], { ns: 'common' }) || ''}
- />
-
- <div className="mt-10 flex justify-end">
- <Button className="mr-2 shrink-0" onClick={onClose}>
+ <DialogFooter>
+ <Button className="shrink-0" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
<Button
@@ -71,7 +83,7 @@ const EditModal: FC<Props> = ({ isShow, saveLoading, data, onClose, onSave }) =>
>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/app/configuration/config-var/config-modal/__tests__/index.spec.tsx b/web/app/components/app/configuration/config-var/config-modal/__tests__/index.spec.tsx
index 05cdf23b2b2..4df00653274 100644
--- a/web/app/components/app/configuration/config-var/config-modal/__tests__/index.spec.tsx
+++ b/web/app/components/app/configuration/config-var/config-modal/__tests__/index.spec.tsx
@@ -609,7 +609,7 @@ describe('ConfigModal', () => {
expect(onConfirm).not.toHaveBeenCalled()
})
- it('should keep scrolling inside the form body so scrollbars do not cover dialog corners', () => {
+ it('should scroll the dialog surface while clipping horizontal overflow in the form body', () => {
render(
<ConfigModal
isCreate
@@ -623,8 +623,7 @@ describe('ConfigModal', () => {
const dialog = screen.getByRole('dialog')
const scrollArea = screen.getByTestId('config-modal-scroll-area')
- expect(dialog).toHaveClass('overflow-hidden!')
- expect(scrollArea).toHaveClass('overflow-y-auto')
+ expect(dialog).toHaveClass('overflow-y-auto')
expect(scrollArea).toHaveClass('overflow-x-hidden')
})
diff --git a/web/app/components/app/configuration/config-var/config-modal/index.tsx b/web/app/components/app/configuration/config-var/config-modal/index.tsx
index 00ba0790149..ec709a25dc7 100644
--- a/web/app/components/app/configuration/config-var/config-modal/index.tsx
+++ b/web/app/components/app/configuration/config-var/config-modal/index.tsx
@@ -4,7 +4,14 @@ import type { ChangeEvent, FC } from 'react'
import type { Item as SelectItem } from './type-select'
import type { ConfigModalValidationError } from './utils'
import type { InputVar, MoreInfo } from '@/app/components/workflow/types'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { skipToken, useQuery, useQueryClient } from '@tanstack/react-query'
import * as React from 'react'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
@@ -202,26 +209,27 @@ const ConfigModal: FC<IConfigModalProps> = ({
if (!open) onClose()
}}
>
- <DialogContent className="flex max-h-[calc(100dvh-2rem)] flex-col overflow-hidden! border-none p-0! text-left align-middle">
+ <DialogContent className="max-h-[calc(100dvh-2rem)]">
<form
noValidate
- className="flex min-h-0 flex-col"
onSubmit={(event) => {
event.preventDefault()
handleConfirm()
}}
>
- <DialogTitle className="shrink-0 px-6 pt-6 title-2xl-semi-bold text-text-primary">
- {t(($) => $[`variableConfig.${isCreate ? 'addModalTitle' : 'editModalTitle'}`], {
- ns: 'appDebug',
- })}
- </DialogTitle>
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $[`variableConfig.${isCreate ? 'addModalTitle' : 'editModalTitle'}`], {
+ ns: 'appDebug',
+ })}
+ </DialogTitle>
+ </DialogHeader>
- <div
+ <DialogBody
ref={modalRef}
tabIndex={-1}
data-testid="config-modal-scroll-area"
- className="min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto px-6 py-4 pb-8"
+ className="min-w-0 overflow-x-hidden"
>
<ConfigModalFormFields
checkboxDefaultSelectValue={checkboxDefaultSelectValue}
@@ -252,10 +260,10 @@ const ConfigModal: FC<IConfigModalProps> = ({
validationError={validationError}
t={t}
/>
- </div>
- <div className="shrink-0 px-6 pt-2 pb-6">
+ </DialogBody>
+ <DialogFooter>
<ModalFoot confirmType="submit" onCancel={onClose} />
- </div>
+ </DialogFooter>
</form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/app/configuration/config/agent/agent-setting/index.tsx b/web/app/components/app/configuration/config/agent/agent-setting/index.tsx
index 29e382a10a7..4901aa479ff 100644
--- a/web/app/components/app/configuration/config/agent/agent-setting/index.tsx
+++ b/web/app/components/app/configuration/config/agent/agent-setting/index.tsx
@@ -4,8 +4,10 @@ import type { AgentConfig } from '@/models/debug'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
+ DialogBackdrop,
DialogClose,
- DialogContent,
+ DialogPopup,
+ DialogPortal,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
@@ -44,15 +46,18 @@ export function AgentSettingDialog({ disabled, onSave, ...props }: Props) {
<span aria-hidden className="i-ri-settings-2-line size-4 text-text-tertiary" />
{t(($) => $['agent.setting.name'])}
</DialogTrigger>
- <DialogContent className="top-2 right-2 bottom-2 left-auto flex h-auto max-h-none w-160 max-w-[calc(100vw-1rem)] translate-x-0 translate-y-0 flex-col overflow-hidden rounded-xl p-0">
- <AgentSettingsForm
- {...props}
- onSave={(payload) => {
- onSave(payload)
- actionsRef.current?.close()
- }}
- />
- </DialogContent>
+ <DialogPortal>
+ <DialogBackdrop />
+ <DialogPopup className="fixed top-2 right-2 bottom-2 flex w-160 max-w-[calc(100vw-1rem)] flex-col overflow-hidden overscroll-contain rounded-xl">
+ <AgentSettingsForm
+ {...props}
+ onSave={(payload) => {
+ onSave(payload)
+ actionsRef.current?.close()
+ }}
+ />
+ </DialogPopup>
+ </DialogPortal>
</Dialog>
)
}
@@ -88,9 +93,7 @@ function AgentSettingsForm({
}}
>
<div className="flex h-14 shrink-0 items-center justify-between border-b border-divider-regular pr-5 pl-6">
- <DialogTitle className="text-base leading-6 font-semibold text-text-primary">
- {t(($) => $['agent.setting.name'], { ns: 'appDebug' })}
- </DialogTitle>
+ <DialogTitle>{t(($) => $['agent.setting.name'], { ns: 'appDebug' })}</DialogTitle>
<DialogClose
render={
<IconButton
diff --git a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx
index c75eef3b5f2..f56e78c6692 100644
--- a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx
+++ b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx
@@ -268,11 +268,14 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
if (!open) onClose()
}}
>
- <DialogContent className="max-h-[calc(100dvh-2rem)] w-285 overflow-y-auto border-none p-0! text-left align-middle xl:h-[min(680px,calc(100dvh-2rem))] xl:overflow-hidden">
+ <DialogContent className="max-h-[calc(100dvh-2rem)] w-285 xl:h-[min(680px,calc(100dvh-2rem))] xl:overflow-hidden">
<div className="flex min-h-0 flex-col xl:h-full xl:flex-row">
<div className="min-w-0 border-divider-regular p-6 xl:h-full xl:flex-1 xl:overflow-y-auto xl:border-r">
<div className="mb-5">
- <DialogTitle className={`text-lg leading-7 font-bold ${s.textGradient}`}>
+ <DialogTitle
+ // oxlint-disable-next-line shadcn/no-restyle -- Gradient generator title keeps its own type; the module class paints the gradient.
+ className={`text-lg leading-7 font-bold ${s.textGradient}`}
+ >
{t(($) => $['generate.title'], { ns: 'appGeneration' })}
</DialogTitle>
<div className="mt-1 text-[13px] font-normal text-text-tertiary">
diff --git a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx
index df61616c307..391c7d41123 100644
--- a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx
+++ b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx
@@ -189,7 +189,7 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = ({
if (!open) onClose()
}}
>
- <DialogContent className="h-[min(680px,calc(100dvh-2rem))] max-h-none! w-full min-w-285 overflow-hidden! border-none p-0! text-left align-middle">
+ <DialogContent className="h-[min(680px,calc(100dvh-2rem))] max-h-none w-full min-w-285 overflow-hidden">
<div className="relative flex h-full min-h-0 flex-wrap">
<div className="h-full w-142.5 shrink-0 overflow-y-auto border-r border-divider-regular p-6">
<div className="mb-5">
diff --git a/web/app/components/app/configuration/dataset-config/params-config/index.tsx b/web/app/components/app/configuration/dataset-config/params-config/index.tsx
index 92481b3bc60..98981859b6d 100644
--- a/web/app/components/app/configuration/dataset-config/params-config/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/params-config/index.tsx
@@ -125,7 +125,7 @@ const ParamsConfig = ({ disabled, selectedDatasets }: ParamsConfigProps) => {
}
}}
>
- <DialogContent className="w-full max-w-120 border-none text-left align-middle sm:min-w-132">
+ <DialogContent className="w-120 p-6 sm:min-w-132">
<ConfigContent
datasetConfigs={tempDataSetConfigs}
onChange={handleSetTempDataSetConfigs}
diff --git a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
index 2abbabdcae2..158ef24b31a 100644
--- a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
@@ -3,8 +3,15 @@ import type { DatasetDetailWithPartialMembersResponse } from '@dify/contracts/ap
import type { FC } from 'react'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useInfiniteQuery } from '@tanstack/react-query'
import { useInfiniteScroll } from 'ahooks'
import { useAtomValue } from 'jotai'
@@ -110,113 +117,108 @@ const SelectDataSet: FC<ISelectDataSetProps> = ({
return (
<Dialog modal={modal} open={isShow} onOpenChange={handleOpenChange}>
- <DialogContent backdropProps={{ forceRender: true }} className="w-100 overflow-hidden">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['feature.dataSet.selectTitle'], { ns: 'appDebug' })}
- </DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- {isLoading && datasets.length === 0 && (
- <div className="flex h-50">
- <LoadingPlaceholder />
- </div>
- )}
+ <DialogContent backdropProps={{ forceRender: true }} className="w-100">
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['feature.dataSet.selectTitle'], { ns: 'appDebug' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ {isLoading && datasets.length === 0 && (
+ <div className="flex h-50">
+ <LoadingPlaceholder />
+ </div>
+ )}
- {hasNoData && (
- <div className="mt-6 flex h-32 items-center justify-center space-x-1 rounded-lg border border-divider-subtle bg-components-panel-on-panel-item-bg text-[13px]">
- <span className="text-text-tertiary">
- {t(($) => $['feature.dataSet.noDataSet'], { ns: 'appDebug' })}
- </span>
- {canCreateDataset && (
- <Link href="/datasets/create" className="font-normal text-text-accent">
- {t(($) => $['feature.dataSet.toCreate'], { ns: 'appDebug' })}
- </Link>
- )}
- </div>
- )}
+ {hasNoData && (
+ <div className="flex h-32 items-center justify-center space-x-1 rounded-lg border border-divider-subtle bg-components-panel-on-panel-item-bg text-[13px]">
+ <span className="text-text-tertiary">
+ {t(($) => $['feature.dataSet.noDataSet'], { ns: 'appDebug' })}
+ </span>
+ {canCreateDataset && (
+ <Link href="/datasets/create" className="font-normal text-text-accent">
+ {t(($) => $['feature.dataSet.toCreate'], { ns: 'appDebug' })}
+ </Link>
+ )}
+ </div>
+ )}
- {datasets.length > 0 && (
- <>
- <div ref={listRef} className="mt-7 max-h-71.5 space-y-1 overflow-y-auto">
- {datasets.map((item) => (
- <button
- key={item.id}
- type="button"
- disabled={!item.embedding_available}
- className={cn(
- 'flex h-10 w-full cursor-pointer items-center rounded-lg border-[0.5px] border-components-panel-border-subtle bg-components-panel-on-panel-item-bg px-2 text-left shadow-xs outline-hidden hover:border-components-panel-border hover:bg-components-panel-on-panel-item-bg-hover hover:shadow-sm focus-visible:ring-2 focus-visible:ring-state-accent-solid',
- selectedIdsInModal.includes(item.id) &&
- 'border-[1.5px] border-components-option-card-option-selected-border bg-state-accent-hover shadow-xs hover:border-components-option-card-option-selected-border hover:bg-state-accent-hover hover:shadow-xs',
- !item.embedding_available &&
- 'cursor-default hover:border-components-panel-border-subtle hover:bg-components-panel-on-panel-item-bg hover:shadow-xs',
- )}
- onClick={() => toggleSelect(item)}
- >
- <div className="mr-1 flex grow items-center overflow-hidden">
- <div className={cn('mr-2', !item.embedding_available && 'opacity-30')}>
- <AppIcon size="tiny" icon={item.icon_info} />
- </div>
- <div
- className={cn(
- 'max-w-50 truncate text-[13px] font-medium text-text-secondary',
- !item.embedding_available && 'max-w-30! opacity-30',
+ {datasets.length > 0 && (
+ <>
+ <div ref={listRef} className="max-h-71.5 space-y-1 overflow-y-auto">
+ {datasets.map((item) => (
+ <button
+ key={item.id}
+ type="button"
+ disabled={!item.embedding_available}
+ className={cn(
+ 'flex h-10 w-full cursor-pointer items-center rounded-lg border-[0.5px] border-components-panel-border-subtle bg-components-panel-on-panel-item-bg px-2 text-left shadow-xs outline-hidden hover:border-components-panel-border hover:bg-components-panel-on-panel-item-bg-hover hover:shadow-sm focus-visible:ring-2 focus-visible:ring-state-accent-solid',
+ selectedIdsInModal.includes(item.id) &&
+ 'border-[1.5px] border-components-option-card-option-selected-border bg-state-accent-hover shadow-xs hover:border-components-option-card-option-selected-border hover:bg-state-accent-hover hover:shadow-xs',
+ !item.embedding_available &&
+ 'cursor-default hover:border-components-panel-border-subtle hover:bg-components-panel-on-panel-item-bg hover:shadow-xs',
+ )}
+ onClick={() => toggleSelect(item)}
+ >
+ <div className="mr-1 flex grow items-center overflow-hidden">
+ <div className={cn('mr-2', !item.embedding_available && 'opacity-30')}>
+ <AppIcon size="tiny" icon={item.icon_info} />
+ </div>
+ <div
+ className={cn(
+ 'max-w-50 truncate text-[13px] font-medium text-text-secondary',
+ !item.embedding_available && 'max-w-30! opacity-30',
+ )}
+ >
+ {item.name}
+ </div>
+ {!item.embedding_available && (
+ <span className="ml-1 shrink-0 rounded-md border border-divider-deep px-1 text-xs leading-4.5 font-normal text-text-tertiary">
+ {t(($) => $.unavailable, { ns: 'dataset' })}
+ </span>
)}
- >
- {item.name}
</div>
- {!item.embedding_available && (
- <span className="ml-1 shrink-0 rounded-md border border-divider-deep px-1 text-xs leading-4.5 font-normal text-text-tertiary">
- {t(($) => $.unavailable, { ns: 'dataset' })}
- </span>
+ {item.is_multimodal && (
+ <div className="mr-1 shrink-0">
+ <FeatureIcon feature={ModelFeatureEnum.vision} />
+ </div>
)}
- </div>
- {item.is_multimodal && (
- <div className="mr-1 shrink-0">
- <FeatureIcon feature={ModelFeatureEnum.vision} />
- </div>
- )}
- {!!item.indexing_technique && (
- <Badge
- className="shrink-0"
- text={formatIndexingTechniqueAndMethod(
- item.indexing_technique,
- item.retrieval_model_dict?.search_method,
- )}
- />
- )}
- {item.provider === 'external' && (
- <Badge className="shrink-0" text={t(($) => $.externalTag, { ns: 'dataset' })} />
- )}
- </button>
- ))}
- {isFetchingNextPage && <LoadingPlaceholder />}
- </div>
- </>
- )}
+ {!!item.indexing_technique && (
+ <Badge
+ className="shrink-0"
+ text={formatIndexingTechniqueAndMethod(
+ item.indexing_technique,
+ item.retrieval_model_dict?.search_method,
+ )}
+ />
+ )}
+ {item.provider === 'external' && (
+ <Badge
+ className="shrink-0"
+ text={t(($) => $.externalTag, { ns: 'dataset' })}
+ />
+ )}
+ </button>
+ ))}
+ {isFetchingNextPage && <LoadingPlaceholder />}
+ </div>
+ </>
+ )}
+ </DialogBody>
{!isLoading && (
- <div className="mt-8 flex items-center justify-between">
- <div className="text-sm font-medium text-text-secondary">
+ <DialogFooter>
+ <div className="me-auto text-sm font-medium text-text-secondary">
{selected.length > 0 &&
`${selected.length} ${t(($) => $['feature.dataSet.selected'], { ns: 'appDebug' })}`}
</div>
- <div className="flex space-x-2">
- <Button onClick={handleClose}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <Button variant="primary" onClick={handleSelect} disabled={hasNoData}>
- {t(($) => $['operation.add'], { ns: 'common' })}
- </Button>
- </div>
- </div>
+ <Button onClick={handleClose}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <Button variant="primary" onClick={handleSelect} disabled={hasNoData}>
+ {t(($) => $['operation.add'], { ns: 'common' })}
+ </Button>
+ </DialogFooter>
)}
</DialogContent>
</Dialog>
diff --git a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx
index 2bfd2667422..bc8c3087ffb 100644
--- a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx
+++ b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx
@@ -1,7 +1,14 @@
import type { FC } from 'react'
import type { ExternalDataTool } from '@/models/common'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import {
Select,
SelectContent,
@@ -121,127 +128,130 @@ const ExternalDataToolModal: FC<ExternalDataToolModalProps> = ({
return (
<Dialog open onOpenChange={noop}>
- <DialogContent className="w-160! max-w-none! p-8! pb-6!">
- <div className="mb-2 text-xl font-semibold text-text-primary">
- {`${action} ${t(($) => $['variableConfig.apiBasedVar'], { ns: 'appDebug' })}`}
- </div>
- <div className="py-2">
- <div className="text-sm/9 font-medium text-text-primary">
- {t(($) => $['apiBasedExtension.type'], { ns: 'common' })}
- </div>
- <Select
- defaultValue={localeData.type}
- onValueChange={(value) => value && handleDataTypeChange(value)}
- >
- <SelectTrigger
- className="w-full"
- aria-label={t(($) => $['apiBasedExtension.type'], { ns: 'common' })}
+ <DialogContent className="w-160 max-w-none">
+ <DialogHeader>
+ <DialogTitle>
+ {`${action} ${t(($) => $['variableConfig.apiBasedVar'], { ns: 'appDebug' })}`}
+ </DialogTitle>
+ </DialogHeader>
+ <DialogBody>
+ <div className="py-2">
+ <div className="text-sm/9 font-medium text-text-primary">
+ {t(($) => $['apiBasedExtension.type'], { ns: 'common' })}
+ </div>
+ <Select
+ defaultValue={localeData.type}
+ onValueChange={(value) => value && handleDataTypeChange(value)}
>
- <SelectValue />
- </SelectTrigger>
- <SelectContent className="w-88.5">
- {providers.map((option) => (
- <SelectItem key={option.key} value={option.key}>
- <SelectItemText>{option.name}</SelectItemText>
- <SelectItemIndicator />
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
- <div className="py-2">
- <div className="text-sm/9 font-medium text-text-primary">
- {t(($) => $['feature.tools.modal.name.title'], { ns: 'appDebug' })}
+ <SelectTrigger
+ className="w-full"
+ aria-label={t(($) => $['apiBasedExtension.type'], { ns: 'common' })}
+ >
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent className="w-88.5">
+ {providers.map((option) => (
+ <SelectItem key={option.key} value={option.key}>
+ <SelectItemText>{option.name}</SelectItemText>
+ <SelectItemIndicator />
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ <div className="py-2">
+ <div className="text-sm/9 font-medium text-text-primary">
+ {t(($) => $['feature.tools.modal.name.title'], { ns: 'appDebug' })}
+ </div>
+ <div className="flex items-center">
+ <input
+ value={localeData.label || ''}
+ onChange={(e) => handleValueChange({ label: e.target.value })}
+ className="mr-2 block h-9 grow appearance-none rounded-lg bg-components-input-bg-normal px-3 text-sm text-components-input-text-filled outline-hidden"
+ placeholder={
+ t(($) => $['feature.tools.modal.name.placeholder'], { ns: 'appDebug' }) || ''
+ }
+ />
+ <IconPicker
+ value={
+ localeData.icon
+ ? {
+ type: 'emoji',
+ icon: localeData.icon,
+ background: localeData.icon_background,
+ }
+ : undefined
+ }
+ onValueChange={(value) => {
+ if (value.type !== 'emoji') return
+ const { icon, background: icon_background } = value
+ handleValueChange({ icon, icon_background })
+ }}
+ >
+ <IconPickerTrigger
+ aria-label={t(($) => $['iconPicker.title'], { ns: 'app' })}
+ className="shrink-0 cursor-pointer rounded-lg"
+ >
+ <IconPickerIcon
+ size="large"
+ className="h-9! w-9! rounded-lg border-[0.5px] border-components-panel-border"
+ />
+ </IconPickerTrigger>
+ <IconPickerContent enableImageUpload={false} />
+ </IconPicker>
+ </div>
</div>
- <div className="flex items-center">
+ <div className="py-2">
+ <div className="text-sm/9 font-medium text-text-primary">
+ {t(($) => $['feature.tools.modal.variableName.title'], { ns: 'appDebug' })}
+ </div>
<input
- value={localeData.label || ''}
- onChange={(e) => handleValueChange({ label: e.target.value })}
- className="mr-2 block h-9 grow appearance-none rounded-lg bg-components-input-bg-normal px-3 text-sm text-components-input-text-filled outline-hidden"
+ value={localeData.variable || ''}
+ onChange={(e) => handleValueChange({ variable: e.target.value })}
+ className="block h-9 w-full appearance-none rounded-lg bg-components-input-bg-normal px-3 text-sm text-components-input-text-filled outline-hidden"
placeholder={
- t(($) => $['feature.tools.modal.name.placeholder'], { ns: 'appDebug' }) || ''
+ t(($) => $['feature.tools.modal.variableName.placeholder'], { ns: 'appDebug' }) ||
+ ''
}
/>
- <IconPicker
- value={
- localeData.icon
- ? {
- type: 'emoji',
- icon: localeData.icon,
- background: localeData.icon_background,
- }
- : undefined
- }
- onValueChange={(value) => {
- if (value.type !== 'emoji') return
- const { icon, background: icon_background } = value
- handleValueChange({ icon, icon_background })
- }}
- >
- <IconPickerTrigger
- aria-label={t(($) => $['iconPicker.title'], { ns: 'app' })}
- className="shrink-0 cursor-pointer rounded-lg"
- >
- <IconPickerIcon
- size="large"
- className="h-9! w-9! rounded-lg border-[0.5px] border-components-panel-border"
- />
- </IconPickerTrigger>
- <IconPickerContent enableImageUpload={false} />
- </IconPicker>
</div>
- </div>
- <div className="py-2">
- <div className="text-sm/9 font-medium text-text-primary">
- {t(($) => $['feature.tools.modal.variableName.title'], { ns: 'appDebug' })}
- </div>
- <input
- value={localeData.variable || ''}
- onChange={(e) => handleValueChange({ variable: e.target.value })}
- className="block h-9 w-full appearance-none rounded-lg bg-components-input-bg-normal px-3 text-sm text-components-input-text-filled outline-hidden"
- placeholder={
- t(($) => $['feature.tools.modal.variableName.placeholder'], { ns: 'appDebug' }) || ''
- }
- />
- </div>
- {localeData.type === 'api' && (
- <div className="py-2">
- <div className="flex h-9 items-center justify-between text-sm font-medium text-text-primary">
- {t(($) => $['apiBasedExtension.selector.title'], { ns: 'common' })}
- <a
- href={docLink('/use-dify/workspace/api-extension/api-extension')}
- target="_blank"
- rel="noopener noreferrer"
- className="group flex items-center text-xs font-normal text-text-tertiary hover:text-text-accent"
- >
- <span
- aria-hidden
- className="mr-1 i-custom-vender-line-education-book-open-01 size-3 text-text-tertiary group-hover:text-text-accent"
- />
- {t(($) => $['apiBasedExtension.link'], { ns: 'common' })}
- </a>
+ {localeData.type === 'api' && (
+ <div className="py-2">
+ <div className="flex h-9 items-center justify-between text-sm font-medium text-text-primary">
+ {t(($) => $['apiBasedExtension.selector.title'], { ns: 'common' })}
+ <a
+ href={docLink('/use-dify/workspace/api-extension/api-extension')}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="group flex items-center text-xs font-normal text-text-tertiary hover:text-text-accent"
+ >
+ <span
+ aria-hidden
+ className="mr-1 i-custom-vender-line-education-book-open-01 size-3 text-text-tertiary group-hover:text-text-accent"
+ />
+ {t(($) => $['apiBasedExtension.link'], { ns: 'common' })}
+ </a>
+ </div>
+ <ApiBasedExtensionSelector
+ value={localeData.config?.api_based_extension_id || ''}
+ onChange={handleDataApiBasedChange}
+ />
</div>
- <ApiBasedExtensionSelector
- value={localeData.config?.api_based_extension_id || ''}
- onChange={handleDataApiBasedChange}
+ )}
+ {localeData.type !== 'api' && currentProvider?.form_schema && (
+ <FormGeneration
+ forms={currentProvider?.form_schema}
+ value={localeData.config}
+ onChange={handleDataExtraChange}
/>
- </div>
- )}
- {localeData.type !== 'api' && currentProvider?.form_schema && (
- <FormGeneration
- forms={currentProvider?.form_schema}
- value={localeData.config}
- onChange={handleDataExtraChange}
- />
- )}
- <div className="mt-6 flex items-center justify-end">
- <Button onClick={onCancel} className="mr-2">
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
+ )}
+ </DialogBody>
+ <DialogFooter>
+ <Button onClick={onCancel}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>
<Button variant="primary" onClick={handleSave}>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/app/create-app-dialog-shell.tsx b/web/app/components/app/create-app-dialog-shell.tsx
index a102d750b45..0b9fd636c2a 100644
--- a/web/app/components/app/create-app-dialog-shell.tsx
+++ b/web/app/components/app/create-app-dialog-shell.tsx
@@ -2,7 +2,13 @@
import type { ReactNode } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBackdrop,
+ DialogPopup,
+ DialogPortal,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
type CreateAppDialogShellProps = {
children: ReactNode
@@ -26,28 +32,28 @@ export function CreateAppDialogShell({
if (!nextOpen) onClose()
}}
>
- <DialogContent
- backdropProps={{ className: 'bg-background-overlay-backdrop backdrop-blur-[6px]' }}
- className="top-0 left-0 h-screen max-h-none w-screen max-w-none translate-0 overflow-hidden rounded-none border-none bg-transparent p-4 shadow-none"
- >
- <div className="size-full rounded-2xl border border-effects-highlight bg-background-default-subtle">
- <div className={cn('relative h-full overflow-hidden', contentClassName)}>
- <DialogTitle className="sr-only">{title}</DialogTitle>
- <button
- type="button"
- aria-label="Close"
- className="absolute top-3 right-3 z-50 flex h-9 w-9 cursor-pointer items-center justify-center rounded-[10px] bg-components-button-tertiary-bg hover:bg-components-button-tertiary-bg-hover"
- onClick={onClose}
- >
- <span
- aria-hidden="true"
- className="i-ri-close-large-line size-3.5 text-components-button-tertiary-text"
- />
- </button>
- {children}
+ <DialogPortal>
+ <DialogBackdrop className="bg-background-overlay-backdrop backdrop-blur-[6px]" />
+ <DialogPopup className="fixed top-0 left-0 h-screen w-screen overflow-hidden overscroll-contain rounded-none border-none bg-transparent p-4 shadow-none">
+ <div className="size-full rounded-2xl border border-effects-highlight bg-background-default-subtle">
+ <div className={cn('relative h-full overflow-hidden', contentClassName)}>
+ <DialogTitle className="sr-only">{title}</DialogTitle>
+ <button
+ type="button"
+ aria-label="Close"
+ className="absolute top-3 right-3 z-50 flex h-9 w-9 cursor-pointer items-center justify-center rounded-[10px] bg-components-button-tertiary-bg hover:bg-components-button-tertiary-bg-hover"
+ onClick={onClose}
+ >
+ <span
+ aria-hidden="true"
+ className="i-ri-close-large-line size-3.5 text-components-button-tertiary-text"
+ />
+ </button>
+ {children}
+ </div>
</div>
- </div>
- </DialogContent>
+ </DialogPopup>
+ </DialogPortal>
</Dialog>
)
}
diff --git a/web/app/components/app/create-from-dsl-modal/index.tsx b/web/app/components/app/create-from-dsl-modal/index.tsx
index 84a9c3f3cda..efd49e05066 100644
--- a/web/app/components/app/create-from-dsl-modal/index.tsx
+++ b/web/app/components/app/create-from-dsl-modal/index.tsx
@@ -5,14 +5,14 @@ import type { Hotkey } from '@tanstack/react-hotkeys'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogBackdrop,
- DialogPopup,
- DialogPortal,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { Kbd, KbdGroup } from '@langgenius/dify-ui/kbd'
import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'
@@ -296,127 +296,109 @@ function CreateFromDSLModal({
if (!open && !isImporting && !pendingImport) onClose()
}}
>
- <DialogPortal>
- <DialogBackdrop />
- <DialogPopup
- initialFocus={browseButtonRef}
- className="fixed top-1/2 left-1/2 max-h-[80dvh] w-120 max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-hidden overscroll-contain text-left align-middle"
+ <DialogContent initialFocus={browseButtonRef}>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.importApp, { ns: 'app' })}</DialogTitle>
+ <DialogCloseButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ disabled={isImporting}
+ />
+ </DialogHeader>
+ <Form<ImportFormValues>
+ onFormSubmit={handleSubmit}
+ onKeyDown={(event) => {
+ if (
+ !show ||
+ createDisabled ||
+ isImporting ||
+ !!pendingImport ||
+ event.defaultPrevented ||
+ event.nativeEvent.isComposing ||
+ !(event.target instanceof Node) ||
+ !event.currentTarget.contains(event.target) ||
+ !matchesKeyboardEvent(event.nativeEvent, CREATE_FROM_DSL_HOTKEY)
+ )
+ return
+ event.preventDefault()
+ event.stopPropagation()
+ if (event.repeat) return
+ event.currentTarget.requestSubmit()
+ }}
>
- <div className="flex items-center justify-between pt-6 pr-5 pb-3 pl-6">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $.importApp, { ns: 'app' })}
- </DialogTitle>
- <IconButton
- variant="ghost"
- size="lg"
- aria-label={t(($) => $['operation.cancel'], { ns: 'common' })}
- className="rounded-md"
- disabled={isImporting}
- onClick={onClose}
- >
- <span aria-hidden className="i-ri-close-line size-5 text-text-tertiary" />
- </IconButton>
- </div>
- <Form<ImportFormValues>
- onFormSubmit={handleSubmit}
- onKeyDown={(event) => {
- if (
- !show ||
- createDisabled ||
- isImporting ||
- !!pendingImport ||
- event.defaultPrevented ||
- event.nativeEvent.isComposing ||
- !(event.target instanceof Node) ||
- !event.currentTarget.contains(event.target) ||
- !matchesKeyboardEvent(event.nativeEvent, CREATE_FROM_DSL_HOTKEY)
- )
- return
- event.preventDefault()
- event.stopPropagation()
- if (event.repeat) return
- event.currentTarget.requestSubmit()
- }}
- >
- <Tabs value={currentTab} onValueChange={handleTabChange}>
- <TabsList className="h-9 gap-6 border-b border-divider-subtle px-6">
- <TabsTab
- value={CreateFromDSLModalTab.FROM_FILE}
- className="h-full pt-0 pb-0"
- disabled={isImporting}
- >
- {t(($) => $.importFromFile, { ns: 'app' })}
- </TabsTab>
- <TabsTab
- value={CreateFromDSLModalTab.FROM_URL}
- className="h-full pt-0 pb-0"
- disabled={isImporting}
- >
- {t(($) => $.importFromDSLUrl, { ns: 'app' })}
- </TabsTab>
- </TabsList>
- <TabsPanel
+ <Tabs value={currentTab} onValueChange={handleTabChange}>
+ <TabsList className="h-9 gap-6 border-b border-divider-subtle px-6">
+ <TabsTab
value={CreateFromDSLModalTab.FROM_FILE}
- tabIndex={-1}
- className="px-6 py-4"
+ className="h-full pt-0 pb-0"
+ disabled={isImporting}
>
- <Uploader
- importType="app"
- browseButtonRef={browseButtonRef}
- className="mt-0"
- file={currentFile}
- updateFile={setCurrentFile}
- disabled={isImporting}
- />
- </TabsPanel>
- <TabsPanel
+ {t(($) => $.importFromFile, { ns: 'app' })}
+ </TabsTab>
+ <TabsTab
value={CreateFromDSLModalTab.FROM_URL}
- tabIndex={-1}
- className="px-6 py-4"
+ className="h-full pt-0 pb-0"
+ disabled={isImporting}
>
- <Field name="dslUrl">
- <FieldLabel>{t(($) => $.importFromDSLUrl, { ns: 'app' })}</FieldLabel>
- <Input
- type="url"
- inputMode="url"
- autoComplete="off"
- required
- disabled={isImporting}
- placeholder={t(($) => $.importAppUrlPlaceholder, { ns: 'app' }) || ''}
- defaultValue={dslUrl}
- />
- <FieldError />
- </Field>
- </TabsPanel>
- </Tabs>
- {isAppsFull && (
- <div className="px-6">
- <AppsFull className="mt-0" loc="app-create-dsl" />
- </div>
- )}
- <div className="flex justify-end px-6 py-5">
- <Button className="mr-2" disabled={isImporting} onClick={onClose}>
- {t(($) => $['newApp.Cancel'], { ns: 'app' })}
- </Button>
- <Button
- type="submit"
- disabled={createDisabled}
- loading={isImporting}
- variant="primary"
- >
- <span>{t(($) => $['operation.create'], { ns: 'common' })}</span>
- <KbdGroup>
- {formatForDisplay(CREATE_FROM_DSL_HOTKEY, { parts: true }).map((key) => (
- <Kbd key={key} color="white">
- {key}
- </Kbd>
- ))}
- </KbdGroup>
- </Button>
+ {t(($) => $.importFromDSLUrl, { ns: 'app' })}
+ </TabsTab>
+ </TabsList>
+ <TabsPanel
+ value={CreateFromDSLModalTab.FROM_FILE}
+ tabIndex={-1}
+ className="px-6 py-4"
+ >
+ <Uploader
+ importType="app"
+ browseButtonRef={browseButtonRef}
+ className="mt-0"
+ file={currentFile}
+ updateFile={setCurrentFile}
+ disabled={isImporting}
+ />
+ </TabsPanel>
+ <TabsPanel value={CreateFromDSLModalTab.FROM_URL} tabIndex={-1} className="px-6 py-4">
+ <Field name="dslUrl">
+ <FieldLabel>{t(($) => $.importFromDSLUrl, { ns: 'app' })}</FieldLabel>
+ <Input
+ type="url"
+ inputMode="url"
+ autoComplete="off"
+ required
+ disabled={isImporting}
+ placeholder={t(($) => $.importAppUrlPlaceholder, { ns: 'app' }) || ''}
+ defaultValue={dslUrl}
+ />
+ <FieldError />
+ </Field>
+ </TabsPanel>
+ </Tabs>
+ {isAppsFull && (
+ <div className="px-6">
+ <AppsFull className="mt-0" loc="app-create-dsl" />
</div>
- </Form>
- </DialogPopup>
- </DialogPortal>
+ )}
+ <DialogFooter>
+ <Button disabled={isImporting} onClick={onClose}>
+ {t(($) => $['newApp.Cancel'], { ns: 'app' })}
+ </Button>
+ <Button
+ type="submit"
+ disabled={createDisabled}
+ loading={isImporting}
+ variant="primary"
+ >
+ <span>{t(($) => $['operation.create'], { ns: 'common' })}</span>
+ <KbdGroup>
+ {formatForDisplay(CREATE_FROM_DSL_HOTKEY, { parts: true }).map((key) => (
+ <Kbd key={key} color="white">
+ {key}
+ </Kbd>
+ ))}
+ </KbdGroup>
+ </Button>
+ </DialogFooter>
+ </Form>
+ </DialogContent>
</Dialog>
{pendingImport && (
<DSLConfirmModal
diff --git a/web/app/components/app/deploy/deployment-dialog/index.tsx b/web/app/components/app/deploy/deployment-dialog/index.tsx
index 3b19289a8a7..63e70709000 100644
--- a/web/app/components/app/deploy/deployment-dialog/index.tsx
+++ b/web/app/components/app/deploy/deployment-dialog/index.tsx
@@ -30,7 +30,7 @@ function DeploymentDialogSession({
return (
<DialogContent
className={cn(
- 'flex max-h-[min(44rem,calc(100dvh-32px))] min-h-0 w-120 max-w-[calc(100vw-32px)] flex-col overflow-hidden p-0',
+ 'flex max-h-[min(44rem,calc(100dvh-32px))] min-h-0 max-w-[calc(100vw-32px)] flex-col overflow-hidden',
!selectedVersion && 'h-[min(44rem,calc(100dvh-32px))]',
)}
>
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/index.tsx b/web/app/components/app/deploy/shared/deployment-configuration/index.tsx
index df46add20fe..704cde9058c 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/index.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/index.tsx
@@ -86,7 +86,7 @@ export function DeploymentConfiguration({
{t(($) => $['studio.deployConfiguration'])}
</h2>
) : (
- <DialogTitle className="mt-0.5 px-1 title-2xl-semi-bold text-text-primary">
+ <DialogTitle className="mt-0.5 px-1">
{t(($) => $['studio.deployConfiguration'])}
</DialogTitle>
)}
diff --git a/web/app/components/app/deploy/shared/version-selection/index.tsx b/web/app/components/app/deploy/shared/version-selection/index.tsx
index 6f8b7092483..86fce5d74e2 100644
--- a/web/app/components/app/deploy/shared/version-selection/index.tsx
+++ b/web/app/components/app/deploy/shared/version-selection/index.tsx
@@ -43,8 +43,8 @@ export function VersionSelection({
}
/>
<header className="shrink-0 px-6 pt-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">{title}</DialogTitle>
- <DialogDescription className="mt-1 system-xs-regular text-text-tertiary">
+ <DialogTitle>{title}</DialogTitle>
+ <DialogDescription className="mt-1">
{t(($) => $['studio.chooseVersionToDeploy'])}
</DialogDescription>
</header>
diff --git a/web/app/components/app/duplicate-modal/index.tsx b/web/app/components/app/duplicate-modal/index.tsx
index 4ee5a5cd019..e4eeb699f82 100644
--- a/web/app/components/app/duplicate-modal/index.tsx
+++ b/web/app/components/app/duplicate-modal/index.tsx
@@ -2,9 +2,16 @@
import type { AppDetailWithSite, CopyAppPayload } from '@dify/contracts/api/console/apps/types.gen'
import type { IconPickerInputValue, IconPickerValue } from '@/app/components/base/icon-picker'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { useQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
@@ -105,25 +112,18 @@ const DuplicateAppModal = ({
if (!open) onHide()
}}
>
- <DialogContent className="w-full max-w-120! overflow-hidden! border-none px-8 text-left align-middle">
- <IconButton
- size="lg"
- className="absolute top-4 right-4"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- onClick={onHide}
- >
- <span aria-hidden="true" className="i-ri-close-line size-4" />
- </IconButton>
- <DialogTitle className="relative mt-3 mb-9 text-xl leading-7.5 font-semibold text-text-primary">
- {t(($) => $.duplicateTitle, { ns: 'app' })}
- </DialogTitle>
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.duplicateTitle, { ns: 'app' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
<form
onSubmit={(event) => {
event.preventDefault()
submit()
}}
>
- <div className="mb-9 system-sm-regular text-text-secondary">
+ <DialogBody>
<IconPicker value={pickerValue} onValueChange={setSelectedIcon}>
<Field name="name">
<FieldLabel className="system-md-medium">
@@ -148,20 +148,20 @@ const DuplicateAppModal = ({
<IconPickerContent />
</IconPicker>
{isAppsFull && <AppsFull className="mt-4" loc="app-duplicate-create" />}
- </div>
- <div className="flex flex-row-reverse">
+ </DialogBody>
+ <DialogFooter>
+ <Button type="button" className="w-24" onClick={onHide}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
<Button
type="submit"
disabled={isAppQuotaUnavailable || isAppsFull}
- className="ml-2 w-24"
+ className="w-24"
variant="primary"
>
{t(($) => $.duplicate, { ns: 'app' })}
</Button>
- <Button type="button" className="w-24" onClick={onHide}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- </div>
+ </DialogFooter>
</form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/app/overview/customize/index.tsx b/web/app/components/app/overview/customize/index.tsx
index cd010679be7..019c699289d 100644
--- a/web/app/components/app/overview/customize/index.tsx
+++ b/web/app/components/app/overview/customize/index.tsx
@@ -6,13 +6,14 @@ import { Button, buttonVariants } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useTranslation } from 'react-i18next'
import { useDocLink } from '@/context/i18n'
@@ -76,25 +77,17 @@ export function CustomizeDialog({
<span aria-hidden className="i-custom-vender-deploy-code-block size-4" />
{triggerLabel ?? t(($) => $['overview.appInfo.customize.entry'], { ns: 'appOverview' })}
</DialogTrigger>
- <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-160 flex-col overflow-hidden!">
- <DialogTitle className="shrink-0 title-2xl-semi-bold text-text-primary">
- {t(($) => $[`${prefixCustomize}.title`], { ns: 'appOverview' })}
- </DialogTitle>
- <DialogDescription className="mt-2 shrink-0 body-md-regular text-text-secondary">
- {t(($) => $[`${prefixCustomize}.explanation`], { ns: 'appOverview' })}
- </DialogDescription>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="mt-4 min-h-0 flex-1 overflow-y-auto overscroll-contain">
+ <DialogContent className="max-h-[calc(100dvh-2rem)] w-160">
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $[`${prefixCustomize}.title`], { ns: 'appOverview' })}
+ </DialogTitle>
+ <DialogDescription>
+ {t(($) => $[`${prefixCustomize}.explanation`], { ns: 'appOverview' })}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
<div className="w-full rounded-lg border-[0.5px] border-components-panel-border px-6 py-5">
<span className="inline-flex shrink-0 rounded-[5px] border border-text-accent-secondary bg-components-badge-bg-dimm px-1 py-0.5 system-2xs-medium-uppercase text-text-accent-secondary">
{t(($) => $[`${prefixCustomize}.way`], { ns: 'appOverview' })} 1
@@ -186,7 +179,7 @@ export function CustomizeDialog({
/>
</a>
</div>
- </div>
+ </DialogBody>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsx
index c633c6d1352..d64f8d7dcc0 100644
--- a/web/app/components/app/overview/embedded/index.tsx
+++ b/web/app/components/app/overview/embedded/index.tsx
@@ -8,9 +8,11 @@ import type {
import { cn } from '@langgenius/dify-ui/cn'
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '@langgenius/dify-ui/collapsible'
import {
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import { IconButton } from '@langgenius/dify-ui/icon-button'
@@ -215,9 +217,6 @@ const EmbeddedContent = ({
return (
<>
- <DialogDescription className="mt-8 mb-4 system-sm-medium text-text-primary">
- {t(($) => $[`${prefixEmbedded}.explanation`], { ns: 'appOverview' })}
- </DialogDescription>
{supportedHiddenInputs.length > 0 && (
<Collapsible className="mb-6 rounded-xl border-[0.5px] border-components-panel-border bg-background-section">
<CollapsibleTrigger className="group flex w-full items-center justify-between gap-3 rounded-xl px-4 py-3 text-left">
@@ -369,22 +368,15 @@ export function EmbeddedDialogContent({
const { t } = useTranslation(['appOverview', 'common'])
return (
- <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-160 flex-col overflow-hidden">
- <DialogTitle className="shrink-0 title-2xl-semi-bold text-text-primary">
- {t(($) => $[`${prefixEmbedded}.title`], { ns: 'appOverview' })}
- </DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="min-h-0 flex-1 overflow-y-auto overscroll-contain">
+ <DialogContent className="max-h-[calc(100dvh-2rem)] w-160">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $[`${prefixEmbedded}.title`], { ns: 'appOverview' })}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $[`${prefixEmbedded}.explanation`], { ns: 'appOverview' })}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
<Suspense
fallback={
<div className="py-8 text-text-tertiary">{t(($) => $.loading, { ns: 'common' })}</div>
@@ -399,7 +391,7 @@ export function EmbeddedDialogContent({
hiddenInputs={hiddenInputs}
/>
</Suspense>
- </div>
+ </DialogBody>
</DialogContent>
)
}
diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx
index cb5661b42d7..e0e55630d8a 100644
--- a/web/app/components/app/overview/settings/index.tsx
+++ b/web/app/components/app/overview/settings/index.tsx
@@ -11,16 +11,19 @@ import type { Language } from '@/types/app'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
+ DialogBody,
DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
import { Field, FieldDescription, FieldError, FieldLabel } from '@langgenius/dify-ui/field'
import { Fieldset, FieldsetLegend } from '@langgenius/dify-ui/fieldset'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'
import {
@@ -298,12 +301,9 @@ function SettingsForm({
}
return (
- <Form
- className="grid min-h-0 grid-rows-[auto_minmax(0,1fr)_auto]"
- onFormSubmit={handleFormSubmit}
- >
+ <Form className="flex min-h-0 flex-col" onFormSubmit={handleFormSubmit}>
{canDeploy && (
- <div className="row-start-1 px-6 py-2">
+ <div className="px-6 py-2">
<div
role="status"
aria-live="polite"
@@ -328,309 +328,316 @@ function SettingsForm({
</div>
</div>
)}
-
- <ScrollArea className="row-start-2 min-h-0 overflow-hidden">
+ <ScrollArea className="flex min-h-0 flex-col overflow-hidden">
<ScrollAreaViewport className="overscroll-contain">
- <ScrollAreaContent className="flex flex-col gap-y-5 px-6 py-3" style={{ minWidth: 0 }}>
- <div className="flex gap-4">
- <Field name="title" className="grow">
+ <ScrollAreaContent style={{ minWidth: 0 }}>
+ <DialogBody className="flex flex-col gap-y-5">
+ <div className="flex gap-4">
+ <Field name="title" className="grow">
+ <FieldLabel>
+ {t(($) => $[`${prefixSettings}.webName`], { ns: 'appOverview' })}
+ </FieldLabel>
+ <Input
+ readOnly={pending}
+ required
+ value={inputInfo.title}
+ onValueChange={(value) => setInputInfo((item) => ({ ...item, title: value }))}
+ placeholder={t(($) => $.appNamePlaceholder, { ns: 'app' })}
+ />
+ <FieldError match="valueMissing">
+ {t(($) => $['newApp.nameNotEmpty'], { ns: 'app' })}
+ </FieldError>
+ </Field>
+ <IconPicker
+ value={
+ appIcon ??
+ (appInfo.site.icon_type === 'emoji' && appInfo.site.icon
+ ? {
+ type: 'emoji',
+ icon: appInfo.site.icon,
+ background: appInfo.site.icon_background,
+ }
+ : undefined)
+ }
+ onValueChange={setAppIcon}
+ >
+ <IconPickerTrigger
+ disabled={pending}
+ aria-label={t(($) => $['iconPicker.title'], { ns: 'app' })}
+ className="shrink-0 self-center rounded-2xl"
+ >
+ <IconPickerIcon size="xxl" />
+ </IconPickerTrigger>
+ <IconPickerContent />
+ </IconPicker>
+ </div>
+
+ <Field name="description">
<FieldLabel>
- {t(($) => $[`${prefixSettings}.webName`], { ns: 'appOverview' })}
+ {t(($) => $[`${prefixSettings}.webDesc`], { ns: 'appOverview' })}
</FieldLabel>
- <Input
+ <Textarea
readOnly={pending}
- required
- value={inputInfo.title}
- onValueChange={(value) => setInputInfo((item) => ({ ...item, title: value }))}
- placeholder={t(($) => $.appNamePlaceholder, { ns: 'app' })}
+ value={inputInfo.desc}
+ onValueChange={(value) => setInputInfo((item) => ({ ...item, desc: value }))}
+ placeholder={t(($) => $[`${prefixSettings}.webDescPlaceholder`], {
+ ns: 'appOverview',
+ })}
/>
- <FieldError match="valueMissing">
- {t(($) => $['newApp.nameNotEmpty'], { ns: 'app' })}
- </FieldError>
+ <FieldDescription>
+ {t(($) => $[`${prefixSettings}.webDescTip`], { ns: 'appOverview' })}
+ </FieldDescription>
</Field>
- <IconPicker
- value={
- appIcon ??
- (appInfo.site.icon_type === 'emoji' && appInfo.site.icon
- ? {
- type: 'emoji',
- icon: appInfo.site.icon,
- background: appInfo.site.icon_background,
+ <Separator />
+
+ {isChat && (
+ <Field name="use_icon_as_answer_icon">
+ <div className="flex items-center justify-between gap-3">
+ <FieldLabel>{t(($) => $['answerIcon.title'], { ns: 'app' })}</FieldLabel>
+ <Switch
+ readOnly={pending}
+ checked={inputInfo.use_icon_as_answer_icon}
+ onCheckedChange={(v) =>
+ setInputInfo((item) => ({ ...item, use_icon_as_answer_icon: v }))
}
- : undefined)
- }
- onValueChange={setAppIcon}
- >
- <IconPickerTrigger
- disabled={pending}
- aria-label={t(($) => $['iconPicker.title'], { ns: 'app' })}
- className="shrink-0 self-center rounded-2xl"
+ />
+ </div>
+ <FieldDescription>
+ {t(($) => $['answerIcon.description'], { ns: 'app' })}
+ </FieldDescription>
+ </Field>
+ )}
+ <Field name="default_language" className="flex items-center justify-between gap-3">
+ <Select<Language>
+ readOnly={pending}
+ value={selectedLanguage?.value ?? null}
+ onValueChange={(value) => {
+ if (value !== null) setLanguage(value)
+ }}
>
- <IconPickerIcon size="xxl" />
- </IconPickerTrigger>
- <IconPickerContent />
- </IconPicker>
- </div>
-
- <Field name="description">
- <FieldLabel>
- {t(($) => $[`${prefixSettings}.webDesc`], { ns: 'appOverview' })}
- </FieldLabel>
- <Textarea
- readOnly={pending}
- value={inputInfo.desc}
- onValueChange={(value) => setInputInfo((item) => ({ ...item, desc: value }))}
- placeholder={t(($) => $[`${prefixSettings}.webDescPlaceholder`], {
- ns: 'appOverview',
- })}
- />
- <FieldDescription>
- {t(($) => $[`${prefixSettings}.webDescTip`], { ns: 'appOverview' })}
- </FieldDescription>
- </Field>
- <Separator />
+ <SelectLabel>
+ {t(($) => $[`${prefixSettings}.language`], { ns: 'appOverview' })}
+ </SelectLabel>
+ <SelectTrigger className="w-50">
+ {selectedLanguage?.name ?? t(($) => $['placeholder.select'], { ns: 'common' })}
+ </SelectTrigger>
+ <SelectContent>
+ {LANGUAGE_OPTIONS.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ <SelectItemText>{item.name}</SelectItemText>
+ <SelectItemIndicator />
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+ {isChat && (
+ <div className="grid gap-1">
+ <Field
+ name="chat_color_theme"
+ className="items-start gap-x-3 sm:grid-cols-[minmax(0,1fr)_12.5rem]"
+ >
+ <div>
+ <FieldLabel>
+ {t(($) => $[`${prefixSettings}.chatColorTheme`], { ns: 'appOverview' })}
+ </FieldLabel>
+ <FieldDescription>
+ {t(($) => $[`${prefixSettings}.chatColorThemeDesc`], { ns: 'appOverview' })}
+ </FieldDescription>
+ </div>
+ <Input
+ readOnly={pending}
+ pattern="#[A-Fa-f0-9]{6}"
+ value={inputInfo.chatColorTheme}
+ onValueChange={(value) =>
+ setInputInfo((item) => ({ ...item, chatColorTheme: value }))
+ }
+ placeholder="E.g #A020F0"
+ />
+ <FieldError match="patternMismatch" className="sm:col-start-2">
+ {t(($) => $[`${prefixSettings}.invalidHexMessage`], { ns: 'appOverview' })}
+ </FieldError>
+ </Field>
+ <Field
+ name="chat_color_theme_inverted"
+ className="ml-auto flex w-50 items-center justify-between gap-2"
+ >
+ <FieldLabel>
+ {t(($) => $[`${prefixSettings}.chatColorThemeInverted`], {
+ ns: 'appOverview',
+ })}
+ </FieldLabel>
+ <Switch
+ readOnly={pending}
+ checked={inputInfo.chatColorThemeInverted}
+ onCheckedChange={(value) =>
+ setInputInfo((item) => ({ ...item, chatColorThemeInverted: value }))
+ }
+ />
+ </Field>
+ </div>
+ )}
- {isChat && (
- <Field name="use_icon_as_answer_icon">
+ <Field name="show_workflow_steps">
<div className="flex items-center justify-between gap-3">
- <FieldLabel>{t(($) => $['answerIcon.title'], { ns: 'app' })}</FieldLabel>
+ <FieldLabel>
+ {t(($) => $[`${prefixSettings}.workflow.subTitle`], { ns: 'appOverview' })}
+ </FieldLabel>
<Switch
readOnly={pending}
- checked={inputInfo.use_icon_as_answer_icon}
+ disabled={!(appInfo.mode === 'workflow' || appInfo.mode === 'advanced-chat')}
+ checked={inputInfo.show_workflow_steps}
onCheckedChange={(v) =>
- setInputInfo((item) => ({ ...item, use_icon_as_answer_icon: v }))
+ setInputInfo((item) => ({ ...item, show_workflow_steps: v }))
}
/>
</div>
<FieldDescription>
- {t(($) => $['answerIcon.description'], { ns: 'app' })}
+ {t(($) => $[`${prefixSettings}.workflow.showDesc`], { ns: 'appOverview' })}
</FieldDescription>
</Field>
- )}
- <Field name="default_language" className="flex items-center justify-between gap-3">
- <Select<Language>
- readOnly={pending}
- value={selectedLanguage?.value ?? null}
- onValueChange={(value) => {
- if (value !== null) setLanguage(value)
- }}
- >
- <SelectLabel>
- {t(($) => $[`${prefixSettings}.language`], { ns: 'appOverview' })}
- </SelectLabel>
- <SelectTrigger className="w-50">
- {selectedLanguage?.name ?? t(($) => $['placeholder.select'], { ns: 'common' })}
- </SelectTrigger>
- <SelectContent>
- {LANGUAGE_OPTIONS.map((item) => (
- <SelectItem key={item.value} value={item.value}>
- <SelectItemText>{item.name}</SelectItemText>
- <SelectItemIndicator />
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </Field>
- {isChat && (
- <div className="grid gap-1">
- <Field
- name="chat_color_theme"
- className="items-start gap-x-3 sm:grid-cols-[minmax(0,1fr)_12.5rem]"
- >
- <div>
+ <Separator />
+ {INPUT_PLACEHOLDER_SUPPORTED_MODES.includes(appInfo.mode) && (
+ <Field name="input_placeholder" disabled={!canCustomizePlaceholder}>
+ <div className="flex items-center gap-1">
<FieldLabel>
- {t(($) => $[`${prefixSettings}.chatColorTheme`], { ns: 'appOverview' })}
+ {t(($) => $[`${prefixSettings}.more.inputPlaceholder`], {
+ ns: 'appOverview',
+ })}
</FieldLabel>
- <FieldDescription>
- {t(($) => $[`${prefixSettings}.chatColorThemeDesc`], { ns: 'appOverview' })}
- </FieldDescription>
+ {showUpgrade && <SettingsUpgradeButton />}
</div>
- <Input
- readOnly={pending}
- pattern="#[A-Fa-f0-9]{6}"
- value={inputInfo.chatColorTheme}
- onValueChange={(value) =>
- setInputInfo((item) => ({ ...item, chatColorTheme: value }))
- }
- placeholder="E.g #A020F0"
- />
- <FieldError match="patternMismatch" className="sm:col-start-2">
- {t(($) => $[`${prefixSettings}.invalidHexMessage`], { ns: 'appOverview' })}
- </FieldError>
+ <FieldDescription>
+ {t(($) => $[`${prefixSettings}.more.inputPlaceholderTip`], {
+ ns: 'appOverview',
+ })}
+ </FieldDescription>
+ {showUpgrade ? (
+ <Tooltip>
+ <TooltipTrigger render={inputPlaceholderField} />
+ <TooltipContent className="w-45">
+ {t(($) => $[`${prefixSettings}.more.inputPlaceholderTooltip`], {
+ ns: 'appOverview',
+ })}
+ </TooltipContent>
+ </Tooltip>
+ ) : (
+ inputPlaceholderField
+ )}
+ {canCustomizePlaceholder && (
+ <FieldDescription className="text-right">
+ {`${inputInfo.inputPlaceholder.length} / ${INPUT_PLACEHOLDER_MAX_LENGTH}`}
+ </FieldDescription>
+ )}
</Field>
- <Field
- name="chat_color_theme_inverted"
- className="ml-auto flex w-50 items-center justify-between gap-2"
- >
- <FieldLabel>
- {t(($) => $[`${prefixSettings}.chatColorThemeInverted`], { ns: 'appOverview' })}
- </FieldLabel>
- <Switch
- readOnly={pending}
- checked={inputInfo.chatColorThemeInverted}
- onCheckedChange={(value) =>
- setInputInfo((item) => ({ ...item, chatColorThemeInverted: value }))
- }
- />
+ )}
+ <Fieldset className="grid gap-1">
+ <Field name="copyright_enabled" disabled={webappCopyrightEnabled !== true}>
+ <div className="flex items-center gap-1">
+ <FieldsetLegend id={copyrightLegendId} className="mb-0">
+ {t(($) => $[`${prefixSettings}.more.copyright`], { ns: 'appOverview' })}
+ </FieldsetLegend>
+ {showUpgrade && <SettingsUpgradeButton />}
+ <Tooltip>
+ <TooltipTrigger render={<div className="ml-auto" />}>
+ <Switch
+ readOnly={pending}
+ aria-labelledby={copyrightLegendId}
+ checked={inputInfo.copyrightSwitchValue}
+ onCheckedChange={(value) =>
+ setInputInfo((item) => ({ ...item, copyrightSwitchValue: value }))
+ }
+ />
+ </TooltipTrigger>
+ {webappCopyrightEnabled === false && (
+ <TooltipContent className="w-45">
+ {t(($) => $[`${prefixSettings}.more.copyrightTooltip`], {
+ ns: 'appOverview',
+ })}
+ </TooltipContent>
+ )}
+ </Tooltip>
+ </div>
+ <FieldDescription id={copyrightDescriptionId}>
+ {t(($) => $[`${prefixSettings}.more.copyrightTip`], { ns: 'appOverview' })}
+ </FieldDescription>
</Field>
- </div>
- )}
-
- <Field name="show_workflow_steps">
- <div className="flex items-center justify-between gap-3">
+ {inputInfo.copyrightSwitchValue && (
+ <Field name="copyright" disabled={webappCopyrightEnabled !== true}>
+ <Input
+ readOnly={pending}
+ aria-labelledby={copyrightLegendId}
+ aria-describedby={copyrightDescriptionId}
+ value={inputInfo.copyright}
+ onValueChange={(value) =>
+ setInputInfo((item) => ({ ...item, copyright: value }))
+ }
+ placeholder={t(($) => $[`${prefixSettings}.more.copyRightPlaceholder`], {
+ ns: 'appOverview',
+ })}
+ />
+ </Field>
+ )}
+ </Fieldset>
+ <Field
+ name="privacy_policy"
+ validate={(value) => {
+ if (typeof value === 'string' && value && !/^https?:\/\//.test(value))
+ return t(($) => $[`${prefixSettings}.invalidPrivacyPolicy`], {
+ ns: 'appOverview',
+ })
+ }}
+ >
<FieldLabel>
- {t(($) => $[`${prefixSettings}.workflow.subTitle`], { ns: 'appOverview' })}
+ {t(($) => $[`${prefixSettings}.more.privacyPolicy`], { ns: 'appOverview' })}
</FieldLabel>
- <Switch
+ <FieldDescription>
+ <Trans
+ i18nKey={($) => $[`${prefixSettings}.more.privacyPolicyTip`]}
+ ns="appOverview"
+ components={{
+ privacyPolicyLink: (
+ <Link
+ href="https://dify.ai/privacy"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-text-accent"
+ />
+ ),
+ }}
+ />
+ </FieldDescription>
+ <Input
readOnly={pending}
- disabled={!(appInfo.mode === 'workflow' || appInfo.mode === 'advanced-chat')}
- checked={inputInfo.show_workflow_steps}
- onCheckedChange={(v) =>
- setInputInfo((item) => ({ ...item, show_workflow_steps: v }))
+ value={inputInfo.privacyPolicy}
+ onValueChange={(value) =>
+ setInputInfo((item) => ({ ...item, privacyPolicy: value }))
}
+ placeholder={t(($) => $[`${prefixSettings}.more.privacyPolicyPlaceholder`], {
+ ns: 'appOverview',
+ })}
/>
- </div>
- <FieldDescription>
- {t(($) => $[`${prefixSettings}.workflow.showDesc`], { ns: 'appOverview' })}
- </FieldDescription>
- </Field>
- <Separator />
- {INPUT_PLACEHOLDER_SUPPORTED_MODES.includes(appInfo.mode) && (
- <Field name="input_placeholder" disabled={!canCustomizePlaceholder}>
- <div className="flex items-center gap-1">
- <FieldLabel>
- {t(($) => $[`${prefixSettings}.more.inputPlaceholder`], { ns: 'appOverview' })}
- </FieldLabel>
- {showUpgrade && <SettingsUpgradeButton />}
- </div>
- <FieldDescription>
- {t(($) => $[`${prefixSettings}.more.inputPlaceholderTip`], { ns: 'appOverview' })}
- </FieldDescription>
- {showUpgrade ? (
- <Tooltip>
- <TooltipTrigger render={inputPlaceholderField} />
- <TooltipContent className="w-45">
- {t(($) => $[`${prefixSettings}.more.inputPlaceholderTooltip`], {
- ns: 'appOverview',
- })}
- </TooltipContent>
- </Tooltip>
- ) : (
- inputPlaceholderField
- )}
- {canCustomizePlaceholder && (
- <FieldDescription className="text-right">
- {`${inputInfo.inputPlaceholder.length} / ${INPUT_PLACEHOLDER_MAX_LENGTH}`}
- </FieldDescription>
- )}
+ <FieldError />
</Field>
- )}
- <Fieldset className="grid gap-1">
- <Field name="copyright_enabled" disabled={webappCopyrightEnabled !== true}>
- <div className="flex items-center gap-1">
- <FieldsetLegend id={copyrightLegendId} className="mb-0">
- {t(($) => $[`${prefixSettings}.more.copyright`], { ns: 'appOverview' })}
- </FieldsetLegend>
- {showUpgrade && <SettingsUpgradeButton />}
- <Tooltip>
- <TooltipTrigger render={<div className="ml-auto" />}>
- <Switch
- readOnly={pending}
- aria-labelledby={copyrightLegendId}
- checked={inputInfo.copyrightSwitchValue}
- onCheckedChange={(value) =>
- setInputInfo((item) => ({ ...item, copyrightSwitchValue: value }))
- }
- />
- </TooltipTrigger>
- {webappCopyrightEnabled === false && (
- <TooltipContent className="w-45">
- {t(($) => $[`${prefixSettings}.more.copyrightTooltip`], {
- ns: 'appOverview',
- })}
- </TooltipContent>
- )}
- </Tooltip>
- </div>
- <FieldDescription id={copyrightDescriptionId}>
- {t(($) => $[`${prefixSettings}.more.copyrightTip`], { ns: 'appOverview' })}
+ <Field name="custom_disclaimer">
+ <FieldLabel>
+ {t(($) => $[`${prefixSettings}.more.customDisclaimer`], { ns: 'appOverview' })}
+ </FieldLabel>
+ <FieldDescription>
+ {t(($) => $[`${prefixSettings}.more.customDisclaimerTip`], { ns: 'appOverview' })}
</FieldDescription>
- </Field>
- {inputInfo.copyrightSwitchValue && (
- <Field name="copyright" disabled={webappCopyrightEnabled !== true}>
- <Input
- readOnly={pending}
- aria-labelledby={copyrightLegendId}
- aria-describedby={copyrightDescriptionId}
- value={inputInfo.copyright}
- onValueChange={(value) =>
- setInputInfo((item) => ({ ...item, copyright: value }))
- }
- placeholder={t(($) => $[`${prefixSettings}.more.copyRightPlaceholder`], {
- ns: 'appOverview',
- })}
- />
- </Field>
- )}
- </Fieldset>
- <Field
- name="privacy_policy"
- validate={(value) => {
- if (typeof value === 'string' && value && !/^https?:\/\//.test(value))
- return t(($) => $[`${prefixSettings}.invalidPrivacyPolicy`], {
+ <Textarea
+ readOnly={pending}
+ value={inputInfo.customDisclaimer}
+ onValueChange={(value) =>
+ setInputInfo((item) => ({ ...item, customDisclaimer: value }))
+ }
+ placeholder={t(($) => $[`${prefixSettings}.more.customDisclaimerPlaceholder`], {
ns: 'appOverview',
- })
- }}
- >
- <FieldLabel>
- {t(($) => $[`${prefixSettings}.more.privacyPolicy`], { ns: 'appOverview' })}
- </FieldLabel>
- <FieldDescription>
- <Trans
- i18nKey={($) => $[`${prefixSettings}.more.privacyPolicyTip`]}
- ns="appOverview"
- components={{
- privacyPolicyLink: (
- <Link
- href="https://dify.ai/privacy"
- target="_blank"
- rel="noopener noreferrer"
- className="text-text-accent"
- />
- ),
- }}
+ })}
/>
- </FieldDescription>
- <Input
- readOnly={pending}
- value={inputInfo.privacyPolicy}
- onValueChange={(value) =>
- setInputInfo((item) => ({ ...item, privacyPolicy: value }))
- }
- placeholder={t(($) => $[`${prefixSettings}.more.privacyPolicyPlaceholder`], {
- ns: 'appOverview',
- })}
- />
- <FieldError />
- </Field>
- <Field name="custom_disclaimer">
- <FieldLabel>
- {t(($) => $[`${prefixSettings}.more.customDisclaimer`], { ns: 'appOverview' })}
- </FieldLabel>
- <FieldDescription>
- {t(($) => $[`${prefixSettings}.more.customDisclaimerTip`], { ns: 'appOverview' })}
- </FieldDescription>
- <Textarea
- readOnly={pending}
- value={inputInfo.customDisclaimer}
- onValueChange={(value) =>
- setInputInfo((item) => ({ ...item, customDisclaimer: value }))
- }
- placeholder={t(($) => $[`${prefixSettings}.more.customDisclaimerPlaceholder`], {
- ns: 'appOverview',
- })}
- />
- </Field>
+ </Field>
+ </DialogBody>
</ScrollAreaContent>
</ScrollAreaViewport>
<ScrollAreaScrollbar>
@@ -638,14 +645,14 @@ function SettingsForm({
</ScrollAreaScrollbar>
</ScrollArea>
- <div className="row-start-3 flex justify-end gap-2 p-6 pt-5">
+ <DialogFooter>
<DialogClose disabled={pending} render={<Button />}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</DialogClose>
<Button type="submit" variant="primary" loading={pending} disabled={disabled}>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</Form>
)
}
@@ -695,23 +702,17 @@ export function SettingsDialog({
}}
>
<DialogTrigger render={trigger} />
- <DialogContent className="grid max-h-[calc(100dvh-2rem)] w-130 grid-rows-[auto_minmax(0,1fr)] overflow-hidden p-0">
- <div className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-0.5 px-6 pt-6 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $[`${prefixSettings}.title`], { ns: 'appOverview' })}
- </DialogTitle>
- <DialogClose
- disabled={pending}
- render={
- <IconButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} size="lg">
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogDescription className="col-span-2 system-xs-regular text-text-tertiary">
+ <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-130 flex-col overflow-hidden">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $[`${prefixSettings}.title`], { ns: 'appOverview' })}</DialogTitle>
+ <DialogDescription>
{t(($) => $[`${prefixSettings}.modalTip`], { ns: 'appOverview' })}
</DialogDescription>
- </div>
+ <DialogCloseButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ disabled={pending}
+ />
+ </DialogHeader>
<SettingsForm
key={appInfo.id}
appInfo={appInfo}
diff --git a/web/app/components/app/overview/workflow-launch-dialog/index.tsx b/web/app/components/app/overview/workflow-launch-dialog/index.tsx
index bef156b62ee..e0042646d02 100644
--- a/web/app/components/app/overview/workflow-launch-dialog/index.tsx
+++ b/web/app/components/app/overview/workflow-launch-dialog/index.tsx
@@ -3,7 +3,15 @@
import type { FormEvent } from 'react'
import type { WorkflowHiddenStartVariable, WorkflowLaunchInputValue } from '../app-card-utils'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import {
@@ -54,19 +62,19 @@ function WorkflowLaunchForm({
return (
<form onSubmit={handleSubmit}>
- <div className="space-y-4 px-6 pb-4">
+ <DialogBody className="space-y-4">
<WorkflowHiddenInputFields
hiddenVariables={hiddenVariables}
values={values}
onValueChange={handleValueChange}
/>
- </div>
- <div className="flex items-center justify-end gap-2 border-t-[0.5px] border-divider-subtle px-6 py-4">
+ </DialogBody>
+ <DialogFooter>
<Button onClick={onClose}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>
<Button type="submit" variant="primary" disabled={launchDisabled}>
{t(($) => $['overview.appInfo.launch'], { ns: 'appOverview' })}
</Button>
- </div>
+ </DialogFooter>
</form>
)
}
@@ -93,21 +101,21 @@ export function WorkflowLaunchDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="w-140! max-w-[calc(100vw-2rem)]! p-0!">
- <div className="flex flex-col gap-2 px-6 pt-6 pb-4">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogContent className="w-140">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['overview.appInfo.workflowLaunchHiddenInputs.title'], {
ns: 'appOverview',
})}
</DialogTitle>
- <DialogDescription className="system-md-regular text-text-tertiary">
+ <DialogDescription>
<Trans
i18nKey={($) => $['overview.appInfo.workflowLaunchHiddenInputs.description']}
ns="appOverview"
components={{ bold: <span className="system-md-medium" /> }}
/>
</DialogDescription>
- </div>
+ </DialogHeader>
<WorkflowLaunchForm
key={open ? `open:${targetUrl}` : 'closed'}
hiddenVariables={supportedVariables}
diff --git a/web/app/components/app/switch-app-modal/index.tsx b/web/app/components/app/switch-app-modal/index.tsx
index c44a4fc8dc5..e03af7de6c3 100644
--- a/web/app/components/app/switch-app-modal/index.tsx
+++ b/web/app/components/app/switch-app-modal/index.tsx
@@ -14,8 +14,16 @@ import {
} from '@langgenius/dify-ui/alert-dialog'
import { Button } from '@langgenius/dify-ui/button'
import { Checkbox } from '@langgenius/dify-ui/checkbox'
-import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Input } from '@langgenius/dify-ui/input'
import { useMutation, useQuery, useSuspenseQuery } from '@tanstack/react-query'
import { useId, useState } from 'react'
@@ -125,38 +133,32 @@ const SwitchAppModal = ({ show, sourceApp, onClose }: SwitchAppModalProps) => {
return (
<>
- <Dialog open={show}>
- <DialogContent
- className={cn(
- 'w-full overflow-hidden! border-none text-left align-middle',
- cn('w-150 max-w-150 p-8'),
- )}
- >
- <button
- type="button"
- className="absolute top-4 right-4 cursor-pointer border-none bg-transparent p-2 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- onClick={onClose}
- >
- <span aria-hidden className="i-ri-close-line size-4 text-text-tertiary" />
- </button>
- <div className="h-12 w-12 rounded-xl border-[0.5px] border-divider-regular bg-background-default-burn p-3 shadow-xl">
- <span
- aria-hidden
- className="i-custom-vender-solid-alertsAndFeedback-alert-triangle size-6 text-[rgb(247,144,9)]"
- />
- </div>
- <div className="relative mt-3 text-xl leading-7.5 font-semibold text-text-primary">
- {t(($) => $.switch, { ns: 'app' })}
- </div>
- <div className="my-1 text-sm/5 text-text-tertiary">
- <span>{t(($) => $.switchTipStart, { ns: 'app' })}</span>
- <span className="font-medium text-text-secondary">
- {t(($) => $.switchTip, { ns: 'app' })}
- </span>
- <span>{t(($) => $.switchTipEnd, { ns: 'app' })}</span>
- </div>
- <div className="pb-4">
+ <Dialog
+ open={show}
+ disablePointerDismissal
+ onOpenChange={(open) => {
+ if (!open && !showConfirmDelete) onClose()
+ }}
+ >
+ <DialogContent className="w-150 max-w-150">
+ <DialogHeader>
+ <div className="mb-2 h-12 w-12 rounded-xl border-[0.5px] border-divider-regular bg-background-default-burn p-3 shadow-xl">
+ <span
+ aria-hidden
+ className="i-custom-vender-solid-alertsAndFeedback-alert-triangle size-6 text-[rgb(247,144,9)]"
+ />
+ </div>
+ <DialogTitle>{t(($) => $.switch, { ns: 'app' })}</DialogTitle>
+ <DialogDescription>
+ <span>{t(($) => $.switchTipStart, { ns: 'app' })}</span>
+ <span className="font-medium text-text-secondary">
+ {t(($) => $.switchTip, { ns: 'app' })}
+ </span>
+ <span>{t(($) => $.switchTipEnd, { ns: 'app' })}</span>
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
<label
htmlFor={nameInputId}
className="block py-2 text-sm leading-5 font-medium text-text-primary"
@@ -181,10 +183,10 @@ const SwitchAppModal = ({ show, sourceApp, onClose }: SwitchAppModalProps) => {
className="h-10 grow"
/>
</div>
- </div>
- {isAppsFull && <AppsFull loc="app-switch" />}
- <div className="flex items-center justify-between pt-6">
- <div className="flex items-center">
+ {isAppsFull && <AppsFull className="mt-4" loc="app-switch" />}
+ </DialogBody>
+ <DialogFooter>
+ <div className="me-auto flex items-center">
<label className="flex cursor-pointer items-center">
<Checkbox
className="shrink-0"
@@ -199,21 +201,17 @@ const SwitchAppModal = ({ show, sourceApp, onClose }: SwitchAppModalProps) => {
</span>
</label>
</div>
- <div className="flex items-center">
- <Button className="mr-2" onClick={onClose}>
- {t(($) => $['newApp.Cancel'], { ns: 'app' })}
- </Button>
- <Button
- className="inset-ring-red-700"
- disabled={isAppQuotaUnavailable || isAppsFull || !name}
- variant="primary"
- tone="destructive"
- onClick={goStart}
- >
- {t(($) => $.switchStart, { ns: 'app' })}
- </Button>
- </div>
- </div>
+ <Button onClick={onClose}>{t(($) => $['newApp.Cancel'], { ns: 'app' })}</Button>
+ <Button
+ className="inset-ring-red-700"
+ disabled={isAppQuotaUnavailable || isAppsFull || !name}
+ variant="primary"
+ tone="destructive"
+ onClick={goStart}
+ >
+ {t(($) => $.switchStart, { ns: 'app' })}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
<AlertDialog open={showConfirmDelete} onOpenChange={handleConfirmDeleteOpenChange}>
diff --git a/web/app/components/apps/__tests__/list.spec.tsx b/web/app/components/apps/__tests__/list.spec.tsx
index 61d565add52..5dd5432fbbe 100644
--- a/web/app/components/apps/__tests__/list.spec.tsx
+++ b/web/app/components/apps/__tests__/list.spec.tsx
@@ -269,7 +269,7 @@ vi.mock('@tanstack/react-query', async (importOriginal) => {
})
vi.mock('@/hooks/use-pay', () => ({
- CheckModal: () => null,
+ CheckResultToast: () => null,
}))
vi.mock('next/dynamic', () => ({
diff --git a/web/app/components/apps/import-from-marketplace-template-modal.tsx b/web/app/components/apps/import-from-marketplace-template-modal.tsx
index 512d9ca3608..af725979894 100644
--- a/web/app/components/apps/import-from-marketplace-template-modal.tsx
+++ b/web/app/components/apps/import-from-marketplace-template-modal.tsx
@@ -1,9 +1,15 @@
'use client'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
-import { RiCloseLine } from '@remixicon/react'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useCallback, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import AppIcon from '@/app/components/base/app-icon'
@@ -73,25 +79,13 @@ const ImportFromMarketplaceTemplateModal = ({
if (!open) onClose()
}}
>
- <DialogContent className="w-130 rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0 shadow-xl">
- <div className="flex items-center justify-between pt-6 pr-5 pb-3 pl-6">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['marketplace.template.modalTitle'], { ns: 'app' })}
- </DialogTitle>
- <DialogClose
- render={
- <IconButton
- size="lg"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="mr-1.5"
- >
- <RiCloseLine aria-hidden className="size-5" />
- </IconButton>
- }
- />
- </div>
+ <DialogContent className="w-130">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['marketplace.template.modalTitle'], { ns: 'app' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
- <div className="px-6 py-4" aria-busy={isLoading}>
+ <DialogBody aria-busy={isLoading}>
{isLoading && (
<div className="flex items-center justify-center py-8">
<div className="system-md-regular text-text-tertiary">
@@ -163,12 +157,10 @@ const ImportFromMarketplaceTemplateModal = ({
)}
</div>
)}
- </div>
+ </DialogBody>
- <div className="flex justify-end px-6 py-5">
- <Button className="mr-2" onClick={onClose}>
- {t(($) => $['newApp.Cancel'], { ns: 'app' })}
- </Button>
+ <DialogFooter>
+ <Button onClick={onClose}>{t(($) => $['newApp.Cancel'], { ns: 'app' })}</Button>
<Button
variant="primary"
disabled={isLoading || isError}
@@ -177,7 +169,7 @@ const ImportFromMarketplaceTemplateModal = ({
>
{t(($) => $['marketplace.template.importConfirm'], { ns: 'app' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/apps/list.tsx b/web/app/components/apps/list.tsx
index 39193ae7ee1..e13fa155177 100644
--- a/web/app/components/apps/list.tsx
+++ b/web/app/components/apps/list.tsx
@@ -16,7 +16,7 @@ import { useAtomValue } from 'jotai'
import { useQueryStates } from 'nuqs'
import { useCallback, useId, useMemo, useRef, useState } from 'react'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
-import { CheckModal } from '@/hooks/use-pay'
+import { CheckResultToast } from '@/hooks/use-pay'
import { hasPermission } from '@/utils/permission'
import { AppListCatalog } from './app-list-catalog'
import { AppListCreationModals } from './app-list-creation-modals'
@@ -182,7 +182,7 @@ export function List({ onCreateLearnDify, onTryLearnDify }: Props) {
</ScrollArea>
</div>
- <CheckModal />
+ <CheckResultToast />
<AppListTagManagementModal
show={showTagManagementModal}
onClose={() => setShowTagManagementModal(false)}
diff --git a/web/app/components/base/agent-log-modal/__tests__/index.spec.tsx b/web/app/components/base/agent-log-modal/__tests__/index.spec.tsx
index ee866e001d7..bdefde4e2d0 100644
--- a/web/app/components/base/agent-log-modal/__tests__/index.spec.tsx
+++ b/web/app/components/base/agent-log-modal/__tests__/index.spec.tsx
@@ -156,7 +156,7 @@ describe('AgentLogModal', () => {
const modal = screen.getByRole('dialog')
expect(container).not.toContainElement(modal)
expect(document.body).toContainElement(modal)
- expect(modal).toHaveClass('fixed', 'w-120!', 'left-[max(8px,calc(100vw-1136px))]!')
+ expect(modal).toHaveClass('fixed', 'w-120', 'left-[max(8px,calc(100vw-1136px))]')
})
it('should call onCancel when close button is clicked', () => {
diff --git a/web/app/components/base/agent-log-modal/index.tsx b/web/app/components/base/agent-log-modal/index.tsx
index 2bf88c55e60..0015242d5a9 100644
--- a/web/app/components/base/agent-log-modal/index.tsx
+++ b/web/app/components/base/agent-log-modal/index.tsx
@@ -1,7 +1,13 @@
import type { FC } from 'react'
import type { IChatItem } from '@/app/components/base/chat/chat/type'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBackdrop,
+ DialogPopup,
+ DialogPortal,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { RiCloseLine } from '@remixicon/react'
import { useClickAway } from 'ahooks'
import { useEffect, useRef, useState } from 'react'
@@ -55,23 +61,26 @@ const AgentLogModal: FC<AgentLogModalProps> = ({
if (!open) onCancel()
}}
>
- <DialogContent
- backdropProps={{ className: 'bg-transparent!' }}
- className="top-16! bottom-4! left-[max(8px,calc(100vw-1136px))]! flex max-h-none! w-120! max-w-[calc(100vw-16px)]! translate-x-0! translate-y-0! flex-col overflow-hidden! rounded-xl! border-[0.5px]! border-components-panel-border! bg-components-panel-bg! p-0! pt-3! pb-3! shadow-xl!"
- >
- <DialogTitle className="text-md shrink-0 px-4 py-1 font-semibold text-text-primary">
- {t(($) => $['runDetail.workflowTitle'], { ns: 'appLog' })}
- </DialogTitle>
- <button
- type="button"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="absolute top-4 right-3 z-20 cursor-pointer border-none bg-transparent p-1 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- onClick={onCancel}
- >
- <RiCloseLine className="size-4 text-text-tertiary" aria-hidden="true" />
- </button>
- {detailContent}
- </DialogContent>
+ <DialogPortal>
+ <DialogBackdrop className="bg-transparent!" />
+ <DialogPopup className="fixed top-16 bottom-4 left-[max(8px,calc(100vw-1136px))] flex w-120 max-w-[calc(100vw-16px)] flex-col overflow-hidden overscroll-contain rounded-xl py-3">
+ <DialogTitle
+ // oxlint-disable-next-line shadcn/no-restyle -- Side panel keeps its compact header row.
+ className="shrink-0 px-4 py-1"
+ >
+ {t(($) => $['runDetail.workflowTitle'], { ns: 'appLog' })}
+ </DialogTitle>
+ <button
+ type="button"
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ className="absolute top-4 right-3 z-20 cursor-pointer border-none bg-transparent p-1 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
+ onClick={onCancel}
+ >
+ <RiCloseLine className="size-4 text-text-tertiary" aria-hidden="true" />
+ </button>
+ {detailContent}
+ </DialogPopup>
+ </DialogPortal>
</Dialog>
)
}
diff --git a/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx b/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx
index e9da8305dba..28defa55ab5 100644
--- a/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx
+++ b/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx
@@ -161,7 +161,10 @@ const HeaderInMobile = () => {
aria-hidden="true"
className="i-custom-public-other-message-3-fill size-6 shrink-0"
/>
- <DialogTitle className="grow system-xl-semibold text-text-secondary">
+ <DialogTitle
+ // oxlint-disable-next-line shadcn/no-restyle -- Title shares the mobile sheet header row with its icon.
+ className="grow"
+ >
{t(($) => $['chat.chatSettingsTitle'], { ns: 'share' })}
</DialogTitle>
<DialogClose
diff --git a/web/app/components/base/chat/chat-with-history/sidebar/rename-modal.tsx b/web/app/components/base/chat/chat-with-history/sidebar/rename-modal.tsx
index b7ba386d92f..1bb5abab7f8 100644
--- a/web/app/components/base/chat/chat-with-history/sidebar/rename-modal.tsx
+++ b/web/app/components/base/chat/chat-with-history/sidebar/rename-modal.tsx
@@ -1,7 +1,14 @@
'use client'
import type { FC } from 'react'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
import { Form } from '@langgenius/dify-ui/form'
import { Input } from '@langgenius/dify-ui/input'
@@ -26,34 +33,35 @@ const RenameModal: FC<IRenameModalProps> = ({ isShow, saveLoading, name, onClose
return (
<Dialog open={isShow} onOpenChange={(open) => !open && onClose()}>
<DialogContent>
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['chat.renameConversation'], { ns: 'common' })}
- </DialogTitle>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['chat.renameConversation'], { ns: 'common' })}</DialogTitle>
+ </DialogHeader>
<Form
onFormSubmit={() => {
if (!saveLoading) onSave(tempName)
}}
>
- <Field name="conversationName" className="mt-6">
- <FieldLabel className="text-sm leading-5.25 font-medium text-text-primary">
- {t(($) => $['chat.conversationName'], { ns: 'common' })}
- </FieldLabel>
- <Input
- className="h-10"
- value={tempName}
- onValueChange={setTempName}
- placeholder={conversationNamePlaceholder}
- />
- </Field>
-
- <div className="mt-10 flex justify-end">
- <Button type="button" className="mr-2 shrink-0" onClick={onClose}>
+ <DialogBody>
+ <Field name="conversationName">
+ <FieldLabel className="text-sm leading-5.25 font-medium text-text-primary">
+ {t(($) => $['chat.conversationName'], { ns: 'common' })}
+ </FieldLabel>
+ <Input
+ className="h-10"
+ value={tempName}
+ onValueChange={setTempName}
+ placeholder={conversationNamePlaceholder}
+ />
+ </Field>
+ </DialogBody>
+ <DialogFooter>
+ <Button type="button" className="shrink-0" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
<Button type="submit" variant="primary" className="shrink-0" loading={saveLoading}>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</Form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/base/chat/chat/answer/operation.tsx b/web/app/components/base/chat/chat/answer/operation.tsx
index 40503fcc970..fd0cd68860d 100644
--- a/web/app/components/base/chat/chat/answer/operation.tsx
+++ b/web/app/components/base/chat/chat/answer/operation.tsx
@@ -5,9 +5,13 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
+ DialogBody,
DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
@@ -88,35 +92,26 @@ function FeedbackForm({ isSubmitting, onSubmit }: FeedbackFormProps) {
const feedbackTextareaId = useId()
return (
<form
- className="flex max-h-[80dvh] flex-col"
onSubmit={(event) => {
event.preventDefault()
const content = new FormData(event.currentTarget).get('feedback-content')
onSubmit(typeof content === 'string' ? content : '')
}}
>
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['feedback.title'], { ns: 'common' }) || 'Provide Feedback'}
</DialogTitle>
- <DialogDescription className="mt-1 system-xs-regular text-text-tertiary">
+ <DialogDescription>
{t(($) => $['feedback.subtitle'], { ns: 'common' }) ||
'Please tell us what went wrong with this response'}
</DialogDescription>
- <DialogClose
+ <DialogCloseButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
disabled={isSubmitting}
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
/>
- </div>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
+ </DialogHeader>
+ <DialogBody>
<label
htmlFor={feedbackTextareaId}
className="mb-2 block system-sm-semibold text-text-secondary"
@@ -134,15 +129,15 @@ function FeedbackForm({ isSubmitting, onSubmit }: FeedbackFormProps) {
rows={4}
className="w-full"
/>
- </div>
- <div className="flex shrink-0 justify-end p-6 pt-5">
+ </DialogBody>
+ <DialogFooter>
<DialogClose disabled={isSubmitting} render={<Button />}>
{t(($) => $['operation.cancel'], { ns: 'common' }) || 'Cancel'}
</DialogClose>
- <Button type="submit" className="ml-2" variant="primary" loading={isSubmitting}>
+ <Button type="submit" variant="primary" loading={isSubmitting}>
{t(($) => $['operation.submit'], { ns: 'common' }) || 'Submit'}
</Button>
- </div>
+ </DialogFooter>
</form>
)
}
@@ -466,11 +461,7 @@ function Operation({
)}
</div>
)}
- <DialogContent
- finalFocus={feedbackRef}
- backdropProps={{ forceRender: true }}
- className="p-0"
- >
+ <DialogContent finalFocus={feedbackRef} backdropProps={{ forceRender: true }}>
<FeedbackForm isSubmitting={isSubmittingFeedback} onSubmit={handleFeedbackSubmit} />
</DialogContent>
</Dialog>
diff --git a/web/app/components/base/encrypted-bottom/index.tsx b/web/app/components/base/encrypted-bottom/index.tsx
index ce86d3a61b9..8e21de2876c 100644
--- a/web/app/components/base/encrypted-bottom/index.tsx
+++ b/web/app/components/base/encrypted-bottom/index.tsx
@@ -1,33 +1,19 @@
-import type { I18nKeysWithPrefix } from '@/types/i18n'
-import { cn } from '@langgenius/dify-ui/cn'
-import { RiLock2Fill } from '@remixicon/react'
+import type { ReactNode } from 'react'
import { useTranslation } from 'react-i18next'
import Link from '@/next/link'
-type EncryptedKey = I18nKeysWithPrefix<'common', 'provider.encrypted.'>
-
-type Props = Readonly<{
- className?: string
- frontTextKey?: EncryptedKey
- backTextKey?: EncryptedKey
+type EncryptedBottomProps = Readonly<{
+ front?: string
+ back?: string
}>
-const DEFAULT_FRONT_KEY: EncryptedKey = 'provider.encrypted.front'
-const DEFAULT_BACK_KEY: EncryptedKey = 'provider.encrypted.back'
-
-export const EncryptedBottom = (props: Props) => {
+export const EncryptedBottom = ({ front, back }: EncryptedBottomProps) => {
const { t } = useTranslation(['common'])
- const { frontTextKey = DEFAULT_FRONT_KEY, backTextKey = DEFAULT_BACK_KEY, className } = props
return (
- <div
- className={cn(
- 'flex items-center justify-center rounded-b-2xl border-t-[0.5px] border-divider-subtle bg-background-soft px-2 py-3 system-xs-regular text-text-tertiary',
- className,
- )}
- >
- <RiLock2Fill className="mx-1 size-3 text-text-quaternary" />
- {t(($) => $[frontTextKey], { ns: 'common' })}
+ <p className="flex items-center justify-center rounded-b-2xl border-t-[0.5px] border-divider-subtle bg-background-soft px-2 py-3 system-xs-regular text-text-tertiary">
+ <span aria-hidden className="mx-1 i-ri-lock-2-fill size-3 text-text-quaternary" />
+ {front ?? t(($) => $['provider.encrypted.front'], { ns: 'common' })}
<Link
className="mx-1 text-text-accent"
target="_blank"
@@ -36,7 +22,16 @@ export const EncryptedBottom = (props: Props) => {
>
PKCS1_OAEP
</Link>
- {t(($) => $[backTextKey], { ns: 'common' })}
- </div>
+ {back ?? t(($) => $['provider.encrypted.back'], { ns: 'common' })}
+ </p>
)
}
+
+type EncryptedFooterProps = Readonly<{
+ children: ReactNode
+}>
+
+// Keeps the notice pinned under the actions while the dialog body scrolls.
+export const EncryptedFooter = ({ children }: EncryptedFooterProps) => (
+ <div className="sticky bottom-0 bg-components-panel-bg">{children}</div>
+)
diff --git a/web/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal.tsx b/web/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal.tsx
index 245a4ff93d7..f4c00a1fb3c 100644
--- a/web/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal.tsx
@@ -2,7 +2,14 @@
import type { FC } from 'react'
import type { AnnotationReplyConfig } from '@/models/debug'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import * as React from 'react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -85,12 +92,14 @@ const ConfigParamModal: FC<Props> = ({
if (!open) onHide()
}}
>
- <DialogContent className="mt-14! w-160! max-w-none! border-none p-6! text-left align-middle">
- <div className="mb-2 title-2xl-semi-bold text-text-primary">
- {t(($) => $[`initSetup.${isInit ? 'title' : 'configTitle'}`], { ns: 'appAnnotation' })}
- </div>
+ <DialogContent className="w-160 max-w-none">
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $[`initSetup.${isInit ? 'title' : 'configTitle'}`], { ns: 'appAnnotation' })}
+ </DialogTitle>
+ </DialogHeader>
- <div className="mt-6 space-y-3">
+ <DialogBody className="space-y-3">
<Item
title={t(($) => $['feature.annotation.scoreThreshold.title'], { ns: 'appDebug' })}
tooltip={t(($) => $['feature.annotation.scoreThreshold.description'], {
@@ -131,9 +140,9 @@ const ConfigParamModal: FC<Props> = ({
/>
</div>
</Item>
- </div>
+ </DialogBody>
- <div className="mt-6 flex justify-end gap-2">
+ <DialogFooter>
<Button onClick={onHide}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>
<Button variant="primary" onClick={handleSave} loading={isLoading}>
<div>
@@ -142,7 +151,7 @@ const ConfigParamModal: FC<Props> = ({
})}
</div>
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx b/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx
index a19bfb67cda..6213050c094 100644
--- a/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx
@@ -3,7 +3,15 @@ import type { InputVar } from '@/app/components/workflow/types'
import type { PromptVariable } from '@/models/debug'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Infotip, InfotipContent, InfotipTrigger } from '@langgenius/dify-ui/infotip'
import { Separator } from '@langgenius/dify-ui/separator'
@@ -266,21 +274,14 @@ const OpeningSettingModal = ({
return (
<Dialog open onOpenChange={(open) => !open && onCancel()} disablePointerDismissal>
- <DialogContent className="mt-14 w-160 max-w-none rounded-2xl bg-components-panel-bg-blur p-6">
- <div className="mb-6 flex items-center justify-between">
- <div className="title-2xl-semi-bold text-text-primary">
+ <DialogContent className="w-160 max-w-none">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['feature.conversationOpener.title'], { ns: 'appDebug' })}
- </div>
- <button
- type="button"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="cursor-pointer border-none bg-transparent p-1 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- onClick={onCancel}
- >
- <span className="i-ri-close-line size-4 text-text-tertiary" aria-hidden="true" />
- </button>
- </div>
- <div className="mb-8 space-y-4">
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="space-y-4">
<div data-testid="opener-input-section" className="py-2">
<div className="mb-3 text-sm font-medium text-text-primary">
{t(($) => $['openingStatement.editorTitle'], { ns: 'appDebug' })}
@@ -312,15 +313,13 @@ const OpeningSettingModal = ({
<div data-testid="opener-questions-section" className="py-2">
{renderQuestions()}
</div>
- </div>
- <div className="flex items-center justify-end">
- <Button onClick={onCancel} className="mr-2">
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
+ </DialogBody>
+ <DialogFooter>
+ <Button onClick={onCancel}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>
<Button variant="primary" onClick={() => handleSave()} disabled={isSaveDisabled}>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
{isShowConfirmAddVar && (
<ConfirmAddVar
varNameArr={notIncludeKeys}
diff --git a/web/app/components/base/features/new-feature-panel/follow-up-setting-modal.tsx b/web/app/components/base/features/new-feature-panel/follow-up-setting-modal.tsx
index 90ab62b24d1..cefeab65c51 100644
--- a/web/app/components/base/features/new-feature-panel/follow-up-setting-modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/follow-up-setting-modal.tsx
@@ -7,14 +7,17 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
+ DialogBody,
DialogClose,
+ DialogCloseButton,
DialogContent,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
import { Field, FieldItem } from '@langgenius/dify-ui/field'
import { Fieldset, FieldsetLegend } from '@langgenius/dify-ui/fieldset'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { RadioControl, RadioGroup, RadioItem } from '@langgenius/dify-ui/radio-group'
import { Textarea } from '@langgenius/dify-ui/textarea'
import { produce } from 'immer'
@@ -85,7 +88,7 @@ export function FollowUpSettingsDialog({ data, onSave, disabled }: FollowUpSetti
{t(($) => $['operation.settings'], { ns: 'common' })}
</DialogTrigger>
</div>
- <DialogContent className="w-160! max-w-none! p-8! pb-6!">
+ <DialogContent className="w-160 max-w-none">
<FollowUpSettingsForm
data={data}
onSave={(value) => {
@@ -162,21 +165,13 @@ function FollowUpSettingsForm({ data, onSave }: Omit<FollowUpSettingsDialogProps
if (!isCustomPromptInvalid) handleSave()
}}
>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-8 right-8"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="pr-8 text-xl font-semibold text-text-primary">
- {t(($) => $['feature.suggestedQuestionsAfterAnswer.modal.title'], { ns: 'appDebug' })}
- </DialogTitle>
- <div className="mt-6 space-y-4">
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['feature.suggestedQuestionsAfterAnswer.modal.title'], { ns: 'appDebug' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="space-y-4">
<div>
<div className="mb-1.5 system-sm-semibold-uppercase text-text-secondary">
{t(($) => $['feature.suggestedQuestionsAfterAnswer.modal.modelLabel'], {
@@ -299,15 +294,15 @@ function FollowUpSettingsForm({ data, onSave }: Omit<FollowUpSettingsDialogProps
</FieldItem>
</Fieldset>
</Field>
- </div>
- <div className="mt-6 flex items-center justify-end gap-2">
+ </DialogBody>
+ <DialogFooter>
<DialogClose render={<Button />}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</DialogClose>
<Button type="submit" variant="primary" disabled={isCustomPromptInvalid}>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
)
}
diff --git a/web/app/components/base/features/new-feature-panel/moderation/__tests__/moderation-setting-modal.spec.tsx b/web/app/components/base/features/new-feature-panel/moderation/__tests__/moderation-setting-modal.spec.tsx
index 09147855a76..e6d93de33e6 100644
--- a/web/app/components/base/features/new-feature-panel/moderation/__tests__/moderation-setting-modal.spec.tsx
+++ b/web/app/components/base/features/new-feature-panel/moderation/__tests__/moderation-setting-modal.spec.tsx
@@ -212,7 +212,7 @@ describe('ModerationSettingModal', () => {
const closeButton = screen.getByRole('button', { name: 'common.operation.close' })
closeButton.focus()
- fireEvent.keyDown(closeButton, { key: 'Escape' })
+ fireEvent.keyDown(closeButton, { key: 'a' })
expect(onCancel).not.toHaveBeenCalled()
})
diff --git a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
index 6ba79b9ef64..c0906239013 100644
--- a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
@@ -3,7 +3,15 @@ import type { CodeBasedExtensionItem } from '@/models/common'
import type { ModerationConfig, ModerationContentConfig } from '@/models/debug'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Separator } from '@langgenius/dify-ui/separator'
import { Textarea } from '@langgenius/dify-ui/textarea'
import { useQuery } from '@tanstack/react-query'
@@ -308,8 +316,8 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({ data, onCance
}
return (
- <Dialog open>
- <DialogContent className="mt-14! w-150! max-w-none! overflow-hidden border-[0.5px]! border-components-panel-border! p-0! text-left align-middle">
+ <Dialog open onOpenChange={(open) => !open && onCancel()} disablePointerDismissal>
+ <DialogContent className="w-150 max-w-none">
<form
onSubmit={(event) => {
// Portalled child forms still bubble submit events through the React tree.
@@ -319,20 +327,13 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({ data, onCance
handleSave()
}}
>
- <div className="flex items-start gap-2 px-6 pt-6 pr-14 pb-3">
- <div className="title-2xl-semi-bold text-text-primary">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['feature.moderation.modal.title'], { ns: 'appDebug' })}
- </div>
- <button
- type="button"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="absolute top-5 right-5 flex size-8 cursor-pointer items-center justify-center rounded-lg border-none bg-transparent text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
- onClick={onCancel}
- >
- <span className="i-ri-close-line size-4.5" aria-hidden="true" />
- </button>
- </div>
- <div className="flex flex-col gap-4 px-6 py-3">
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="flex flex-col gap-4">
<div className="flex flex-col gap-1">
<div className="system-sm-medium text-text-secondary">
{t(($) => $['feature.moderation.modal.provider.title'], { ns: 'appDebug' })}
@@ -493,8 +494,8 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({ data, onCance
{t(($) => $['feature.moderation.modal.content.condition'], { ns: 'appDebug' })}
</div>
</div>
- </div>
- <div className="flex h-19 items-center justify-end gap-2 px-6 pt-5 pb-6">
+ </DialogBody>
+ <DialogFooter>
<Button type="button" onClick={onCancel} size="medium" className="min-w-18">
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
@@ -507,7 +508,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({ data, onCance
>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/base/icon-picker/index.tsx b/web/app/components/base/icon-picker/index.tsx
index 3575bd629c3..d74f0c82863 100644
--- a/web/app/components/base/icon-picker/index.tsx
+++ b/web/app/components/base/icon-picker/index.tsx
@@ -111,7 +111,7 @@ export function IconPickerContent({ enableImageUpload }: IconPickerContentProps)
initialFocus={(interaction) =>
interaction === 'touch' ? popupRef.current : (focusTargetRef.current ?? true)
}
- className="flex max-h-[calc(100dvh-2rem)] w-80.5 flex-col overflow-hidden p-0 text-left"
+ className="flex max-h-[calc(100dvh-2rem)] w-80.5 flex-col overflow-hidden"
>
<DialogTitle className="sr-only">
{t(($) => $['iconPicker.title'], { ns: 'app' })}
diff --git a/web/app/components/base/message-log-modal/index.tsx b/web/app/components/base/message-log-modal/index.tsx
index b5e05728def..e81bb66b151 100644
--- a/web/app/components/base/message-log-modal/index.tsx
+++ b/web/app/components/base/message-log-modal/index.tsx
@@ -1,7 +1,13 @@
import type { FC } from 'react'
import type { IChatItem } from '@/app/components/base/chat/chat/type'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBackdrop,
+ DialogPopup,
+ DialogPortal,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useClickAway } from 'ahooks'
import { useRef } from 'react'
import { useTranslation } from 'react-i18next'
@@ -40,7 +46,10 @@ const MessageLogModal: FC<MessageLogModalProps> = ({
const activeTab = isRunActiveTab(defaultTab) ? defaultTab : 'DETAIL'
const modalContent = (
<>
- <DialogTitle className="shrink-0 px-4 py-1 system-xl-semibold text-text-primary">
+ <DialogTitle
+ // oxlint-disable-next-line shadcn/no-restyle -- Side panel keeps its compact header row.
+ className="shrink-0 px-4 py-1"
+ >
{t(($) => $['runDetail.title'], { ns: 'appLog' })}
</DialogTitle>
<button
@@ -68,12 +77,12 @@ const MessageLogModal: FC<MessageLogModalProps> = ({
if (!open) onCancel()
}}
>
- <DialogContent
- backdropProps={{ className: 'bg-transparent!' }}
- className="top-16! bottom-4! left-[max(8px,calc(100vw-1136px))]! flex max-h-none! w-120! max-w-[calc(100vw-16px)]! translate-x-0! translate-y-0! flex-col overflow-hidden! rounded-xl! border-[0.5px]! border-components-panel-border! bg-components-panel-bg! p-0! pt-3! shadow-xl!"
- >
- {modalContent}
- </DialogContent>
+ <DialogPortal>
+ <DialogBackdrop className="bg-transparent" />
+ <DialogPopup className="fixed top-16 bottom-4 left-[max(8px,calc(100vw-1136px))] flex w-120 max-w-[calc(100vw-16px)] flex-col overflow-hidden overscroll-contain rounded-xl pt-3">
+ {modalContent}
+ </DialogPopup>
+ </DialogPortal>
</Dialog>
)
}
diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx
index 960a4f86154..8527873a06a 100644
--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx
+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx
@@ -189,7 +189,7 @@ const HITLInputComponentUI: FC<HITLInputComponentUIProps> = ({
if (!open) hideEditModal()
}}
>
- <DialogContent className="w-full max-w-93 overflow-hidden! border-none p-0! text-left align-middle">
+ <DialogContent className="w-full max-w-93 overflow-hidden">
<InputField
nodeId={nodeId}
isEdit
diff --git a/web/app/components/base/upgrade-modal/index.tsx b/web/app/components/base/upgrade-modal/index.tsx
index eaec257a7b6..5a3c7993285 100644
--- a/web/app/components/base/upgrade-modal/index.tsx
+++ b/web/app/components/base/upgrade-modal/index.tsx
@@ -40,11 +40,7 @@ export function UpgradeModal({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
- className={cn(
- styles.surface,
- 'w-145 max-w-120 overflow-hidden rounded-2xl p-0',
- classNames?.content,
- )}
+ className={cn(styles.surface, 'w-145 max-w-120 overflow-hidden', classNames?.content)}
>
<div className="relative">
<div
@@ -72,12 +68,14 @@ export function UpgradeModal({
)}
<div className={cn('mt-6 space-y-2', classNames?.copy)}>
<DialogTitle
+ // oxlint-disable-next-line shadcn/no-restyle -- Upgrade hero keeps its marketing title type.
className={cn(styles.highlight, 'title-3xl-semi-bold', classNames?.title)}
>
{title}
</DialogTitle>
<DialogDescription
- className={cn('system-md-regular text-text-tertiary', classNames?.description)}
+ // oxlint-disable-next-line shadcn/no-restyle -- Upgrade hero keeps its marketing body type.
+ className={cn('text-sm/5 text-text-tertiary', classNames?.description)}
>
{description}
</DialogDescription>
diff --git a/web/app/components/billing/annotation-full/modal.tsx b/web/app/components/billing/annotation-full/modal.tsx
index 98b6dc407e1..7643e3eb9fb 100644
--- a/web/app/components/billing/annotation-full/modal.tsx
+++ b/web/app/components/billing/annotation-full/modal.tsx
@@ -24,7 +24,7 @@ const AnnotationFullModal: FC<Props> = ({ show, onHide }) => {
if (!open) onHide()
}}
>
- <DialogContent className="w-full overflow-hidden! border-none p-0! text-left align-middle">
+ <DialogContent className="w-full overflow-hidden">
<DialogClose
render={
<IconButton
diff --git a/web/app/components/billing/pricing/header.tsx b/web/app/components/billing/pricing/header.tsx
index cff828cb1b2..4b14f69070a 100644
--- a/web/app/components/billing/pricing/header.tsx
+++ b/web/app/components/billing/pricing/header.tsx
@@ -17,14 +17,18 @@ const Header = () => {
</div>
<DialogTitle
className={cn(
- 'min-w-0 bg-billing-plan-title-bg bg-clip-text px-1.5 text-[37px] leading-[1.2] wrap-anywhere text-transparent',
+ // oxlint-disable-next-line shadcn/no-restyle -- Pricing hero keeps its serif display title.
+ 'min-w-0 bg-billing-plan-title-bg bg-clip-text px-1.5 text-[37px] leading-[1.2] font-normal wrap-anywhere text-transparent',
styles.instrumentSerif,
)}
>
{t(($) => $['plansCommon.title.plans'], { ns: 'billing' })}
</DialogTitle>
</div>
- <DialogDescription className="system-sm-regular text-text-tertiary">
+ <DialogDescription
+ // oxlint-disable-next-line shadcn/no-restyle -- Pricing hero keeps its 13px subtitle.
+ className="text-[13px]/4 text-text-tertiary"
+ >
{t(($) => $['plansCommon.title.description'], { ns: 'billing' })}
</DialogDescription>
</div>
diff --git a/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx b/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx
index e276ba93be5..56ca25bae3e 100644
--- a/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx
+++ b/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx
@@ -4,12 +4,13 @@ import type { CloudPlan } from '@dify/contracts/api/console/features/types.gen'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useAtomValue } from 'jotai'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
@@ -231,26 +232,16 @@ export function CloudPlanItem({ plan, billingInterval, billing }: CloudPlanItemP
<CloudPlanFeatures plan={plan} />
<Dialog open={showEducationPricingConfirm} onOpenChange={setShowEducationPricingConfirm}>
<DialogContent backdropProps={{ forceRender: true }} className="w-130">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-6 right-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="flex flex-col gap-2 pr-10">
- <DialogTitle className="w-full title-2xl-semi-bold text-text-primary">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['educationPricingConfirm.title'], { ns: 'education' })}
</DialogTitle>
- <DialogDescription className="w-full system-md-regular text-text-tertiary">
+ <DialogDescription>
{t(($) => $['educationPricingConfirm.description'], { ns: 'education' })}
</DialogDescription>
- </div>
- <div className="mt-10 flex items-start justify-end gap-3">
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogFooter>
<Button
size="large"
onClick={handleContinueWithoutEducationDiscount}
@@ -269,7 +260,7 @@ export function CloudPlanItem({ plan, billingInterval, billing }: CloudPlanItemP
>
{t(($) => $['educationPricingConfirm.continue'], { ns: 'education' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
</div>
diff --git a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/index.tsx b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/index.tsx
index adcf6bd3148..5d073fe00e1 100644
--- a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/index.tsx
+++ b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/index.tsx
@@ -1,8 +1,15 @@
'use client'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'
import { useTranslation } from 'react-i18next'
@@ -53,20 +60,11 @@ const CreateFromDSLModal = ({
return (
<>
<Dialog open={show} onOpenChange={(open) => !open && !showConfirmModal && onClose()}>
- <DialogContent className="w-full max-w-120! overflow-hidden! rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0! text-left align-middle shadow-xl">
- <div className="relative flex items-center justify-between pt-6 pr-14 pb-3 pl-6">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $.importFromDSL, { ns: 'app' })}
- </DialogTitle>
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="absolute top-5 right-5"
- size="lg"
- onClick={onClose}
- >
- <span aria-hidden="true" className="i-ri-close-line size-4.5" />
- </IconButton>
- </div>
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.importFromDSL, { ns: 'app' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
<form
onSubmit={(event) => {
event.preventDefault()
@@ -90,11 +88,15 @@ const CreateFromDSLModal = ({
<TabsPanel
value={CreateFromDSLModalTab.FROM_FILE}
tabIndex={-1}
- className="px-6 py-4"
+ render={<DialogBody />}
>
<Uploader className="mt-0" file={currentFile} updateFile={handleFile} />
</TabsPanel>
- <TabsPanel value={CreateFromDSLModalTab.FROM_URL} tabIndex={-1} className="px-6 py-4">
+ <TabsPanel
+ value={CreateFromDSLModalTab.FROM_URL}
+ tabIndex={-1}
+ render={<DialogBody />}
+ >
<Field name="dslUrl" className="gap-0">
<FieldLabel className="w-full text-sm leading-5 font-semibold">
DSL URL
@@ -108,14 +110,14 @@ const CreateFromDSLModal = ({
</Field>
</TabsPanel>
</Tabs>
- <div className="flex justify-end gap-2 p-6 pt-5">
+ <DialogFooter>
<Button type="button" onClick={onClose}>
{t(($) => $['newApp.Cancel'], { ns: 'app' })}
</Button>
<Button type="submit" disabled={buttonDisabled} variant="primary">
{t(($) => $['newApp.import'], { ns: 'app' })}
</Button>
- </div>
+ </DialogFooter>
</form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/edit-pipeline-info.spec.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/edit-pipeline-info.spec.tsx
index 019af27353a..433bc61689f 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/edit-pipeline-info.spec.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/edit-pipeline-info.spec.tsx
@@ -9,9 +9,9 @@ import { ChunkingMode } from '@/models/datasets'
import { mockEmojiData, renderWithEmoji as testingLibraryRender } from '@/test/emoji-picker'
import EditPipelineInfo from '../edit-pipeline-info'
-const render = (ui: ReactElement) =>
+const render = (ui: ReactElement<{ onClose: () => void }>) =>
testingLibraryRender(
- <Dialog open>
+ <Dialog open onOpenChange={(open) => !open && ui.props.onClose()}>
<DialogContent>{ui}</DialogContent>
</Dialog>,
)
@@ -603,7 +603,7 @@ describe('EditPipelineInfo', () => {
it('should have close button in header', () => {
render(<EditPipelineInfo {...defaultProps} />)
const closeButton = screen.getByRole('button', { name: 'common.operation.close' })
- expect(closeButton).toHaveClass('right-5', 'top-5')
+ expect(closeButton.parentElement).toContainElement(screen.getByText(/editPipelineInfo/i))
})
})
})
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx
index 41bd48cbee9..01abc2caf74 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx
@@ -60,7 +60,8 @@ const Details = ({ id, type, name, onApplyTemplate }: DetailsProps) => {
<AppIcon size="large" icon={pipelineTemplateInfo.icon_info} />
<div className="flex grow flex-col gap-y-1 overflow-hidden py-px">
<DialogTitle
- className="truncate system-md-semibold text-text-secondary"
+ // oxlint-disable-next-line shadcn/no-restyle -- Full-page template header keeps its compact template name.
+ className="truncate text-sm/5 text-text-secondary"
title={pipelineTemplateInfo.name}
>
{pipelineTemplateInfo.name}
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx
index fe07d7f09a0..d9c0baceddd 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx
@@ -1,9 +1,14 @@
import type { IconPickerValue } from '@/app/components/base/icon-picker'
import type { PipelineTemplate } from '@/models/pipeline'
import { Button } from '@langgenius/dify-ui/button'
-import { DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ DialogBody,
+ DialogCloseButton,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { Textarea } from '@langgenius/dify-ui/textarea'
import { useMutation, useQueryClient } from '@tanstack/react-query'
@@ -89,28 +94,16 @@ const EditPipelineInfo = ({ onClose, pipeline }: EditPipelineInfoProps) => {
return (
<form
- className="relative flex flex-col"
onSubmit={(event) => {
event.preventDefault()
void handleSave()
}}
>
- {/* Header */}
- <div className="pt-6 pr-14 pb-3 pl-6">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $.editPipelineInfo, { ns: 'datasetPipeline' })}
- </DialogTitle>
- </div>
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- onClick={onClose}
- >
- <span aria-hidden="true" className="i-ri-close-line size-5" />
- </IconButton>
- {/* Form */}
- <div className="flex flex-col gap-y-5 px-6 py-3">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.editPipelineInfo, { ns: 'datasetPipeline' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="flex flex-col gap-y-5">
<div className="flex items-end gap-x-3 self-stretch">
<Field className="grow pb-1" name="name">
<FieldLabel>{t(($) => $.pipelineNameAndIcon, { ns: 'datasetPipeline' })}</FieldLabel>
@@ -146,16 +139,15 @@ const EditPipelineInfo = ({ onClose, pipeline }: EditPipelineInfoProps) => {
placeholder={t(($) => $.knowledgeDescriptionPlaceholder, { ns: 'datasetPipeline' })}
/>
</Field>
- </div>
- {/* Actions */}
- <div className="flex items-center justify-end gap-x-2 p-6 pt-5">
+ </DialogBody>
+ <DialogFooter>
<Button type="button" variant="secondary" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
<Button type="submit" variant="primary">
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
)
}
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx
index a1465ee5ee3..d8eb0939824 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx
@@ -168,7 +168,10 @@ const TemplateCard = ({ pipeline, showMoreOperations = true, type }: TemplateCar
handleExportDSL={handleExportDSL}
handleDelete={handleDelete}
/>
- <DialogContent className="h-[calc(100dvh-64px)] max-h-[calc(100dvh-64px)] w-[calc(100vw-2rem)] max-w-[1680px]! overflow-hidden! rounded-3xl border-none p-0 text-left align-middle">
+ <DialogContent
+ // oxlint-disable-next-line shadcn/no-restyle -- Full-page template preview keeps its larger radius.
+ className="h-[calc(100dvh-64px)] max-h-[calc(100dvh-64px)] w-[1680px] overflow-hidden rounded-3xl"
+ >
<Details
id={pipeline.id}
type={type}
@@ -184,7 +187,7 @@ const TemplateCard = ({ pipeline, showMoreOperations = true, type }: TemplateCar
if (!open) closeEditModal()
}}
>
- <DialogContent className="w-[calc(100vw-2rem)] max-w-130! overflow-hidden! border-none p-0 text-left align-middle">
+ <DialogContent className="w-130">
<EditPipelineInfo pipeline={pipeline} onClose={closeEditModal} />
</DialogContent>
</Dialog>
diff --git a/web/app/components/datasets/create/assets/close.svg b/web/app/components/datasets/create/assets/close.svg
deleted file mode 100644
index 7a8ef6bd72c..00000000000
--- a/web/app/components/datasets/create/assets/close.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M12 4L4 12M4 4L12 12" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-</svg>
diff --git a/web/app/components/datasets/create/empty-dataset-creation-modal/index.module.css b/web/app/components/datasets/create/empty-dataset-creation-modal/index.module.css
index c00c3df476a..3b85fef744c 100644
--- a/web/app/components/datasets/create/empty-dataset-creation-modal/index.module.css
+++ b/web/app/components/datasets/create/empty-dataset-creation-modal/index.module.css
@@ -1,31 +1,6 @@
@reference "../../../../styles/globals.css";
-.modalHeader {
- @apply flex h-8 place-content-between items-center;
-}
-.modalHeader .title {
- @apply grow text-text-primary;
- font-weight: 600;
- font-size: 20px;
- line-height: 32px;
-}
-.modalHeader .close {
- @apply h-4 w-4 shrink-0 cursor-pointer bg-center bg-no-repeat;
- background-image: url(../assets/close.svg);
- background-size: 16px;
-}
-
-.tip {
- @apply mt-1 mb-8 text-text-tertiary;
- font-weight: 400;
- font-size: 13px;
- line-height: 18px;
-}
-
-.form {
- @apply mb-8;
-}
-.form .label {
+.label {
@apply text-text-primary;
font-weight: 500;
font-size: 14px;
diff --git a/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx b/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx
index 501853ce987..f2e9099bbdd 100644
--- a/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx
+++ b/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx
@@ -1,7 +1,15 @@
'use client'
import { Button } from '@langgenius/dify-ui/button'
-import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
import { Form } from '@langgenius/dify-ui/form'
import { Input } from '@langgenius/dify-ui/input'
@@ -63,43 +71,37 @@ const EmptyDatasetCreationModal = ({ show = false, onHide }: IProps) => {
if (!open) onHide()
}}
>
- <DialogContent className="w-full max-w-130! overflow-hidden! border-none px-8 text-left align-middle">
- <div className={s.modalHeader}>
- <DialogTitle className={s.title}>
- {t(($) => $['stepOne.modal.title'], { ns: 'datasetCreation' })}
- </DialogTitle>
- <button
- type="button"
- className={cn(
- s.close,
- 'border-none bg-transparent p-0 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden',
- )}
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- onClick={onHide}
- />
- </div>
- <div className={s.tip}>{t(($) => $['stepOne.modal.tip'], { ns: 'datasetCreation' })}</div>
+ <DialogContent className="w-130">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['stepOne.modal.title'], { ns: 'datasetCreation' })}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $['stepOne.modal.tip'], { ns: 'datasetCreation' })}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
<Form onFormSubmit={() => void submit()}>
- <Field name="datasetName" className={s.form}>
- <FieldLabel className={s.label}>
- {t(($) => $['stepOne.modal.input'], { ns: 'datasetCreation' })}
- </FieldLabel>
- <Input
- value={inputValue}
- placeholder={
- t(($) => $['stepOne.modal.placeholder'], { ns: 'datasetCreation' }) || ''
- }
- onValueChange={setInputValue}
- />
- </Field>
- <div className="flex flex-row-reverse">
- <Button type="submit" className="ml-2 w-24" variant="primary" loading={isSubmitting}>
- {t(($) => $['stepOne.modal.confirmButton'], { ns: 'datasetCreation' })}
- </Button>
+ <DialogBody>
+ <Field name="datasetName">
+ <FieldLabel className={s.label}>
+ {t(($) => $['stepOne.modal.input'], { ns: 'datasetCreation' })}
+ </FieldLabel>
+ <Input
+ value={inputValue}
+ placeholder={
+ t(($) => $['stepOne.modal.placeholder'], { ns: 'datasetCreation' }) || ''
+ }
+ onValueChange={setInputValue}
+ />
+ </Field>
+ </DialogBody>
+ <DialogFooter>
<Button type="button" className="w-24" onClick={onHide}>
{t(($) => $['stepOne.modal.cancelButton'], { ns: 'datasetCreation' })}
</Button>
- </div>
+ <Button type="submit" className="w-24" variant="primary" loading={isSubmitting}>
+ {t(($) => $['stepOne.modal.confirmButton'], { ns: 'datasetCreation' })}
+ </Button>
+ </DialogFooter>
</Form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/datasets/documents/components/rename-modal.tsx b/web/app/components/datasets/documents/components/rename-modal.tsx
index 4de779522d9..455c8a23afc 100644
--- a/web/app/components/datasets/documents/components/rename-modal.tsx
+++ b/web/app/components/datasets/documents/components/rename-modal.tsx
@@ -1,7 +1,14 @@
'use client'
import type { FC } from 'react'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
import { Form } from '@langgenius/dify-ui/form'
import { Input } from '@langgenius/dify-ui/input'
@@ -53,31 +60,32 @@ const RenameModal: FC<Props> = ({ documentId, datasetId, name, onClose, onSaved
if (!open) onClose()
}}
>
- <DialogContent className="overflow-hidden! border-none text-left align-middle">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['list.table.rename'], { ns: 'datasetDocuments' })}
- </DialogTitle>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['list.table.rename'], { ns: 'datasetDocuments' })}</DialogTitle>
+ </DialogHeader>
<Form onFormSubmit={() => void handleSave()}>
- <Field name="documentName" className="mt-6">
- <FieldLabel className="text-sm leading-5.25 font-medium text-text-primary">
- {t(($) => $['list.table.name'], { ns: 'datasetDocuments' })}
- </FieldLabel>
- <Input
- className="h-10"
- value={newName}
- placeholder={t(($) => $['placeholder.input'], { ns: 'common' }) || ''}
- onValueChange={setNewName}
- />
- </Field>
-
- <div className="mt-10 flex justify-end">
- <Button type="button" className="mr-2 shrink-0" onClick={onClose}>
+ <DialogBody>
+ <Field name="documentName">
+ <FieldLabel className="text-sm leading-5.25 font-medium text-text-primary">
+ {t(($) => $['list.table.name'], { ns: 'datasetDocuments' })}
+ </FieldLabel>
+ <Input
+ className="h-10"
+ value={newName}
+ placeholder={t(($) => $['placeholder.input'], { ns: 'common' }) || ''}
+ onValueChange={setNewName}
+ />
+ </Field>
+ </DialogBody>
+ <DialogFooter>
+ <Button type="button" className="shrink-0" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
<Button type="submit" variant="primary" className="shrink-0" loading={saveLoading}>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</Form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/datasets/documents/detail/batch-modal/index.tsx b/web/app/components/datasets/documents/detail/batch-modal/index.tsx
index db385ab63f5..98c21e0c1fc 100644
--- a/web/app/components/datasets/documents/detail/batch-modal/index.tsx
+++ b/web/app/components/datasets/documents/detail/batch-modal/index.tsx
@@ -2,8 +2,15 @@
import type { FC } from 'react'
import type { ChunkingMode, FileItem } from '@/models/datasets'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import * as React from 'react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -31,25 +38,21 @@ const BatchModalContent: FC<BatchModalContentProps> = ({ docForm, onCancel, onCo
}
return (
- <DialogContent className="w-130! overflow-hidden! rounded-xl! border-0! px-8 py-6">
- <DialogTitle className="relative pb-1 text-xl leading-7.5 font-medium text-text-primary">
- {t(($) => $['list.batchModal.title'], { ns: 'datasetDocuments' })}
- </DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['list.batchModal.cancel'], { ns: 'datasetDocuments' })}
- size="lg"
- className="absolute top-4 right-4"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <CSVUploader file={currentCSV} updateFile={handleFile} />
- <CSVDownloader docForm={docForm} />
- <div className="mt-7 flex justify-end pt-6">
- <Button className="mr-2" onClick={onCancel}>
+ <DialogContent className="w-130">
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['list.batchModal.title'], { ns: 'datasetDocuments' })}
+ </DialogTitle>
+ <DialogCloseButton
+ aria-label={t(($) => $['list.batchModal.cancel'], { ns: 'datasetDocuments' })}
+ />
+ </DialogHeader>
+ <DialogBody>
+ <CSVUploader file={currentCSV} updateFile={handleFile} />
+ <CSVDownloader docForm={docForm} />
+ </DialogBody>
+ <DialogFooter>
+ <Button onClick={onCancel}>
{t(($) => $['list.batchModal.cancel'], { ns: 'datasetDocuments' })}
</Button>
<Button
@@ -59,7 +62,7 @@ const BatchModalContent: FC<BatchModalContentProps> = ({ docForm, onCancel, onCo
>
{t(($) => $['list.batchModal.run'], { ns: 'datasetDocuments' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
)
}
diff --git a/web/app/components/datasets/external-api/external-api-modal/index.tsx b/web/app/components/datasets/external-api/external-api-modal/index.tsx
index 14b5b27dd4b..f79fbb4cde0 100644
--- a/web/app/components/datasets/external-api/external-api-modal/index.tsx
+++ b/web/app/components/datasets/external-api/external-api-modal/index.tsx
@@ -12,12 +12,20 @@ import {
AlertDialogTitle,
} from '@langgenius/dify-ui/alert-dialog'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover'
-import { RiBook2Line, RiCloseLine, RiInformation2Line, RiLock2Fill } from '@remixicon/react'
+import { RiBook2Line, RiInformation2Line } from '@remixicon/react'
import { memo, useId, useState } from 'react'
import { useTranslation } from 'react-i18next'
+import { EncryptedBottom, EncryptedFooter } from '@/app/components/base/encrypted-bottom'
import { toast } from '@/app/notifications'
import { createExternalAPI } from '@/service/datasets'
import Form from './Form'
@@ -137,68 +145,60 @@ const AddExternalAPIModal: FC<AddExternalAPIModalProps> = ({
if (!open) onCancel()
}}
>
- <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-120! max-w-none! flex-col overflow-hidden! rounded-2xl! border-[0.5px]! border-components-panel-border! bg-components-panel-bg! p-0! shadow-xl!">
- <div className="relative flex min-h-0 w-full flex-1 flex-col items-start">
- <div className="flex shrink-0 flex-col items-start gap-2 self-stretch pt-6 pr-14 pb-3 pl-6">
- <DialogTitle className="grow self-stretch title-2xl-semi-bold text-text-primary">
- {isEditMode
- ? t(($) => $.editExternalAPIFormTitle, { ns: 'dataset' })
- : t(($) => $.createExternalAPI, { ns: 'dataset' })}
- </DialogTitle>
- {isEditMode && (datasetBindings?.length ?? 0) > 0 && (
- <div className="flex items-center system-xs-regular text-text-tertiary">
- {t(($) => $['editExternalAPIFormWarning.front'], { ns: 'dataset' })}
- <span className="flex cursor-pointer items-center text-text-accent">
- &nbsp;
- {datasetBindings?.length}{' '}
- {t(($) => $['editExternalAPIFormWarning.end'], { ns: 'dataset' })}
- &nbsp;
- <Popover>
- <PopoverTrigger
- openOnHover
- aria-label={t(($) => $['editExternalAPIFormWarning.end'], { ns: 'dataset' })}
- render={
- <button
- type="button"
- className="flex size-3.5 items-center justify-center rounded-sm hover:bg-state-base-hover"
+ <DialogContent className="max-h-[calc(100dvh-2rem)] max-w-none">
+ <DialogHeader>
+ <DialogTitle>
+ {isEditMode
+ ? t(($) => $.editExternalAPIFormTitle, { ns: 'dataset' })
+ : t(($) => $.createExternalAPI, { ns: 'dataset' })}
+ </DialogTitle>
+ {isEditMode && (datasetBindings?.length ?? 0) > 0 && (
+ <div className="flex items-center system-xs-regular text-text-tertiary">
+ {t(($) => $['editExternalAPIFormWarning.front'], { ns: 'dataset' })}
+ <span className="flex cursor-pointer items-center text-text-accent">
+ &nbsp;
+ {datasetBindings?.length}{' '}
+ {t(($) => $['editExternalAPIFormWarning.end'], { ns: 'dataset' })}
+ &nbsp;
+ <Popover>
+ <PopoverTrigger
+ openOnHover
+ aria-label={t(($) => $['editExternalAPIFormWarning.end'], { ns: 'dataset' })}
+ render={
+ <button
+ type="button"
+ className="flex size-3.5 items-center justify-center rounded-sm hover:bg-state-base-hover"
+ >
+ <RiInformation2Line className="size-3.5" />
+ </button>
+ }
+ />
+ <PopoverContent
+ placement="bottom"
+ className="flex w-[320px] items-center self-stretch px-3 py-2"
+ >
+ <div className="p-1">
+ <div className="flex items-start self-stretch pt-1 pr-3 pb-0.5 pl-2">
+ <div className="system-xs-medium-uppercase text-text-tertiary">{`${datasetBindings?.length} ${t(($) => $.editExternalAPITooltipTitle, { ns: 'dataset' })}`}</div>
+ </div>
+ {datasetBindings?.map((binding) => (
+ <div
+ key={binding.id}
+ className="flex items-center gap-1 self-stretch px-2 py-1"
>
- <RiInformation2Line className="size-3.5" />
- </button>
- }
- />
- <PopoverContent
- placement="bottom"
- className="flex w-[320px] items-center self-stretch px-3 py-2"
- >
- <div className="p-1">
- <div className="flex items-start self-stretch pt-1 pr-3 pb-0.5 pl-2">
- <div className="system-xs-medium-uppercase text-text-tertiary">{`${datasetBindings?.length} ${t(($) => $.editExternalAPITooltipTitle, { ns: 'dataset' })}`}</div>
+ <RiBook2Line className="size-4 text-text-secondary" />
+ <div className="system-sm-medium text-text-secondary">{binding.name}</div>
</div>
- {datasetBindings?.map((binding) => (
- <div
- key={binding.id}
- className="flex items-center gap-1 self-stretch px-2 py-1"
- >
- <RiBook2Line className="size-4 text-text-secondary" />
- <div className="system-sm-medium text-text-secondary">
- {binding.name}
- </div>
- </div>
- ))}
- </div>
- </PopoverContent>
- </Popover>
- </span>
- </div>
- )}
- </div>
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="absolute top-5 right-5"
- onClick={onCancel}
- >
- <RiCloseLine aria-hidden className="h-4.5 w-4.5 shrink-0 text-text-tertiary" />
- </IconButton>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+ </span>
+ </div>
+ )}
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
<Form
id={formId}
value={formData}
@@ -208,9 +208,10 @@ const AddExternalAPIModal: FC<AddExternalAPIModalProps> = ({
handleSubmit()
}}
formSchemas={formSchemas}
- className="min-h-0 w-full flex-1 overflow-y-auto px-6 py-3"
/>
- <div className="flex shrink-0 items-center justify-end gap-2 self-stretch p-6 pt-5">
+ </DialogBody>
+ <EncryptedFooter>
+ <DialogFooter>
<Button type="button" variant="secondary" onClick={onCancel}>
{t(($) => $['externalAPIForm.cancel'], { ns: 'dataset' })}
</Button>
@@ -223,21 +224,12 @@ const AddExternalAPIModal: FC<AddExternalAPIModalProps> = ({
>
{t(($) => $['externalAPIForm.save'], { ns: 'dataset' })}
</Button>
- </div>
- <div className="flex shrink-0 items-center justify-center gap-1 self-stretch rounded-b-2xl border-t-[0.5px] border-divider-subtle bg-background-soft px-2 py-3 system-xs-regular text-text-tertiary">
- <RiLock2Fill className="size-3 text-text-quaternary" />
- {t(($) => $['externalAPIForm.encrypted.front'], { ns: 'dataset' })}
- <a
- className="text-text-accent"
- target="_blank"
- rel="noopener noreferrer"
- href="https://pycryptodome.readthedocs.io/en/latest/src/cipher/oaep.html"
- >
- PKCS1_OAEP
- </a>
- {t(($) => $['externalAPIForm.encrypted.end'], { ns: 'dataset' })}
- </div>
- </div>
+ </DialogFooter>
+ <EncryptedBottom
+ front={t(($) => $['externalAPIForm.encrypted.front'], { ns: 'dataset' })}
+ back={t(($) => $['externalAPIForm.encrypted.end'], { ns: 'dataset' })}
+ />
+ </EncryptedFooter>
<AlertDialog
open={showConfirm && (datasetBindings?.length ?? 0) > 0}
onOpenChange={(open) => !open && setShowConfirm(false)}
diff --git a/web/app/components/datasets/hit-testing/components/__tests__/result-dialogs.browser.spec.tsx b/web/app/components/datasets/hit-testing/components/__tests__/result-dialogs.browser.spec.tsx
index 83720fb40b0..d644c4e0d6c 100644
--- a/web/app/components/datasets/hit-testing/components/__tests__/result-dialogs.browser.spec.tsx
+++ b/web/app/components/datasets/hit-testing/components/__tests__/result-dialogs.browser.spec.tsx
@@ -1,12 +1,8 @@
-import type {
- ExternalHitTestingRecordResponse,
- HitTestingRecord,
-} from '@dify/contracts/api/console/datasets/types.gen'
+import type { HitTestingRecord } from '@dify/contracts/api/console/datasets/types.gen'
import { page, userEvent } from 'vite-plus/test/browser'
import { render } from 'vitest-browser-react'
import { createHitTestingRecordFixture } from '@/test/fixtures/hit-testing'
import { ResultItem } from '../result-item'
-import { ResultItemExternal } from '../result-item-external'
function createResult(overrides: Partial<HitTestingRecord> = {}): HitTestingRecord {
return createHitTestingRecordFixture({
@@ -33,17 +29,6 @@ function createImageUrl() {
return canvas.toDataURL('image/png')
}
-function observeExit(popup: Element) {
- return new Promise<{ opacity: number; content: string | null }>((resolve) => {
- const onTransition = (event: Event) => {
- if (event.target !== popup || (event as TransitionEvent).propertyName !== 'opacity') return
- popup.removeEventListener('transitionrun', onTransition)
- resolve({ opacity: Number(getComputedStyle(popup).opacity), content: popup.textContent })
- }
- popup.addEventListener('transitionrun', onTransition)
- })
-}
-
beforeEach(async () => {
await page.viewport(1280, 900)
})
@@ -85,47 +70,3 @@ it('opens attachments independently and nests their preview only while details a
await expect.element(preview).not.toBeInTheDocument()
await expect.element(detail).toBeVisible()
})
-
-it('keeps external details scrollable and Close reachable on a narrow viewport through keyboard and exit', async () => {
- await page.viewport(414, 900)
- vi.stubGlobal('BASE_UI_ANIMATIONS_DISABLED', false)
- const payload: ExternalHitTestingRecordResponse = {
- title: 'External handbook',
- content: `${'External retrieval content. '.repeat(200)}${'unbroken'.repeat(60)}`,
- score: 0.85,
- metadata: {
- 'x-amz-bedrock-kb-source-uri': 's3://handbook',
- 'x-amz-bedrock-kb-data-source-id': 'source-1',
- },
- }
- const screen = await render(<ResultItemExternal payload={payload} positionId={1} />)
- const card = screen.getByRole('button', { name: 'datasetHitTesting.open External handbook' })
- await userEvent.tab()
- await expect.element(card).toHaveFocus()
- await userEvent.keyboard('{Enter}')
- const dialog = screen.getByRole('dialog', { name: 'datasetHitTesting.chunkDetail' })
- const close = dialog.getByRole('button', { name: 'common.operation.close' })
- await expect.element(close).toHaveFocus()
- const popup = dialog.element()
- await expect.poll(() => getComputedStyle(popup).opacity).toBe('1')
- const popupBounds = popup.getBoundingClientRect()
- const closeBounds = close.element().getBoundingClientRect()
- expect(popupBounds.left).toBeGreaterThanOrEqual(0)
- expect(popupBounds.right).toBeLessThanOrEqual(window.innerWidth)
- expect(closeBounds.left).toBeGreaterThanOrEqual(0)
- expect(closeBounds.right).toBeLessThanOrEqual(window.innerWidth)
- expect(closeBounds.top).toBeGreaterThanOrEqual(0)
- expect(closeBounds.bottom).toBeLessThanOrEqual(window.innerHeight)
- const body = dialog.getByText(payload.content!)
- const bodyElement = body.element()
- expect(bodyElement.scrollWidth).toBeLessThanOrEqual(bodyElement.clientWidth + 1)
- expect(bodyElement.scrollHeight).toBeGreaterThan(bodyElement.clientHeight)
- await body.wheel({ delta: { y: 600 } })
- await expect.poll(() => bodyElement.scrollTop).toBeGreaterThan(0)
- const exit = observeExit(popup)
- await close.click()
- const closing = await exit
- expect(closing.opacity).toBeGreaterThan(0)
- expect(closing.content).toContain(payload.content)
- await expect.element(dialog).not.toBeInTheDocument()
-})
diff --git a/web/app/components/datasets/hit-testing/components/chunk-detail-dialog.tsx b/web/app/components/datasets/hit-testing/components/chunk-detail-dialog.tsx
index a78911a888a..516875e54b4 100644
--- a/web/app/components/datasets/hit-testing/components/chunk-detail-dialog.tsx
+++ b/web/app/components/datasets/hit-testing/components/chunk-detail-dialog.tsx
@@ -5,12 +5,13 @@ import type { FileAppearanceTypeEnum } from '@/app/components/base/file-uploader
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useMemo, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import FileIcon from '@/app/components/base/file-uploader/file-type-icon'
@@ -73,26 +74,18 @@ export function ChunkDetailDialog({ payload, open, onOpenChange }: ChunkDetailDi
<DialogContent
finalFocus={triggerRef}
className={cn(
- 'max-h-[calc(100dvh-2rem)] min-w-0 overflow-y-auto! border-none p-6 text-left align-middle',
+ 'max-h-[calc(100dvh-2rem)] min-w-0',
isParentChildRetrieval ? 'w-300' : 'w-200',
)}
>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="pr-10 title-2xl-semi-bold text-text-primary">
- {t(($) => $[`${i18nPrefix}chunkDetail`], { ns: 'datasetHitTesting' })}
- </DialogTitle>
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $[`${i18nPrefix}chunkDetail`], { ns: 'datasetHitTesting' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
- <div className="mt-4 flex flex-col gap-6 lg:flex-row">
+ <DialogBody className="flex flex-col gap-6 lg:flex-row">
<div className="min-w-0 flex-1">
{/* Meta info */}
<div className="flex flex-wrap items-center justify-between gap-2">
@@ -179,7 +172,7 @@ export function ChunkDetailDialog({ payload, open, onOpenChange }: ChunkDetailDi
</div>
</div>
)}
- </div>
+ </DialogBody>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/datasets/hit-testing/components/result-item-external.tsx b/web/app/components/datasets/hit-testing/components/result-item-external.tsx
index f96423a5d96..94577c4e714 100644
--- a/web/app/components/datasets/hit-testing/components/result-item-external.tsx
+++ b/web/app/components/datasets/hit-testing/components/result-item-external.tsx
@@ -2,12 +2,13 @@
import type { ExternalHitTestingRecordResponse } from '@dify/contracts/api/console/datasets/types.gen'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { memo, useId } from 'react'
import { useTranslation } from 'react-i18next'
import { FileAppearanceTypeEnum } from '@/app/components/base/file-uploader/types'
@@ -49,32 +50,20 @@ export const ResultItemExternal = memo(({ payload, positionId }: ResultItemExter
</span>
<ResultItemFooter docType={FileAppearanceTypeEnum.custom} docTitle={title} />
</DialogTrigger>
- <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-full min-w-0 flex-col overflow-hidden! border-none text-left align-middle">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="shrink-0 title-2xl-semi-bold text-text-primary">
- {t(($) => $.chunkDetail, { ns: 'datasetHitTesting' })}
- </DialogTitle>
- <div className="mt-4 flex min-h-0 flex-1 flex-col">
+ <DialogContent className="max-h-[calc(100dvh-2rem)] w-full min-w-0">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.chunkDetail, { ns: 'datasetHitTesting' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
<ResultItemMeta
labelPrefix="Chunk"
positionId={positionId}
wordCount={content.length}
score={score}
/>
- <div className="mt-2 min-h-0 flex-1 overflow-y-auto body-md-regular break-all text-text-secondary">
- {content}
- </div>
- </div>
+ <div className="mt-2 body-md-regular break-all text-text-secondary">{content}</div>
+ </DialogBody>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx b/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx
index 6ddb341938c..689b99ab604 100644
--- a/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx
+++ b/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx
@@ -3,8 +3,15 @@ import type { FC } from 'react'
import type { BuiltInMetadataItem, MetadataItemInBatchEdit, MetadataItemWithEdit } from '../types'
import { Button } from '@langgenius/dify-ui/button'
import { Checkbox } from '@langgenius/dify-ui/checkbox'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Infotip, InfotipContent, InfotipTrigger } from '@langgenius/dify-ui/infotip'
import { Separator } from '@langgenius/dify-ui/separator'
import { useMutation } from '@tanstack/react-query'
@@ -134,27 +141,16 @@ const EditMetadataBatchModal: FC<Props> = ({
if (!open) onHide()
}}
>
- <DialogContent className="w-full max-w-160! overflow-hidden! border-none text-left align-middle">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $[`${i18nPrefix}.editMetadata`], { ns: 'dataset' })}
- </DialogTitle>
-
- <div className="mt-1 system-xs-medium text-text-accent">
- {t(($) => $[`${i18nPrefix}.editDocumentsNum`], { ns: 'dataset', num: documentNum })}
- </div>
- <div className="max-h-76.25 overflow-x-hidden overflow-y-auto">
- <div className="mt-4 space-y-2">
+ <DialogContent className="w-160">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $[`${i18nPrefix}.editMetadata`], { ns: 'dataset' })}</DialogTitle>
+ <div className="system-xs-medium text-text-accent">
+ {t(($) => $[`${i18nPrefix}.editDocumentsNum`], { ns: 'dataset', num: documentNum })}
+ </div>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="space-y-2">
{templeList.map((item) => (
<EditMetadataBatchItem
key={item.id}
@@ -196,10 +192,10 @@ const EditMetadataBatchModal: FC<Props> = ({
/>
</div>
</div>
- </div>
+ </DialogBody>
- <div className="mt-4 flex items-center justify-between">
- <div className="flex items-center select-none">
+ <DialogFooter>
+ <div className="me-auto flex items-center select-none">
<label className="flex cursor-pointer items-center">
<Checkbox
checked={isApplyToAllSelectDocument}
@@ -222,13 +218,11 @@ const EditMetadataBatchModal: FC<Props> = ({
</InfotipContent>
</Infotip>
</div>
- <div className="flex items-center space-x-2">
- <Button onClick={onHide}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>
- <Button onClick={handleSave} variant="primary">
- {t(($) => $['operation.save'], { ns: 'common' })}
- </Button>
- </div>
- </div>
+ <Button onClick={onHide}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>
+ <Button onClick={handleSave} variant="primary">
+ {t(($) => $['operation.save'], { ns: 'common' })}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
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 8c4492394d8..f688763f5dd 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
@@ -15,7 +15,14 @@ import {
} from '@langgenius/dify-ui/alert-dialog'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import {
Drawer,
DrawerBackdrop,
@@ -307,27 +314,27 @@ const DatasetMetadataDrawer: FC<Props> = ({
if (!open) setIsShowRenameModal(false)
}}
>
- <DialogContent className="overflow-hidden! border-none text-left align-middle">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $[`${i18nPrefix}.rename`], { ns: 'dataset' })}
- </DialogTitle>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $[`${i18nPrefix}.rename`], { ns: 'dataset' })}
+ </DialogTitle>
+ </DialogHeader>
- <Field
- label={t(($) => $[`${i18nPrefix}.name`], { ns: 'dataset' })}
- className="mt-4"
- >
- <Input
- aria-label={t(($) => $[`${i18nPrefix}.name`], { ns: 'dataset' })}
- value={templeName}
- onValueChange={setTempleName}
- placeholder={t(($) => $[`${i18nPrefix}.namePlaceholder`], {
- ns: 'dataset',
- })}
- />
- </Field>
- <div className="mt-4 flex justify-end">
+ <DialogBody>
+ <Field label={t(($) => $[`${i18nPrefix}.name`], { ns: 'dataset' })}>
+ <Input
+ aria-label={t(($) => $[`${i18nPrefix}.name`], { ns: 'dataset' })}
+ value={templeName}
+ onValueChange={setTempleName}
+ placeholder={t(($) => $[`${i18nPrefix}.namePlaceholder`], {
+ ns: 'dataset',
+ })}
+ />
+ </Field>
+ </DialogBody>
+ <DialogFooter>
<Button
- className="mr-2"
onClick={() => {
setIsShowRenameModal(false)
setTempleName(currPayload!.name)
@@ -338,7 +345,7 @@ const DatasetMetadataDrawer: FC<Props> = ({
<Button onClick={handleRenamed} variant="primary" disabled={!templeName}>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)}
diff --git a/web/app/components/datasets/rename-modal/index.tsx b/web/app/components/datasets/rename-modal/index.tsx
index 75e28f3969b..0bde6b408b5 100644
--- a/web/app/components/datasets/rename-modal/index.tsx
+++ b/web/app/components/datasets/rename-modal/index.tsx
@@ -5,9 +5,16 @@ import type {
} from '@dify/contracts/api/console/datasets/types.gen'
import type { IconPickerValue } from '@/app/components/base/icon-picker'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { Textarea } from '@langgenius/dify-ui/textarea'
import { useCallback, useState } from 'react'
@@ -100,72 +107,68 @@ const RenameDatasetModal = ({ show, dataset, onSuccess, onClose }: RenameDataset
if (!open) onClose()
}}
>
- <DialogContent className="w-full max-w-130 overflow-hidden! rounded-xl border-none px-8 py-6 text-left align-middle">
+ <DialogContent className="w-130">
<form
onSubmit={(event) => {
event.preventDefault()
onConfirm()
}}
>
- <div className="flex items-center justify-between pb-2">
- <DialogTitle className="text-xl leading-7.5 font-medium text-text-primary">
- {t(($) => $.title, { ns: 'datasetSettings' })}
- </DialogTitle>
- <IconButton
- size="lg"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- onClick={onClose}
- >
- <span aria-hidden="true" className="i-ri-close-line size-4" />
- </IconButton>
- </div>
- <IconPicker value={appIcon} onValueChange={handleSelectAppIcon}>
- <Field name="name" className="gap-0 py-4">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.title, { ns: 'datasetSettings' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <IconPicker value={appIcon} onValueChange={handleSelectAppIcon}>
+ <Field name="name" className="gap-0 py-4">
+ <FieldLabel className="w-full shrink-0 py-2 text-sm leading-5 font-medium text-text-primary">
+ {t(($) => $['form.name'], { ns: 'datasetSettings' })}
+ </FieldLabel>
+ <div className="flex items-center gap-x-2">
+ <IconPickerTrigger
+ aria-label={`${t(($) => $['operation.edit'], { ns: 'common' })} ${t(($) => $['form.nameAndIcon'], { ns: 'datasetSettings' })}`}
+ className="group/edit-icon relative shrink-0 cursor-pointer rounded-[10px] border-0 bg-transparent p-0"
+ >
+ <IconPickerIcon size="medium" />
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 hidden items-center justify-center rounded-[inherit] bg-background-overlay-alt group-hover/edit-icon:flex group-focus-visible/edit-icon:flex"
+ >
+ <span className="i-ri-edit-line size-5.5 text-text-primary-on-surface" />
+ </span>
+ </IconPickerTrigger>
+ <Input
+ value={name}
+ onChange={(e) => setName(e.target.value)}
+ className="h-9 grow"
+ placeholder={
+ t(($) => $['form.namePlaceholder'], { ns: 'datasetSettings' }) || ''
+ }
+ />
+ </div>
+ </Field>
+ <IconPickerContent />
+ </IconPicker>
+ <Field name="description" className="gap-0 py-4">
<FieldLabel className="w-full shrink-0 py-2 text-sm leading-5 font-medium text-text-primary">
- {t(($) => $['form.name'], { ns: 'datasetSettings' })}
+ {t(($) => $['form.desc'], { ns: 'datasetSettings' })}
</FieldLabel>
- <div className="flex items-center gap-x-2">
- <IconPickerTrigger
- aria-label={`${t(($) => $['operation.edit'], { ns: 'common' })} ${t(($) => $['form.nameAndIcon'], { ns: 'datasetSettings' })}`}
- className="group/edit-icon relative shrink-0 cursor-pointer rounded-[10px] border-0 bg-transparent p-0"
- >
- <IconPickerIcon size="medium" />
- <span
- aria-hidden="true"
- className="pointer-events-none absolute inset-0 hidden items-center justify-center rounded-[inherit] bg-background-overlay-alt group-hover/edit-icon:flex group-focus-visible/edit-icon:flex"
- >
- <span className="i-ri-edit-line size-5.5 text-text-primary-on-surface" />
- </span>
- </IconPickerTrigger>
- <Input
- value={name}
- onChange={(e) => setName(e.target.value)}
- className="h-9 grow"
- placeholder={t(($) => $['form.namePlaceholder'], { ns: 'datasetSettings' }) || ''}
- />
- </div>
+ <Textarea
+ value={description}
+ onValueChange={(value) => setDescription(value)}
+ className="resize-none"
+ placeholder={t(($) => $['form.descPlaceholder'], { ns: 'datasetSettings' }) || ''}
+ />
</Field>
- <IconPickerContent />
- </IconPicker>
- <Field name="description" className="gap-0 py-4">
- <FieldLabel className="w-full shrink-0 py-2 text-sm leading-5 font-medium text-text-primary">
- {t(($) => $['form.desc'], { ns: 'datasetSettings' })}
- </FieldLabel>
- <Textarea
- value={description}
- onValueChange={(value) => setDescription(value)}
- className="resize-none"
- placeholder={t(($) => $['form.descPlaceholder'], { ns: 'datasetSettings' }) || ''}
- />
- </Field>
- <div className="flex justify-end gap-2 pt-6">
+ </DialogBody>
+ <DialogFooter>
<Button type="button" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
<Button type="submit" loading={loading} variant="primary">
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/explore/create-app-modal/index.tsx b/web/app/components/explore/create-app-modal/index.tsx
index e1547e62bae..2660bbb98ea 100644
--- a/web/app/components/explore/create-app-modal/index.tsx
+++ b/web/app/components/explore/create-app-modal/index.tsx
@@ -7,8 +7,15 @@ import type {
import type { Hotkey } from '@tanstack/react-hotkeys'
import type { IconPickerInputValue, IconPickerValue } from '@/app/components/base/icon-picker'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Input } from '@langgenius/dify-ui/input'
import { Kbd, KbdGroup } from '@langgenius/dify-ui/kbd'
import { Switch } from '@langgenius/dify-ui/switch'
@@ -200,30 +207,17 @@ const CreateAppModal = ({
handleSubmit()
}}
backdropProps={{ forceRender: true }}
- className="px-8"
>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- {isEditModal && (
- <DialogTitle className="text-xl leading-7.5 font-semibold text-text-primary">
- {t(($) => $.editAppTitle, { ns: 'app' })}
- </DialogTitle>
- )}
- {!isEditModal && (
- <DialogTitle className="text-xl leading-7.5 font-semibold text-text-primary">
- {t(($) => $['appCustomize.title'], { ns: 'explore', name: appName })}
- </DialogTitle>
- )}
- <div className="mb-9">
+ <DialogHeader>
+ {isEditModal && <DialogTitle>{t(($) => $.editAppTitle, { ns: 'app' })}</DialogTitle>}
+ {!isEditModal && (
+ <DialogTitle>
+ {t(($) => $['appCustomize.title'], { ns: 'explore', name: appName })}
+ </DialogTitle>
+ )}
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
{/* icon & name */}
<div className="pt-2">
<label
@@ -310,12 +304,15 @@ const CreateAppModal = ({
</div>
)}
{!isEditModal && isAppsFull && <AppsFull className="mt-4" loc="app-explore-create" />}
- </div>
- <div className="flex flex-row-reverse">
+ </DialogBody>
+ <DialogFooter>
+ <Button className="w-24" onClick={onHide}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
<Button
loading={confirmLoading}
disabled={submitDisabled}
- className="ml-2 w-24"
+ className="w-24"
variant="primary"
onClick={handleSubmit}
>
@@ -332,10 +329,7 @@ const CreateAppModal = ({
))}
</KbdGroup>
</Button>
- <Button className="w-24" onClick={onHide}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
</>
diff --git a/web/app/components/explore/try-app/index.tsx b/web/app/components/explore/try-app/index.tsx
index 0b939d01810..9a234968b0f 100644
--- a/web/app/components/explore/try-app/index.tsx
+++ b/web/app/components/explore/try-app/index.tsx
@@ -103,7 +103,8 @@ function TryApp({
>
<DialogContent
initialFocus={detailTabRef}
- className="h-[calc(100dvh-16px)] max-h-[calc(100dvh-16px)] w-full max-w-[calc(100vw-16px)] overflow-hidden border-none p-2 text-left align-middle"
+ // oxlint-disable-next-line shadcn/no-restyle -- Full-page Try App surface keeps its 8px inset.
+ className="h-[calc(100dvh-16px)] max-h-[calc(100dvh-16px)] w-full max-w-[calc(100vw-16px)] overflow-hidden p-2"
>
<DialogTitle className="sr-only">
{templateName ?? appDetail?.name ?? t(($) => $['apps.title'], { ns: 'explore' })}
diff --git a/web/app/components/goto-anything/index.tsx b/web/app/components/goto-anything/index.tsx
index a1b25c3aa7c..59124eb043c 100644
--- a/web/app/components/goto-anything/index.tsx
+++ b/web/app/components/goto-anything/index.tsx
@@ -10,14 +10,7 @@ import {
AutocompleteInputGroup,
AutocompleteStatus,
} from '@langgenius/dify-ui/autocomplete'
-import {
- Dialog,
- DialogBackdrop,
- DialogClose,
- DialogPopup,
- DialogPortal,
- DialogTitle,
-} from '@langgenius/dify-ui/dialog'
+import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
import { Kbd, KbdGroup } from '@langgenius/dify-ui/kbd'
import {
ScrollArea,
@@ -437,145 +430,142 @@ export function GotoAnything() {
handle={gotoAnythingDialogHandle}
onOpenChangeComplete={handleDialogOpenChangeComplete}
>
- <DialogPortal>
- <DialogBackdrop />
- <DialogPopup
- initialFocus={inputRef}
- className="fixed top-1/2 left-1/2 isolate flex max-h-[calc(100dvh-2rem)] w-160 max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden p-0"
+ <DialogContent
+ initialFocus={inputRef}
+ className="flex max-h-[calc(100dvh-2rem)] w-160 flex-col overflow-hidden"
+ >
+ <div
+ aria-hidden
+ className="pointer-events-none absolute inset-x-0 top-0 h-64 bg-[url('/marketplace/hero-gradient-noise.svg')] bg-cover bg-center opacity-18 dark:opacity-28"
+ />
+ <div
+ aria-hidden
+ className="pointer-events-none absolute inset-x-0 top-0 h-64 bg-linear-to-b from-components-panel-bg/20 via-components-panel-bg/70 to-components-panel-bg"
+ />
+ <DialogTitle className="sr-only">
+ {t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
+ </DialogTitle>
+ <Autocomplete<GotoAnythingOption>
+ items={visibleOptions}
+ value={searchQuery}
+ onValueChange={handleAutocompleteValueChange}
+ itemToStringValue={optionToInputValue}
+ filter={null}
+ grid={isCommandsMode}
+ open
+ inline
+ autoHighlight="always"
+ keepHighlight
+ loopFocus
>
- <div
- aria-hidden
- className="pointer-events-none absolute inset-x-0 top-0 h-64 bg-[url('/marketplace/hero-gradient-noise.svg')] bg-cover bg-center opacity-18 dark:opacity-28"
- />
- <div
- aria-hidden
- className="pointer-events-none absolute inset-x-0 top-0 h-64 bg-linear-to-b from-components-panel-bg/20 via-components-panel-bg/70 to-components-panel-bg"
- />
- <DialogTitle className="sr-only">
- {t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
- </DialogTitle>
- <Autocomplete<GotoAnythingOption>
- items={visibleOptions}
- value={searchQuery}
- onValueChange={handleAutocompleteValueChange}
- itemToStringValue={optionToInputValue}
- filter={null}
- grid={isCommandsMode}
- open
- inline
- autoHighlight="always"
- keepHighlight
- loopFocus
+ <AutocompleteInputGroup
+ size="medium"
+ className="h-auto shrink-0 gap-3 rounded-none border-0 bg-components-panel-bg-blur px-4 py-3 has-[input:focus]:ring-0"
>
- <AutocompleteInputGroup
- size="medium"
- className="h-auto shrink-0 gap-3 rounded-none border-0 bg-components-panel-bg-blur px-4 py-3 has-[input:focus]:ring-0"
+ <span aria-hidden className="i-ri-search-line size-4 text-text-quaternary" />
+ <div className="flex min-w-0 flex-1 items-center gap-2">
+ <AutocompleteInput
+ ref={inputRef}
+ size="medium"
+ aria-label={t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
+ placeholder={t(($) => $['gotoAnything.searchPlaceholder'], { ns: 'app' })}
+ aria-describedby={searchHintId}
+ className="px-0"
+ />
+ </div>
+ <KbdGroup className="hidden sm:flex">
+ {formatForDisplay(GOTO_ANYTHING_HOTKEY, { parts: true }).map((key) => (
+ <Kbd key={key}>{key}</Kbd>
+ ))}
+ </KbdGroup>
+ </AutocompleteInputGroup>
+ <p id={searchHintId} className="sr-only">
+ {t(($) => $['gotoAnything.searchHint'], { ns: 'app' })}
+ </p>
+
+ <AutocompleteStatus className="sr-only">{autocompleteStatus}</AutocompleteStatus>
+
+ <ScrollArea className="h-120 min-h-0 shrink overflow-hidden border-t border-divider-subtle">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ aria-busy={isLoading || undefined}
+ className="scroll-pt-10 scroll-pb-1 overscroll-contain"
>
- <span aria-hidden className="i-ri-search-line size-4 text-text-quaternary" />
- <div className="flex min-w-0 flex-1 items-center gap-2">
- <AutocompleteInput
- ref={inputRef}
- size="medium"
- aria-label={t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
- placeholder={t(($) => $['gotoAnything.searchPlaceholder'], { ns: 'app' })}
- aria-describedby={searchHintId}
- className="px-0"
- />
- </div>
- <KbdGroup className="hidden sm:flex">
- {formatForDisplay(GOTO_ANYTHING_HOTKEY, { parts: true }).map((key) => (
- <Kbd key={key}>{key}</Kbd>
- ))}
- </KbdGroup>
- </AutocompleteInputGroup>
- <p id={searchHintId} className="sr-only">
- {t(($) => $['gotoAnything.searchHint'], { ns: 'app' })}
- </p>
-
- <AutocompleteStatus className="sr-only">{autocompleteStatus}</AutocompleteStatus>
-
- <ScrollArea className="h-120 min-h-0 shrink overflow-hidden border-t border-divider-subtle">
- <ScrollAreaViewport
- tabIndex={-1}
- aria-busy={isLoading || undefined}
- className="scroll-pt-10 scroll-pb-1 overscroll-contain"
+ <ScrollAreaContent
+ className="min-h-full w-full max-w-full"
+ style={{ minWidth: '100%' }}
>
- <ScrollAreaContent
- className="min-h-full w-full max-w-full"
- style={{ minWidth: '100%' }}
- >
- {emptyStateVariant === 'loading' && <EmptyState variant="loading" />}
-
- {emptyStateVariant === 'error' && <EmptyState variant="error" error={error} />}
-
- {emptyStateVariant === 'no-results' && isCommandsMode && (
- <div className="flex items-center justify-center py-8 text-center text-text-tertiary">
- <div>
- <div className="text-sm font-medium text-text-tertiary">
- {t(($) => $['gotoAnything.noMatchingCommands'], { ns: 'app' })}
- </div>
- <div className="mt-1 text-xs text-text-quaternary">
- {t(($) => $['gotoAnything.tryDifferentSearch'], { ns: 'app' })}
- </div>
+ {emptyStateVariant === 'loading' && <EmptyState variant="loading" />}
+
+ {emptyStateVariant === 'error' && <EmptyState variant="error" error={error} />}
+
+ {emptyStateVariant === 'no-results' && isCommandsMode && (
+ <div className="flex items-center justify-center py-8 text-center text-text-tertiary">
+ <div>
+ <div className="text-sm font-medium text-text-tertiary">
+ {t(($) => $['gotoAnything.noMatchingCommands'], { ns: 'app' })}
+ </div>
+ <div className="mt-1 text-xs text-text-quaternary">
+ {t(($) => $['gotoAnything.tryDifferentSearch'], { ns: 'app' })}
</div>
</div>
- )}
-
- {emptyStateVariant === 'no-results' && !isCommandsMode && (
- <EmptyState
- variant={emptyStateVariant}
- searchMode={searchMode}
- actions={actions}
- />
- )}
-
- {isCommandsMode ? (
- <CommandGrid
- groups={optionGroups}
- label={
- isHome
- ? t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })
- : optionGroups[0]!.label
- }
- onSelect={selectOption}
- />
- ) : (
- <ResultList
- groups={[
- {
- id: 'commands',
- label: getGroupLabel('command'),
- items: optionSuggestions,
- },
- ...Object.entries(groupedResults).map(([type, items]) => ({
- id: type,
- label: getGroupLabel(type),
- items,
- })),
- ]}
- label={t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
- onSelect={selectOption}
- />
- )}
- </ScrollAreaContent>
- </ScrollAreaViewport>
- <ScrollAreaScrollbar>
- <ScrollAreaThumb />
- </ScrollAreaScrollbar>
- </ScrollArea>
-
- <Footer
- onSelectMode={changeSearchQuery}
- resultCount={trimmedSearchQuery ? autocompleteResultCount : null}
- isLoading={isLoading}
- hasPartialFailure={hasUnavailableServices && !isError}
- />
- </Autocomplete>
- <DialogClose tabIndex={-1} className="sr-only">
- {t(($) => $['operation.close'], { ns: 'common' })}
- </DialogClose>
- </DialogPopup>
- </DialogPortal>
+ </div>
+ )}
+
+ {emptyStateVariant === 'no-results' && !isCommandsMode && (
+ <EmptyState
+ variant={emptyStateVariant}
+ searchMode={searchMode}
+ actions={actions}
+ />
+ )}
+
+ {isCommandsMode ? (
+ <CommandGrid
+ groups={optionGroups}
+ label={
+ isHome
+ ? t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })
+ : optionGroups[0]!.label
+ }
+ onSelect={selectOption}
+ />
+ ) : (
+ <ResultList
+ groups={[
+ {
+ id: 'commands',
+ label: getGroupLabel('command'),
+ items: optionSuggestions,
+ },
+ ...Object.entries(groupedResults).map(([type, items]) => ({
+ id: type,
+ label: getGroupLabel(type),
+ items,
+ })),
+ ]}
+ label={t(($) => $['gotoAnything.searchTitle'], { ns: 'app' })}
+ onSelect={selectOption}
+ />
+ )}
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollAreaScrollbar>
+ <ScrollAreaThumb />
+ </ScrollAreaScrollbar>
+ </ScrollArea>
+
+ <Footer
+ onSelectMode={changeSearchQuery}
+ resultCount={trimmedSearchQuery ? autocompleteResultCount : null}
+ isLoading={isLoading}
+ hasPartialFailure={hasUnavailableServices && !isError}
+ />
+ </Autocomplete>
+ <DialogClose tabIndex={-1} className="sr-only">
+ {t(($) => $['operation.close'], { ns: 'common' })}
+ </DialogClose>
+ </DialogContent>
</Dialog>
{activePlugin && canInstallPlugin && (
diff --git a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx
index 1caeedfb3e0..dbc2232ec5d 100644
--- a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx
+++ b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx
@@ -3,12 +3,14 @@ import type { AccessPolicyResourceType } from '@/models/access-control'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { Textarea } from '@langgenius/dify-ui/textarea'
import { useState } from 'react'
@@ -78,10 +80,7 @@ const PermissionSetModalBody = ({
}
return (
- <DialogContent
- className="flex h-[85vh] w-140 flex-col overflow-hidden p-0"
- backdropProps={{ forceRender: true }}
- >
+ <DialogContent className="flex h-[85vh] w-140 flex-col" backdropProps={{ forceRender: true }}>
<form
className="contents"
onSubmit={(event) => {
@@ -89,35 +88,21 @@ const PermissionSetModalBody = ({
void handleConfirm()
}}
>
- <div className="relative shrink-0 px-6 pt-6 pb-4">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="pr-8">
- <DialogTitle className="system-xl-semibold text-text-primary">
- {t(($) => $[`permissionSet.modal.${mode}.${resourceType}.title`], {
- ns: 'permission',
- })}
- </DialogTitle>
- <DialogDescription className="mt-1 system-sm-regular text-text-tertiary">
- {t(($) => $[`permissionSet.modal.${mode}.${resourceType}.description`], {
- ns: 'permission',
- })}
- </DialogDescription>
- </div>
- </div>
-
- <div className="border-t border-divider-subtle" />
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $[`permissionSet.modal.${mode}.${resourceType}.title`], {
+ ns: 'permission',
+ })}
+ </DialogTitle>
+ <DialogDescription>
+ {t(($) => $[`permissionSet.modal.${mode}.${resourceType}.description`], {
+ ns: 'permission',
+ })}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
- <div className="flex min-h-0 flex-1 flex-col gap-5 overflow-y-hidden px-6 py-5">
+ <DialogBody className="flex min-h-0 flex-1 flex-col gap-5 overflow-y-hidden">
<div className="flex shrink-0 flex-col gap-1">
<label htmlFor="permission-set-name" className="system-sm-medium text-text-secondary">
{t(($) => $['permissionSet.nameLabel'], { ns: 'permission' })}
@@ -165,11 +150,11 @@ const PermissionSetModalBody = ({
readonly={readonly}
/>
</div>
- </div>
+ </DialogBody>
- <div className="flex shrink-0 items-center justify-between gap-3 border-t border-divider-subtle px-6 py-4">
+ <DialogFooter>
{submitFailed && (
- <p role="alert" className="system-xs-regular text-text-destructive">
+ <p role="alert" className="me-auto system-xs-regular text-text-destructive">
{t(($) => $['api.actionFailed'], { ns: 'common' })}
</p>
)}
@@ -177,24 +162,22 @@ const PermissionSetModalBody = ({
href={getEnterpriseDocUrl('/use/workspace/permission-reference', docLanguage)}
target="_blank"
rel="noreferrer"
- className="inline-flex items-center gap-1 system-xs-medium text-text-accent hover:underline"
+ className="me-auto inline-flex items-center gap-1 system-xs-medium text-text-accent hover:underline"
>
<span>{t(($) => $['permissionSet.learnMore'], { ns: 'permission' })}</span>
<span aria-hidden className="i-ri-external-link-line h-3.5 w-3.5" />
</a>
- <div className="flex items-center gap-2">
- <Button type="button" variant="secondary" onClick={onClose}>
- {readonly
- ? t(($) => $['operation.close'], { ns: 'common' })
- : t(($) => $['operation.cancel'], { ns: 'common' })}
+ <Button type="button" variant="secondary" onClick={onClose}>
+ {readonly
+ ? t(($) => $['operation.close'], { ns: 'common' })
+ : t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ {!readonly && (
+ <Button type="submit" variant="primary" disabled={!canSubmit} loading={isSubmitting}>
+ {t(($) => $['operation.confirm'], { ns: 'common' })}
</Button>
- {!readonly && (
- <Button type="submit" variant="primary" disabled={!canSubmit} loading={isSubmitting}>
- {t(($) => $['operation.confirm'], { ns: 'common' })}
- </Button>
- )}
- </div>
- </div>
+ )}
+ </DialogFooter>
</form>
</DialogContent>
)
diff --git a/web/app/components/header/account-setting/api-based-extension-page/modal.tsx b/web/app/components/header/account-setting/api-based-extension-page/modal.tsx
index 61332cd5508..01c56e54451 100644
--- a/web/app/components/header/account-setting/api-based-extension-page/modal.tsx
+++ b/web/app/components/header/account-setting/api-based-extension-page/modal.tsx
@@ -3,10 +3,17 @@ import type {
ApiBasedExtensionResponse,
} from '@dify/contracts/api/console/api-based-extension/types.gen'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldDescription, FieldError, FieldLabel } from '@langgenius/dify-ui/field'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { useMutation } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
@@ -86,102 +93,92 @@ export function ApiBasedExtensionModal(props: ApiBasedExtensionModalProps) {
return (
<Dialog open={open} onOpenChange={onOpenChange} disablePointerDismissal>
- <DialogContent
- backdropProps={{ forceRender: true }}
- className="w-160 border-none p-8 pb-6 text-left"
- >
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
-
- <DialogTitle className="mb-2 pr-8 text-xl font-semibold text-text-primary">
- {mode === 'edit'
- ? t(($) => $['apiBasedExtension.modal.editTitle'], { ns: 'common' })
- : t(($) => $['apiBasedExtension.modal.title'], { ns: 'common' })}
- </DialogTitle>
- <Form<ApiBasedExtensionPayload> className="grid gap-4 pt-2" onFormSubmit={handleSubmit}>
- <Field name="name">
- <FieldLabel>{nameLabel}</FieldLabel>
- <Input
- required
- defaultValue={editingApiBasedExtension?.name || ''}
- placeholder={
- t(($) => $['apiBasedExtension.modal.name.placeholder'], { ns: 'common' }) || ''
- }
- />
- <FieldError match="valueMissing">
- {t(($) => $['errorMsg.fieldRequired'], { ns: 'common', field: nameLabel })}
- </FieldError>
- </Field>
+ <DialogContent backdropProps={{ forceRender: true }} className="w-160">
+ <DialogHeader>
+ <DialogTitle>
+ {mode === 'edit'
+ ? t(($) => $['apiBasedExtension.modal.editTitle'], { ns: 'common' })
+ : t(($) => $['apiBasedExtension.modal.title'], { ns: 'common' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <Form<ApiBasedExtensionPayload> onFormSubmit={handleSubmit}>
+ <DialogBody className="grid gap-4">
+ <Field name="name">
+ <FieldLabel>{nameLabel}</FieldLabel>
+ <Input
+ required
+ defaultValue={editingApiBasedExtension?.name || ''}
+ placeholder={
+ t(($) => $['apiBasedExtension.modal.name.placeholder'], { ns: 'common' }) || ''
+ }
+ />
+ <FieldError match="valueMissing">
+ {t(($) => $['errorMsg.fieldRequired'], { ns: 'common', field: nameLabel })}
+ </FieldError>
+ </Field>
- <Field name="api_endpoint">
- <FieldLabel>{apiEndpointLabel}</FieldLabel>
- <Input
- required
- defaultValue={editingApiBasedExtension?.api_endpoint || ''}
- placeholder={
- t(($) => $['apiBasedExtension.modal.apiEndpoint.placeholder'], { ns: 'common' }) ||
- ''
- }
- />
- <FieldDescription>
- <a
- href={docLink('/use-dify/workspace/api-extension/api-extension')}
- target="_blank"
- rel="noopener noreferrer"
- className="inline-flex w-fit items-center text-text-accent focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- >
- <span
- className="mr-1 i-custom-vender-line-education-book-open-01 size-3"
- aria-hidden="true"
- />
- {t(($) => $['apiBasedExtension.link'], { ns: 'common' })}
- </a>
- </FieldDescription>
- <FieldError match="valueMissing">
- {t(($) => $['errorMsg.fieldRequired'], { ns: 'common', field: apiEndpointLabel })}
- </FieldError>
- </Field>
+ <Field name="api_endpoint">
+ <FieldLabel>{apiEndpointLabel}</FieldLabel>
+ <Input
+ required
+ defaultValue={editingApiBasedExtension?.api_endpoint || ''}
+ placeholder={
+ t(($) => $['apiBasedExtension.modal.apiEndpoint.placeholder'], {
+ ns: 'common',
+ }) || ''
+ }
+ />
+ <FieldDescription>
+ <a
+ href={docLink('/use-dify/workspace/api-extension/api-extension')}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="inline-flex w-fit items-center text-text-accent focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
+ >
+ <span
+ className="mr-1 i-custom-vender-line-education-book-open-01 size-3"
+ aria-hidden="true"
+ />
+ {t(($) => $['apiBasedExtension.link'], { ns: 'common' })}
+ </a>
+ </FieldDescription>
+ <FieldError match="valueMissing">
+ {t(($) => $['errorMsg.fieldRequired'], { ns: 'common', field: apiEndpointLabel })}
+ </FieldError>
+ </Field>
- <Field
- name="api_key"
- validate={(value) => {
- if (typeof value === 'string' && value.length > 0 && value.length < 5)
- return t(($) => $['apiBasedExtension.modal.apiKey.lengthError'], { ns: 'common' })
+ <Field
+ name="api_key"
+ validate={(value) => {
+ if (typeof value === 'string' && value.length > 0 && value.length < 5)
+ return t(($) => $['apiBasedExtension.modal.apiKey.lengthError'], { ns: 'common' })
- return null
- }}
- >
- <FieldLabel>{apiKeyLabel}</FieldLabel>
- <Input
- required
- defaultValue={editingApiBasedExtension?.api_key || ''}
- placeholder={
- t(($) => $['apiBasedExtension.modal.apiKey.placeholder'], { ns: 'common' }) || ''
- }
- />
- <FieldError match="valueMissing">
- {t(($) => $['errorMsg.fieldRequired'], { ns: 'common', field: apiKeyLabel })}
- </FieldError>
- <FieldError match="customError" />
- </Field>
-
- <div className="mt-2 flex items-center justify-end gap-2">
+ return null
+ }}
+ >
+ <FieldLabel>{apiKeyLabel}</FieldLabel>
+ <Input
+ required
+ defaultValue={editingApiBasedExtension?.api_key || ''}
+ placeholder={
+ t(($) => $['apiBasedExtension.modal.apiKey.placeholder'], { ns: 'common' }) || ''
+ }
+ />
+ <FieldError match="valueMissing">
+ {t(($) => $['errorMsg.fieldRequired'], { ns: 'common', field: apiKeyLabel })}
+ </FieldError>
+ <FieldError match="customError" />
+ </Field>
+ </DialogBody>
+ <DialogFooter>
<Button type="button" onClick={() => onOpenChange(false)}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
<Button type="submit" variant="primary" disabled={isSaving}>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</Form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/header/account-setting/members-page/assign-roles-modal/index.tsx b/web/app/components/header/account-setting/members-page/assign-roles-modal/index.tsx
index 87c4e7ab4d1..fc1f3b260e6 100644
--- a/web/app/components/header/account-setting/members-page/assign-roles-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/assign-roles-modal/index.tsx
@@ -3,12 +3,13 @@ import type { Role } from '@/models/access-control'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import WorkspaceRoleCheckboxList from '../../workspace-role-checkbox-list'
@@ -55,29 +56,12 @@ const AssignRolesModalBody = ({
}
return (
- <DialogContent
- className="flex h-121 w-120 flex-col overflow-hidden p-0"
- backdropProps={{ forceRender: true }}
- >
- <div className="relative shrink-0 px-6 pt-6 pb-4">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="pr-8">
- <DialogTitle className="system-xl-semibold text-text-primary">{title}</DialogTitle>
- <DialogDescription className="mt-1 system-sm-regular text-text-tertiary">
- {description}
- </DialogDescription>
- </div>
- </div>
+ <DialogContent className="flex h-121 flex-col" backdropProps={{ forceRender: true }}>
+ <DialogHeader>
+ <DialogTitle>{title}</DialogTitle>
+ <DialogDescription>{description}</DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
<WorkspaceRoleCheckboxList
selectedRoleIds={selectedRoleIds}
@@ -86,24 +70,22 @@ const AssignRolesModalBody = ({
onSelectedRolesChange={setSelected}
/>
- <div className="flex shrink-0 items-center gap-3 border-t border-divider-subtle px-6 py-4">
+ <DialogFooter>
{allowMultipleRoles && (
- <div className="system-xs-regular text-text-tertiary">
+ <div className="me-auto system-xs-regular text-text-tertiary">
{t(($) => $['members.assignRolesModal.selectedCount'], {
ns: 'workspaceMembers',
count: selected.length,
})}
</div>
)}
- <div className="ml-auto flex items-center gap-2">
- <Button variant="secondary" onClick={onClose}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <Button variant="primary" disabled={isConfirmDisabled} onClick={handleConfirm}>
- {t(($) => $['operation.confirm'], { ns: 'common' })}
- </Button>
- </div>
- </div>
+ <Button variant="secondary" onClick={onClose}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <Button variant="primary" disabled={isConfirmDisabled} onClick={handleConfirm}>
+ {t(($) => $['operation.confirm'], { ns: 'common' })}
+ </Button>
+ </DialogFooter>
</DialogContent>
)
}
diff --git a/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx b/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx
index de8e53c30d0..956146399f0 100644
--- a/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx
@@ -1,8 +1,15 @@
'use client'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Input } from '@langgenius/dify-ui/input'
import { useAtomValue } from 'jotai'
import { useId, useMemo, useState } from 'react'
@@ -58,32 +65,20 @@ const EditWorkspaceModal = ({ onCancel }: IEditWorkspaceModalProps) => {
}}
>
<DialogContent backdropProps={{ forceRender: true }}>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
-
<form
- className="flex flex-col"
onSubmit={(e) => {
e.preventDefault()
void changeWorkspaceInfo()
}}
>
- <div className="mb-4 pr-8">
- <DialogTitle className="text-xl font-semibold text-text-primary">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['account.editWorkspaceInfo'], { ns: 'accountSettings' })}
</DialogTitle>
- </div>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
- <div className="space-y-2">
+ <DialogBody className="space-y-2">
<label htmlFor={inputId} className="block text-sm font-medium text-text-primary">
{t(($) => $['account.workspaceName'], { ns: 'accountSettings' })}
</label>
@@ -110,9 +105,9 @@ const EditWorkspaceModal = ({ onCancel }: IEditWorkspaceModalProps) => {
</p>
)}
</div>
- </div>
+ </DialogBody>
- <div className="sticky bottom-0 -mx-2 mt-2 flex flex-wrap items-center justify-end gap-x-2 bg-components-panel-bg px-2 pt-4">
+ <DialogFooter>
<Button size="large" type="button" onClick={onCancel}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
@@ -130,7 +125,7 @@ const EditWorkspaceModal = ({ onCancel }: IEditWorkspaceModalProps) => {
})}
</span>
</Button>
- </div>
+ </DialogFooter>
</form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
index 1143467cb74..09b9a9ef549 100644
--- a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
@@ -1,18 +1,21 @@
'use client'
import type { MemberInviteResponse } from '@dify/contracts/api/console/workspaces/types.gen'
import type { DialogActions } from '@langgenius/dify-ui/dialog'
+import type { Ref } from 'react'
import type { EmailRecipient } from './email-recipients'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { isDefinedError } from '@orpc/client'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
@@ -39,6 +42,7 @@ type InviteFormValues = {
// The documented invite errors the form presents on the field that caused them.
type InviteFieldErrorCode = 'invalid_role' | 'limit_exceeded'
type InviteFormProps = {
+ ref: Ref<HTMLFormElement>
isEmailSetup: boolean
isPending: boolean
errorCode: InviteFieldErrorCode | null
@@ -48,6 +52,7 @@ type InviteFormProps = {
}
function InviteForm({
+ ref,
isEmailSetup,
isPending,
errorCode,
@@ -102,63 +107,67 @@ function InviteForm({
return (
<Form<InviteFormValues>
+ ref={ref}
aria-label={t(($) => $['members.inviteTeamMember'], { ns: 'workspaceMembers' })}
errors={fieldErrors}
- className="grid gap-5 pt-5"
onFormSubmit={handleSubmit}
>
- {!isEmailSetup && (
- <div className="flex items-start gap-1.5 rounded-lg bg-state-warning-hover p-2 text-text-warning">
- <span aria-hidden="true" className="i-ri-error-warning-fill size-4 shrink-0" />
- <span className="system-xs-medium text-text-primary">
- {t(($) => $['members.emailNotSetup'], { ns: 'workspaceMembers' })}
- </span>
- </div>
- )}
- <EmailRecipientsField
- recipients={recipients}
- draft={draft}
- onRecipientsChange={setRecipients}
- onDraftChange={setDraft}
- onChange={dismissEmailError}
- disabled={isPending}
- />
- <RoleSelector hasServerError={Boolean(fieldErrors?.role)} disabled={isPending} />
- {exceedsRemainingSeats && (
- <div
- role="status"
- className="flex items-start gap-1.5 rounded-lg bg-state-warning-hover p-2 body-xs-regular text-text-warning"
+ <DialogBody className="grid gap-5">
+ {!isEmailSetup && (
+ <div className="flex items-start gap-1.5 rounded-lg bg-state-warning-hover p-2 text-text-warning">
+ <span aria-hidden="true" className="i-ri-error-warning-fill size-4 shrink-0" />
+ <span className="system-xs-medium text-text-primary">
+ {t(($) => $['members.emailNotSetup'], { ns: 'workspaceMembers' })}
+ </span>
+ </div>
+ )}
+ <EmailRecipientsField
+ recipients={recipients}
+ draft={draft}
+ onRecipientsChange={setRecipients}
+ onDraftChange={setDraft}
+ onChange={dismissEmailError}
+ disabled={isPending}
+ />
+ <RoleSelector hasServerError={Boolean(fieldErrors?.role)} disabled={isPending} />
+ {exceedsRemainingSeats && (
+ <div
+ role="status"
+ className="flex items-start gap-1.5 rounded-lg bg-state-warning-hover p-2 body-xs-regular text-text-warning"
+ >
+ <span aria-hidden="true" className="i-ri-error-warning-line size-4 shrink-0" />
+ <span>
+ {t(($) => $['members.seatsRemaining'], {
+ ns: 'workspaceMembers',
+ count: remainingSeats,
+ })}
+ <span aria-hidden="true"> · </span>
+ {t(($) => $['members.recipientCountExceedsSeats'], { ns: 'workspaceMembers' })}
+ </span>
+ </div>
+ )}
+ {formError && (
+ <div role="alert" className="body-xs-regular text-text-destructive">
+ {formError}
+ </div>
+ )}
+ </DialogBody>
+ <DialogFooter>
+ <Button
+ ref={submitButtonRef}
+ type="submit"
+ variant="primary"
+ className="w-full"
+ loading={isPending}
>
- <span aria-hidden="true" className="i-ri-error-warning-line size-4 shrink-0" />
- <span>
- {t(($) => $['members.seatsRemaining'], {
- ns: 'workspaceMembers',
- count: remainingSeats,
- })}
- <span aria-hidden="true"> · </span>
- {t(($) => $['members.recipientCountExceedsSeats'], { ns: 'workspaceMembers' })}
- </span>
- </div>
- )}
- {formError && (
- <div role="alert" className="body-xs-regular text-text-destructive">
- {formError}
- </div>
- )}
- <Button
- ref={submitButtonRef}
- type="submit"
- variant="primary"
- className="w-full"
- loading={isPending}
- >
- {validRecipientCount > 0
- ? t(($) => $['members.sendInviteCount'], {
- ns: 'workspaceMembers',
- count: validRecipientCount,
- })
- : t(($) => $['members.sendInvite'], { ns: 'workspaceMembers' })}
- </Button>
+ {validRecipientCount > 0
+ ? t(($) => $['members.sendInviteCount'], {
+ ns: 'workspaceMembers',
+ count: validRecipientCount,
+ })
+ : t(($) => $['members.sendInvite'], { ns: 'workspaceMembers' })}
+ </Button>
+ </DialogFooter>
</Form>
)
}
@@ -168,6 +177,7 @@ export function InviteModal({ isEmailSetup, onSend }: InviteModalProps) {
const locale = useLocale()
const queryClient = useQueryClient()
const actionsRef = useRef<DialogActions>(null)
+ const formRef = useRef<HTMLFormElement>(null)
const { mutate, reset, isPending, error } = useMutation(
consoleQuery.workspaces.current.members.inviteEmail.post.mutationOptions({
context: { silent: true },
@@ -195,16 +205,27 @@ export function InviteModal({ isEmailSetup, onSend }: InviteModalProps) {
}}
>
<DialogTrigger render={<InviteButton />} />
- <DialogContent backdropProps={{ forceRender: true }}>
- <div className="grid gap-1 pr-8">
- <DialogTitle className="text-xl font-semibold text-text-primary">
+ <DialogContent
+ backdropProps={{ forceRender: true }}
+ initialFocus={() => {
+ const emailInput = formRef.current?.elements.namedItem('emails')
+ return emailInput instanceof HTMLInputElement ? emailInput : true
+ }}
+ >
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['members.inviteTeamMember'], { ns: 'workspaceMembers' })}
</DialogTitle>
- <DialogDescription className="text-sm text-text-tertiary">
+ <DialogDescription>
{t(($) => $['members.inviteTeamMemberTip'], { ns: 'workspaceMembers' })}
</DialogDescription>
- </div>
+ <DialogCloseButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ disabled={isPending}
+ />
+ </DialogHeader>
<InviteForm
+ ref={formRef}
isEmailSetup={isEmailSetup}
isPending={isPending}
// The link marks a documented code as defined, so `error.code` narrows to the invite contract.
@@ -213,18 +234,6 @@ export function InviteModal({ isEmailSetup, onSend }: InviteModalProps) {
onSubmit={(emails, role) => mutate({ body: { emails, role, language: locale } })}
onDismissError={reset}
/>
- <DialogClose
- disabled={isPending}
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/header/account-setting/members-page/invited-modal/index.tsx b/web/app/components/header/account-setting/members-page/invited-modal/index.tsx
index 1b1a85030dc..b0fc7a2e7c4 100644
--- a/web/app/components/header/account-setting/members-page/invited-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/invited-modal/index.tsx
@@ -5,8 +5,15 @@ import type {
MemberInviteSuccessResponse,
} from '@dify/contracts/api/console/workspaces/types.gen'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
@@ -51,104 +58,94 @@ const InvitedModal = ({ invitationResults, onCancel }: IInvitedModalProps) => {
if (!open) onCancel()
}}
>
- <DialogContent backdropProps={{ forceRender: true }} className="w-120 p-8">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-8 right-8"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="mb-3 flex justify-between">
- <div className="flex h-12 w-12 items-center justify-center rounded-xl border-[0.5px] border-components-panel-border bg-background-section-burn shadow-xl">
+ <DialogContent backdropProps={{ forceRender: true }}>
+ <DialogHeader>
+ <div className="mb-2 flex h-12 w-12 items-center justify-center rounded-xl border-[0.5px] border-components-panel-border bg-background-section-burn shadow-xl">
<div className="i-heroicons-check-circle-solid h-5.5 w-5.5 text-[#039855]" />
</div>
- </div>
- <DialogTitle className="mb-1 text-xl font-semibold text-text-primary">
- {t(
- ($) =>
- $[onlyAlreadyMembers ? 'members.noNewInvitationsSent' : 'members.invitationSent'],
- { ns: 'workspaceMembers' },
- )}
- </DialogTitle>
- {isCloudEdition && <div className="mb-5 text-sm text-text-tertiary">{description}</div>}
- {(isNonCloudEdition || !!alreadyMemberInvitationResults.length) && (
- <>
- {isNonCloudEdition && (
- <div className="mb-5 text-sm text-text-tertiary">{description}</div>
+ <DialogTitle>
+ {t(
+ ($) =>
+ $[onlyAlreadyMembers ? 'members.noNewInvitationsSent' : 'members.invitationSent'],
+ { ns: 'workspaceMembers' },
)}
- <div className="mb-9 flex flex-col gap-2">
- {isNonCloudEdition && !!successInvitationResults.length && (
- <>
- <div className="py-2 text-sm font-medium text-text-primary">
- {t(($) => $['members.invitationLink'], { ns: 'workspaceMembers' })}
- </div>
- {successInvitationResults.map((item) => (
- <InvitationLink key={item.email} value={item} />
- ))}
- </>
- )}
- {!!alreadyMemberInvitationResults.length && (
- <>
- <div className="py-2 text-sm font-medium text-text-primary">
- {t(($) => $['members.alreadyInTeam'], { ns: 'workspaceMembers' })}
- </div>
- {!onlyAlreadyMembers && (
- <div className="text-sm text-text-tertiary">
- {t(($) => $['members.alreadyInTeamTip'], { ns: 'workspaceMembers' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="space-y-5">
+ {isCloudEdition && <div className="text-sm text-text-tertiary">{description}</div>}
+ {(isNonCloudEdition || !!alreadyMemberInvitationResults.length) && (
+ <>
+ {isNonCloudEdition && <div className="text-sm text-text-tertiary">{description}</div>}
+ <div className="flex flex-col gap-2">
+ {isNonCloudEdition && !!successInvitationResults.length && (
+ <>
+ <div className="py-2 text-sm font-medium text-text-primary">
+ {t(($) => $['members.invitationLink'], { ns: 'workspaceMembers' })}
</div>
- )}
- <div className="flex flex-wrap justify-between gap-y-1">
- {alreadyMemberInvitationResults.map((item) => (
- <div
- key={item.email}
- className="flex justify-center rounded-md border border-components-panel-border bg-background-section-burn px-1 text-sm text-text-secondary"
- >
- {item.email}
- </div>
+ {successInvitationResults.map((item) => (
+ <InvitationLink key={item.email} value={item} />
))}
- </div>
- </>
- )}
- {isNonCloudEdition && !!failedInvitationResults.length && (
- <>
- <div className="py-2 text-sm font-medium text-text-primary">
- {t(($) => $['members.failedInvitationEmails'], { ns: 'workspaceMembers' })}
- </div>
- <div className="flex flex-wrap justify-between gap-y-1">
- {failedInvitationResults.map((item) => (
- <div
- key={item.email}
- className="flex justify-center rounded-md border border-red-300 bg-orange-50 px-1"
- >
- <Tooltip>
- <TooltipTrigger
- render={
- <div className="flex items-center justify-center gap-1 text-sm">
- {item.email}
- <div className="i-ri-question-line size-4 text-red-300" />
- </div>
- }
- />
- <TooltipContent>{item.message}</TooltipContent>
- </Tooltip>
+ </>
+ )}
+ {!!alreadyMemberInvitationResults.length && (
+ <>
+ <div className="py-2 text-sm font-medium text-text-primary">
+ {t(($) => $['members.alreadyInTeam'], { ns: 'workspaceMembers' })}
+ </div>
+ {!onlyAlreadyMembers && (
+ <div className="text-sm text-text-tertiary">
+ {t(($) => $['members.alreadyInTeamTip'], { ns: 'workspaceMembers' })}
</div>
- ))}
- </div>
- </>
- )}
- </div>
- </>
- )}
- <div className="flex justify-end">
+ )}
+ <div className="flex flex-wrap justify-between gap-y-1">
+ {alreadyMemberInvitationResults.map((item) => (
+ <div
+ key={item.email}
+ className="flex justify-center rounded-md border border-components-panel-border bg-background-section-burn px-1 text-sm text-text-secondary"
+ >
+ {item.email}
+ </div>
+ ))}
+ </div>
+ </>
+ )}
+ {isNonCloudEdition && !!failedInvitationResults.length && (
+ <>
+ <div className="py-2 text-sm font-medium text-text-primary">
+ {t(($) => $['members.failedInvitationEmails'], { ns: 'workspaceMembers' })}
+ </div>
+ <div className="flex flex-wrap justify-between gap-y-1">
+ {failedInvitationResults.map((item) => (
+ <div
+ key={item.email}
+ className="flex justify-center rounded-md border border-red-300 bg-orange-50 px-1"
+ >
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <div className="flex items-center justify-center gap-1 text-sm">
+ {item.email}
+ <div className="i-ri-question-line size-4 text-red-300" />
+ </div>
+ }
+ />
+ <TooltipContent>{item.message}</TooltipContent>
+ </Tooltip>
+ </div>
+ ))}
+ </div>
+ </>
+ )}
+ </div>
+ </>
+ )}
+ </DialogBody>
+ <DialogFooter>
<Button className="w-24" onClick={onCancel} variant="primary">
{t(($) => $['members.ok'], { ns: 'workspaceMembers' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx b/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx
index 71912727414..2d0414f6569 100644
--- a/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx
@@ -3,8 +3,15 @@ import type { AccountWithRoleResponse } from '@dify/contracts/api/console/worksp
import type { Role } from '@/models/access-control'
import { Avatar, AvatarFallback, AvatarImage } from '@langgenius/dify-ui/avatar'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useQuery } from '@tanstack/react-query'
import { memo, useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -112,39 +119,35 @@ const MemberDetailsModal = ({
if (!next) onClose()
}}
>
- <DialogContent className="w-110 overflow-visible p-0" backdropProps={{ forceRender: true }}>
- <div className="relative px-6 pt-6 pb-5">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="pr-8 system-xl-semibold text-text-primary">
+ <DialogContent
+ // oxlint-disable-next-line shadcn/no-restyle -- Keeps content that reaches past the edge unclipped, as before.
+ className="w-110 overflow-visible"
+ backdropProps={{ forceRender: true }}
+ >
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['members.memberDetails.title'], {
ns: 'workspaceMembers',
defaultValue: 'Member Details',
})}
</DialogTitle>
-
- <div className="mt-5 flex items-center gap-3">
- <Avatar size="2xl" aria-hidden="true">
- <AvatarFallback>{getAvatarInitial(member.name)}</AvatarFallback>
- <AvatarImage src={member.avatar_url || undefined} alt="" />
- </Avatar>
- <div className="min-w-0 flex-1">
- <div className="truncate system-md-semibold text-text-primary">{member.name}</div>
- <div className="truncate system-xs-regular text-text-tertiary">{member.email}</div>
- </div>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+
+ <DialogBody className="flex items-center gap-3">
+ <Avatar size="2xl" aria-hidden="true">
+ <AvatarFallback>{getAvatarInitial(member.name)}</AvatarFallback>
+ <AvatarImage src={member.avatar_url || undefined} alt="" />
+ </Avatar>
+ <div className="min-w-0 flex-1">
+ <div className="truncate system-md-semibold text-text-primary">{member.name}</div>
+ <div className="truncate system-xs-regular text-text-tertiary">{member.email}</div>
</div>
- </div>
+ </DialogBody>
- <div className="border-t border-divider-subtle px-6 py-4">
+ <div className="border-t border-divider-subtle" />
+
+ <DialogBody>
<div className="flex items-center justify-between">
<div className="flex items-center gap-1.5 system-sm-semibold text-text-secondary">
<span>{assignedRolesLabel}</span>
@@ -212,17 +215,17 @@ const MemberDetailsModal = ({
)}
</>
)}
- </div>
+ </DialogBody>
{canAssignRoles && (
- <div className="flex items-center justify-end gap-2 px-6 pt-2 pb-4">
+ <DialogFooter>
<Button variant="secondary" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
<Button variant="primary" onClick={handleSave} disabled={!onAssignSubmit}>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
)}
</DialogContent>
</Dialog>
diff --git a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx
index 1177333c155..e2b3a6f20ed 100644
--- a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx
@@ -1,5 +1,13 @@
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Input } from '@langgenius/dify-ui/input'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
@@ -110,91 +118,102 @@ const TransferOwnershipModal = ({ onClose, show }: Props) => {
}
}
return (
- <Dialog open={show}>
+ <Dialog
+ open={show}
+ onOpenChange={(open) => {
+ if (!open) onClose()
+ }}
+ disablePointerDismissal
+ >
<DialogContent className="w-105">
- <button
- type="button"
- className="absolute top-5 right-5 cursor-pointer border-none bg-transparent p-1.5 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- onClick={onClose}
- >
- <span className="i-ri-close-line size-5 text-text-tertiary" aria-hidden="true" />
- </button>
{step === STEP.start && (
<>
- <div className="pb-3 title-2xl-semi-bold text-text-primary">
- {t(($) => $['members.transferModal.title'], { ns: 'workspaceMembers' })}
- </div>
- <div className="space-y-1 pt-1 pb-2">
- <div className="body-md-medium text-text-destructive">
- {t(($) => $['members.transferModal.warning'], {
- ns: 'workspaceMembers',
- workspace: currentWorkspace.name.replace(/'/g, '’'),
- })}
- </div>
- <div className="body-md-regular text-text-secondary">
- {t(($) => $['members.transferModal.warningTip'], { ns: 'workspaceMembers' })}
- </div>
- <div className="body-md-regular text-text-secondary">
- <Trans
- i18nKey={($) => $['members.transferModal.sendTip']}
- ns="workspaceMembers"
- components={{ email: <span className="body-md-medium text-text-primary"></span> }}
- values={{ email: userProfile.email }}
- />
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['members.transferModal.title'], { ns: 'workspaceMembers' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="space-y-1 pt-1 pb-2">
+ <div className="body-md-medium text-text-destructive">
+ {t(($) => $['members.transferModal.warning'], {
+ ns: 'workspaceMembers',
+ workspace: currentWorkspace.name.replace(/'/g, '’'),
+ })}
+ </div>
+ <div className="body-md-regular text-text-secondary">
+ {t(($) => $['members.transferModal.warningTip'], { ns: 'workspaceMembers' })}
+ </div>
+ <div className="body-md-regular text-text-secondary">
+ <Trans
+ i18nKey={($) => $['members.transferModal.sendTip']}
+ ns="workspaceMembers"
+ components={{
+ email: <span className="body-md-medium text-text-primary"></span>,
+ }}
+ values={{ email: userProfile.email }}
+ />
+ </div>
</div>
- </div>
- <div className="pt-3"></div>
- <div className="space-y-2">
+ </DialogBody>
+ <DialogFooter className="flex-col items-stretch">
<Button className="w-full!" variant="primary" onClick={sendCodeToOriginEmail}>
{t(($) => $['members.transferModal.sendVerifyCode'], { ns: 'workspaceMembers' })}
</Button>
<Button className="w-full!" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</>
)}
{step === STEP.verify && (
<>
- <div className="pb-3 title-2xl-semi-bold text-text-primary">
- {t(($) => $['members.transferModal.verifyEmail'], { ns: 'workspaceMembers' })}
- </div>
- <div className="pt-1 pb-2">
- <div className="body-md-regular text-text-secondary">
- <Trans
- i18nKey={($) => $['members.transferModal.verifyContent']}
- ns="workspaceMembers"
- components={{ email: <span className="body-md-medium text-text-primary"></span> }}
- values={{ email: userProfile.email }}
- />
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['members.transferModal.verifyEmail'], { ns: 'workspaceMembers' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="pt-1 pb-2">
+ <div className="body-md-regular text-text-secondary">
+ <Trans
+ i18nKey={($) => $['members.transferModal.verifyContent']}
+ ns="workspaceMembers"
+ components={{
+ email: <span className="body-md-medium text-text-primary"></span>,
+ }}
+ values={{ email: userProfile.email }}
+ />
+ </div>
+ <div className="body-md-regular text-text-secondary">
+ {t(($) => $['members.transferModal.verifyContent2'], { ns: 'workspaceMembers' })}
+ </div>
</div>
- <div className="body-md-regular text-text-secondary">
- {t(($) => $['members.transferModal.verifyContent2'], { ns: 'workspaceMembers' })}
+ <div className="pt-3">
+ <label
+ htmlFor={verificationCodeInputId}
+ className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"
+ >
+ {t(($) => $['members.transferModal.codeLabel'], { ns: 'workspaceMembers' })}
+ </label>
+ <Input
+ id={verificationCodeInputId}
+ name="verification-code"
+ inputMode="numeric"
+ autoComplete="one-time-code"
+ className="w-full!"
+ placeholder={t(($) => $['members.transferModal.codePlaceholder'], {
+ ns: 'workspaceMembers',
+ })}
+ value={code}
+ onChange={(e) => setCode(e.target.value)}
+ maxLength={6}
+ />
</div>
- </div>
- <div className="pt-3">
- <label
- htmlFor={verificationCodeInputId}
- className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"
- >
- {t(($) => $['members.transferModal.codeLabel'], { ns: 'workspaceMembers' })}
- </label>
- <Input
- id={verificationCodeInputId}
- name="verification-code"
- inputMode="numeric"
- autoComplete="one-time-code"
- className="w-full!"
- placeholder={t(($) => $['members.transferModal.codePlaceholder'], {
- ns: 'workspaceMembers',
- })}
- value={code}
- onChange={(e) => setCode(e.target.value)}
- maxLength={6}
- />
- </div>
- <div className="mt-3 space-y-2">
+ </DialogBody>
+ <DialogFooter className="flex-col items-stretch">
<Button
disabled={code.length !== 6}
className="w-full!"
@@ -206,54 +225,63 @@ const TransferOwnershipModal = ({ onClose, show }: Props) => {
<Button className="w-full!" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
- </div>
- <div className="mt-3 flex items-center gap-1 system-xs-regular text-text-tertiary">
- <span>
- {t(($) => $['members.transferModal.resendTip'], { ns: 'workspaceMembers' })}
- </span>
- {time > 0 && (
+ <div className="flex items-center gap-1 system-xs-regular text-text-tertiary">
<span>
- {t(($) => $['members.transferModal.resendCount'], {
- ns: 'workspaceMembers',
- count: time,
- })}
+ {t(($) => $['members.transferModal.resendTip'], { ns: 'workspaceMembers' })}
</span>
- )}
- {!time && (
- <button
- type="button"
- onClick={sendCodeToOriginEmail}
- className="cursor-pointer border-none bg-transparent p-0 text-left system-xs-medium text-text-accent-secondary"
- >
- {t(($) => $['members.transferModal.resend'], { ns: 'workspaceMembers' })}
- </button>
- )}
- </div>
+ {time > 0 && (
+ <span>
+ {t(($) => $['members.transferModal.resendCount'], {
+ ns: 'workspaceMembers',
+ count: time,
+ })}
+ </span>
+ )}
+ {!time && (
+ <button
+ type="button"
+ onClick={sendCodeToOriginEmail}
+ className="cursor-pointer border-none bg-transparent p-0 text-left system-xs-medium text-text-accent-secondary"
+ >
+ {t(($) => $['members.transferModal.resend'], { ns: 'workspaceMembers' })}
+ </button>
+ )}
+ </div>
+ </DialogFooter>
</>
)}
{step === STEP.transfer && (
<>
- <div className="pb-3 title-2xl-semi-bold text-text-primary">
- {t(($) => $['members.transferModal.title'], { ns: 'workspaceMembers' })}
- </div>
- <div className="space-y-1 pt-1 pb-2">
- <div className="body-md-medium text-text-destructive">
- {t(($) => $['members.transferModal.warning'], {
- ns: 'workspaceMembers',
- workspace: currentWorkspace.name.replace(/'/g, '’'),
- })}
- </div>
- <div className="body-md-regular text-text-secondary">
- {t(($) => $['members.transferModal.warningTip'], { ns: 'workspaceMembers' })}
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['members.transferModal.title'], { ns: 'workspaceMembers' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="space-y-1 pt-1 pb-2">
+ <div className="body-md-medium text-text-destructive">
+ {t(($) => $['members.transferModal.warning'], {
+ ns: 'workspaceMembers',
+ workspace: currentWorkspace.name.replace(/'/g, '’'),
+ })}
+ </div>
+ <div className="body-md-regular text-text-secondary">
+ {t(($) => $['members.transferModal.warningTip'], { ns: 'workspaceMembers' })}
+ </div>
</div>
- </div>
- <div className="pt-3">
- <div className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary">
- {t(($) => $['members.transferModal.transferLabel'], { ns: 'workspaceMembers' })}
+ <div className="pt-3">
+ <div className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary">
+ {t(($) => $['members.transferModal.transferLabel'], { ns: 'workspaceMembers' })}
+ </div>
+ <MemberSelector
+ exclude={[userProfile.id]}
+ value={newOwner}
+ onSelect={setNewOwner}
+ />
</div>
- <MemberSelector exclude={[userProfile.id]} value={newOwner} onSelect={setNewOwner} />
- </div>
- <div className="mt-4 space-y-2">
+ </DialogBody>
+ <DialogFooter className="flex-col items-stretch">
<Button
disabled={!newOwner || isTransfer}
className="w-full!"
@@ -266,7 +294,7 @@ const TransferOwnershipModal = ({ onClose, show }: Props) => {
<Button className="w-full!" onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</>
)}
</DialogContent>
diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
index 9a187b4a0f8..6ac568f5872 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
@@ -18,15 +18,18 @@ import {
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { memo, useCallback, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Badge from '@/app/components/base/badge'
+import { EncryptedBottom, EncryptedFooter } from '@/app/components/base/encrypted-bottom'
import AuthForm from '@/app/components/base/form/form-scenarios/auth'
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import {
@@ -213,13 +216,13 @@ const ModelModal: FC<ModelModalProps> = ({
else label = t(($) => $['modelProvider.auth.addModelCredential'], { ns: 'modelProvider' })
}
- return <DialogTitle className="title-2xl-semi-bold text-text-primary">{label}</DialogTitle>
+ return <DialogTitle>{label}</DialogTitle>
}, [t, mode, credential])
const modalDesc = useMemo(() => {
if (providerFormSchemaPredefined) {
return (
- <DialogDescription className="mt-1 system-xs-regular text-text-tertiary">
+ <DialogDescription>
{t(($) => $['modelProvider.auth.apiKeyModal.desc'], { ns: 'modelProvider' })}
</DialogDescription>
)
@@ -311,27 +314,14 @@ const ModelModal: FC<ModelModalProps> = ({
return (
<Dialog open onOpenChange={handleOpenChange}>
- <DialogContent
- backdropProps={{ forceRender: true }}
- className="flex w-160 max-w-160 flex-col overflow-hidden p-0"
- >
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="shrink-0 p-6 pb-3">
+ <DialogContent backdropProps={{ forceRender: true }} className="w-160 max-w-160">
+ <DialogHeader>
{modalTitle}
{modalDesc}
{modalModel}
- </div>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
{mode === ModelModalModeEnum.configCustomModel && (
<AuthForm
formSchemas={
@@ -391,29 +381,27 @@ const ModelModal: FC<ModelModalProps> = ({
ref={formRef2}
/>
)}
- </div>
- <div className="flex shrink-0 justify-between p-6 pt-5">
- {provider.help && (provider.help.title || provider.help.url) ? (
- <a
- href={provider.help?.url[language] || provider.help?.url.en_US}
- target="_blank"
- rel="noopener noreferrer"
- className="mt-2 inline-block align-middle system-xs-regular text-text-accent"
- onClick={(e) => !provider.help?.url && e.preventDefault()}
- >
- {provider.help.title?.[language] ||
- provider.help.url[language] ||
- provider.help.title?.en_US ||
- provider.help.url.en_US}
- <span
- aria-hidden
- className="-mt-0.5 ml-1 i-custom-vender-line-general-link-external-02 inline-block h-3 w-3 align-middle"
- />
- </a>
- ) : (
- <div />
- )}
- <div className="ml-2 flex items-center justify-end space-x-2">
+ </DialogBody>
+ <EncryptedFooter>
+ <DialogFooter>
+ {provider.help && (provider.help.title || provider.help.url) && (
+ <a
+ href={provider.help?.url[language] || provider.help?.url.en_US}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="me-auto inline-block align-middle system-xs-regular text-text-accent"
+ onClick={(e) => !provider.help?.url && e.preventDefault()}
+ >
+ {provider.help.title?.[language] ||
+ provider.help.url[language] ||
+ provider.help.title?.en_US ||
+ provider.help.url.en_US}
+ <span
+ aria-hidden
+ className="-mt-0.5 ml-1 i-custom-vender-line-general-link-external-02 inline-block h-3 w-3 align-middle"
+ />
+ </a>
+ )}
{isEditMode && (
<Button
variant="primary"
@@ -431,29 +419,15 @@ const ModelModal: FC<ModelModalProps> = ({
>
{saveButtonText}
</Button>
- </div>
- </div>
- {(mode === ModelModalModeEnum.configCustomModel ||
- mode === ModelModalModeEnum.configProviderCredential) && (
- <div className="shrink-0 border-t-[0.5px] border-t-divider-regular">
- <div className="flex items-center justify-center rounded-b-2xl bg-background-section-burn py-3 text-xs text-text-tertiary">
- <span
- aria-hidden
- className="mr-1 i-custom-vender-solid-security-lock-01 size-3 text-text-tertiary"
- />
- {t(($) => $['modelProvider.encrypted.front'], { ns: 'modelProvider' })}
- <a
- className="mx-1 text-text-accent"
- target="_blank"
- rel="noopener noreferrer"
- href="https://pycryptodome.readthedocs.io/en/latest/src/cipher/oaep.html"
- >
- PKCS1_OAEP
- </a>
- {t(($) => $['modelProvider.encrypted.back'], { ns: 'modelProvider' })}
- </div>
- </div>
- )}
+ </DialogFooter>
+ {(mode === ModelModalModeEnum.configCustomModel ||
+ mode === ModelModalModeEnum.configProviderCredential) && (
+ <EncryptedBottom
+ front={t(($) => $['modelProvider.encrypted.front'], { ns: 'modelProvider' })}
+ back={t(($) => $['modelProvider.encrypted.back'], { ns: 'modelProvider' })}
+ />
+ )}
+ </EncryptedFooter>
</DialogContent>
<AlertDialog open={!!deleteCredentialId} onOpenChange={handleConfirmOpenChange}>
<AlertDialogContent backdropProps={{ forceRender: true }}>
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx
index 833efbc27e5..92b8e2802f1 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx
@@ -2,7 +2,13 @@ import type { ModelProviderSummaryResponse } from '@dify/contracts/api/console/w
import type { ComponentType, FC } from 'react'
import type { Credential, ModelItem, ModelProvider } from '../declarations'
import type { ModelLoadBalancingModalProps } from './model-load-balancing-modal'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useAtomValue } from 'jotai'
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -22,19 +28,23 @@ const ModelLoadBalancingLoadingDialog = ({
return (
<Dialog open onOpenChange={(open) => !open && onClose?.()}>
- <DialogContent className="w-160 max-w-none border-none px-8 pt-8 text-left align-middle">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['modelProvider.auth.configModel'], { ns: 'modelProvider' })}
- </DialogTitle>
- <div className="flex items-center gap-2 py-8" role="status" aria-busy="true">
- <span
- aria-hidden
- className="i-ri-loader-2-line size-4 animate-spin text-text-tertiary motion-reduce:animate-none"
- />
- <span className="system-sm-regular text-text-secondary">
- {t(($) => $.loading, { ns: 'common' })}
- </span>
- </div>
+ <DialogContent className="w-160 max-w-none">
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['modelProvider.auth.configModel'], { ns: 'modelProvider' })}
+ </DialogTitle>
+ </DialogHeader>
+ <DialogBody>
+ <div className="flex items-center gap-2 py-8" role="status" aria-busy="true">
+ <span
+ aria-hidden
+ className="i-ri-loader-2-line size-4 animate-spin text-text-tertiary motion-reduce:animate-none"
+ />
+ <span className="system-sm-regular text-text-secondary">
+ {t(($) => $.loading, { ns: 'common' })}
+ </span>
+ </div>
+ </DialogBody>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx
index 878dfb2112d..ed654331410 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx
@@ -18,7 +18,14 @@ import {
} from '@langgenius/dify-ui/alert-dialog'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useMutation, useQuery } from '@tanstack/react-query'
import { memo, useCallback, useEffect, useId, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -282,38 +289,34 @@ const ModelLoadBalancingModal = ({
if (!open) onClose?.()
}}
>
- <DialogContent className="w-160 max-w-none border-none px-8 pt-8 text-left align-middle">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- <div className="pb-3 font-semibold">
- <div className="h-7.5">
- {draftConfig?.enabled
- ? t(($) => $['modelProvider.auth.configLoadBalancing'], { ns: 'modelProvider' })
- : t(($) => $['modelProvider.auth.configModel'], { ns: 'modelProvider' })}
+ <DialogContent className="w-160 max-w-none">
+ <DialogHeader>
+ <DialogTitle>
+ {draftConfig?.enabled
+ ? t(($) => $['modelProvider.auth.configLoadBalancing'], { ns: 'modelProvider' })
+ : t(($) => $['modelProvider.auth.configModel'], { ns: 'modelProvider' })}
+ </DialogTitle>
+ {Boolean(model) && (
+ <div className="flex h-5 items-center">
+ <ModelIcon className="mr-2 shrink-0" provider={provider} modelName={model!.model} />
+ <ModelName
+ className="grow system-md-regular text-text-secondary"
+ modelItem={model!}
+ showModelType
+ showMode
+ showContextSize
+ />
</div>
- {Boolean(model) && (
- <div className="flex h-5 items-center">
- <ModelIcon
- className="mr-2 shrink-0"
- provider={provider}
- modelName={model!.model}
- />
- <ModelName
- className="grow system-md-regular text-text-secondary"
- modelItem={model!}
- showModelType
- showMode
- showContextSize
- />
- </div>
- )}
- </div>
- </DialogTitle>
+ )}
+ </DialogHeader>
{!draftConfig ? (
- <LoadingPlaceholder />
+ <DialogBody>
+ <LoadingPlaceholder />
+ </DialogBody>
) : (
<>
- <div className="py-2">
+ <DialogBody>
<div
className={cn(
'relative min-h-16 rounded-xl border bg-components-panel-bg transition-colors',
@@ -399,43 +402,38 @@ const ModelLoadBalancingModal = ({
}}
/>
)}
- </div>
+ </DialogBody>
- <div className="mt-6 flex items-center justify-between gap-2">
- <div>
- {!providerFormSchemaPredefined && (
- <Button
- onClick={() =>
- openConfirmDelete(undefined, {
- model: model.model,
- model_type: model.model_type,
- })
- }
- className="text-components-button-destructive-secondary-text"
- >
- {t(($) => $['modelProvider.auth.removeModel'], { ns: 'modelProvider' })}
- </Button>
- )}
- </div>
- <div className="space-x-2">
- <Button onClick={onClose}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
+ <DialogFooter>
+ {!providerFormSchemaPredefined && (
<Button
- variant="primary"
- onClick={handleSave}
- disabled={
- loading ||
- (draftConfig?.enabled &&
- (draftConfig?.configs.filter((config) => config.enabled).length ?? 0) <
- 2) ||
- isLoading
+ onClick={() =>
+ openConfirmDelete(undefined, {
+ model: model.model,
+ model_type: model.model_type,
+ })
}
+ className="me-auto text-components-button-destructive-secondary-text"
>
- {t(($) => $['operation.save'], { ns: 'common' })}
+ {t(($) => $['modelProvider.auth.removeModel'], { ns: 'modelProvider' })}
</Button>
- </div>
- </div>
+ )}
+ <Button onClick={onClose}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <Button
+ variant="primary"
+ onClick={handleSave}
+ disabled={
+ loading ||
+ (draftConfig?.enabled &&
+ (draftConfig?.configs.filter((config) => config.enabled).length ?? 0) < 2) ||
+ isLoading
+ }
+ >
+ {t(($) => $['operation.save'], { ns: 'common' })}
+ </Button>
+ </DialogFooter>
</>
)}
<AlertDialog open={!!deleteModel} onOpenChange={(open) => !open && closeConfirmDelete()}>
diff --git a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx
index b743849872e..459a3133075 100644
--- a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx
@@ -4,12 +4,15 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Infotip, InfotipContent, InfotipTrigger } from '@langgenius/dify-ui/infotip'
import { useQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
@@ -261,28 +264,18 @@ const SystemModel: FC<SystemModelSelectorProps> = ({
/>
}
backdropProps={{ forceRender: true }}
- className="flex max-h-[calc(100dvh-2rem)] w-120 max-w-120 flex-col overflow-hidden rounded-2xl p-0"
+ className="max-h-[calc(100dvh-2rem)] max-w-120"
>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="shrink-0 px-6 pt-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['modelProvider.systemModelSettingsTitle'], { ns: 'modelProvider' })}
</DialogTitle>
- <p className="mt-1 system-xs-regular text-text-tertiary">
+ <DialogDescription>
{t(($) => $['modelProvider.systemModelSettingsDesc'], { ns: 'modelProvider' })}
- </p>
- </div>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
{isSystemModelListLoading ? (
<div
role="status"
@@ -397,8 +390,8 @@ const SystemModel: FC<SystemModelSelectorProps> = ({
</div>
</div>
)}
- </div>
- <div className="flex h-19 shrink-0 items-center justify-end gap-2 px-6 pt-5 pb-6">
+ </DialogBody>
+ <DialogFooter>
<Button className="min-w-18" onClick={() => handleOpenChange(false)}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
@@ -410,7 +403,7 @@ const SystemModel: FC<SystemModelSelectorProps> = ({
>
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx b/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx
index acf8e02e9b6..066ef7af69d 100644
--- a/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx
+++ b/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx
@@ -3,12 +3,14 @@ import type { Role } from '@/models/access-control'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { Textarea } from '@langgenius/dify-ui/textarea'
import { useCallback, useState } from 'react'
@@ -64,33 +66,15 @@ const RoleModal = ({ mode, open, role, onClose, onSubmit }: RoleModalProps) => {
if (!nextOpen) onClose()
}}
>
- <DialogContent
- className="flex h-[85vh] w-140 flex-col overflow-hidden p-0"
- backdropProps={{ forceRender: true }}
- >
- <div className="relative shrink-0 px-6 pt-6 pb-4">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="pr-8">
- <DialogTitle className="system-xl-semibold text-text-primary">
- {t(($) => $[`role.modal.${mode}.title`], { ns: 'permission' })}
- </DialogTitle>
- <DialogDescription className="mt-1 system-sm-regular text-text-tertiary">
- {t(($) => $[`role.modal.${mode}.description`], { ns: 'permission' })}
- </DialogDescription>
- </div>
- </div>
- <div className="border-t border-divider-subtle" />
- <div className="flex min-h-0 flex-1 flex-col gap-5 overflow-y-hidden px-6 py-5">
+ <DialogContent className="flex h-[85vh] w-140 flex-col" backdropProps={{ forceRender: true }}>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $[`role.modal.${mode}.title`], { ns: 'permission' })}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $[`role.modal.${mode}.description`], { ns: 'permission' })}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="flex min-h-0 flex-1 flex-col gap-5 overflow-y-hidden">
<div className="flex shrink-0 flex-col gap-1">
<label htmlFor="role-name" className="system-sm-medium text-text-secondary">
{t(($) => $['role.modal.nameLabel'], { ns: 'permission' })}
@@ -121,30 +105,28 @@ const RoleModal = ({ mode, open, role, onClose, onSubmit }: RoleModalProps) => {
onChange={setPermissionKeys}
readonly={readonly}
/>
- </div>
- <div className="flex shrink-0 items-center justify-between gap-3 border-t border-divider-subtle px-6 py-4">
+ </DialogBody>
+ <DialogFooter>
<a
href={getEnterpriseDocUrl('/use/workspace/permission-reference', docLanguage)}
target="_blank"
rel="noreferrer"
- className="inline-flex items-center gap-1 system-xs-medium text-text-accent hover:underline"
+ className="me-auto inline-flex items-center gap-1 system-xs-medium text-text-accent hover:underline"
>
<span>{t(($) => $['permissionSet.learnMore'], { ns: 'permission' })}</span>
<span aria-hidden className="i-ri-external-link-line h-3.5 w-3.5" />
</a>
- <div className="flex items-center gap-2">
- <Button variant="secondary" onClick={onClose}>
- {readonly
- ? t(($) => $['operation.close'], { ns: 'common' })
- : t(($) => $['operation.cancel'], { ns: 'common' })}
+ <Button variant="secondary" onClick={onClose}>
+ {readonly
+ ? t(($) => $['operation.close'], { ns: 'common' })
+ : t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ {!readonly && (
+ <Button variant="primary" disabled={!name.trim()} onClick={handleSubmit}>
+ {t(($) => $['operation.confirm'], { ns: 'common' })}
</Button>
- {!readonly && (
- <Button variant="primary" disabled={!name.trim()} onClick={handleSubmit}>
- {t(($) => $['operation.confirm'], { ns: 'common' })}
- </Button>
- )}
- </div>
- </div>
+ )}
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/header/account-setting/resource-access-token-page/token-dialog.tsx b/web/app/components/header/account-setting/resource-access-token-page/token-dialog.tsx
index 2eaed6beb93..d916172b354 100644
--- a/web/app/components/header/account-setting/resource-access-token-page/token-dialog.tsx
+++ b/web/app/components/header/account-setting/resource-access-token-page/token-dialog.tsx
@@ -3,7 +3,15 @@
import type { FormEvent } from 'react'
import type { DialogState, ResourceCandidate } from './types'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
@@ -111,32 +119,21 @@ export default function ResourceAccessTokenDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange} disablePointerDismissal>
- <DialogContent
- backdropProps={{ forceRender: true }}
- className="w-160 border-none p-8 pb-6 text-left"
- >
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="mb-5 pr-8 text-xl font-semibold text-text-primary">
- {isEdit
- ? t(($) => $['resourceAccessToken.editTitle'], { ns: 'accountSettings' })
- : createdToken
- ? t(($) => $['resourceAccessToken.createdToken'], { ns: 'accountSettings' })
- : t(($) => $['resourceAccessToken.createTitle'], { ns: 'accountSettings' })}
- </DialogTitle>
+ <DialogContent backdropProps={{ forceRender: true }} className="w-160">
+ <DialogHeader>
+ <DialogTitle>
+ {isEdit
+ ? t(($) => $['resourceAccessToken.editTitle'], { ns: 'accountSettings' })
+ : createdToken
+ ? t(($) => $['resourceAccessToken.createdToken'], { ns: 'accountSettings' })
+ : t(($) => $['resourceAccessToken.createTitle'], { ns: 'accountSettings' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
{createdToken ? (
- <div className="grid gap-5">
- <div className="grid gap-2">
+ <>
+ <DialogBody className="grid gap-2">
<div className="system-sm-regular text-text-tertiary">
{t(($) => $['resourceAccessToken.createdTokenDescription'], {
ns: 'accountSettings',
@@ -154,37 +151,39 @@ export default function ResourceAccessTokenDialog({
<span aria-hidden className="i-ri-file-copy-line size-4" />
</IconButton>
</div>
- </div>
- <div className="flex justify-end">
+ </DialogBody>
+ <DialogFooter>
<Button onClick={() => onOpenChange(false)}>
{t(($) => $['resourceAccessToken.done'], { ns: 'accountSettings' })}
</Button>
- </div>
- </div>
+ </DialogFooter>
+ </>
) : (
- <form className="grid gap-5" onSubmit={handleSubmit}>
- <Field name="name">
- <FieldLabel>{nameLabel}</FieldLabel>
- <Input
- required
- value={name}
- placeholder={t(($) => $['resourceAccessToken.namePlaceholder'], {
- ns: 'accountSettings',
- })}
- onChange={(event) => setName(event.target.value)}
- />
- <FieldError match="valueMissing">
- {t(($) => $['errorMsg.fieldRequired'], { ns: 'common', field: nameLabel })}
- </FieldError>
- </Field>
+ <form onSubmit={handleSubmit}>
+ <DialogBody className="grid gap-5">
+ <Field name="name">
+ <FieldLabel>{nameLabel}</FieldLabel>
+ <Input
+ required
+ value={name}
+ placeholder={t(($) => $['resourceAccessToken.namePlaceholder'], {
+ ns: 'accountSettings',
+ })}
+ onChange={(event) => setName(event.target.value)}
+ />
+ <FieldError match="valueMissing">
+ {t(($) => $['errorMsg.fieldRequired'], { ns: 'common', field: nameLabel })}
+ </FieldError>
+ </Field>
- <ResourceSelector
- initialResources={initialResources}
- selectedResources={selectedResources}
- onToggle={toggleResource}
- />
+ <ResourceSelector
+ initialResources={initialResources}
+ selectedResources={selectedResources}
+ onToggle={toggleResource}
+ />
+ </DialogBody>
- <div className="flex items-center justify-end gap-2">
+ <DialogFooter>
<Button type="button" onClick={() => onOpenChange(false)}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
@@ -197,7 +196,7 @@ export default function ResourceAccessTokenDialog({
? t(($) => $['operation.save'], { ns: 'common' })
: t(($) => $['operation.create'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
)}
</DialogContent>
diff --git a/web/app/components/header/account-setting/update-setting-dialog.tsx b/web/app/components/header/account-setting/update-setting-dialog.tsx
index 85a8e9f93ba..f058fb7738a 100644
--- a/web/app/components/header/account-setting/update-setting-dialog.tsx
+++ b/web/app/components/header/account-setting/update-setting-dialog.tsx
@@ -5,12 +5,13 @@ import type { PluginCategoryEnum } from '@/app/components/plugins/types'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { AUTO_UPDATE_STRATEGY } from '@/app/components/plugins/reference-setting-modal/auto-update-setting/types'
@@ -79,39 +80,33 @@ export function UpdateSettingDialog({ category }: Props) {
</Button>
}
/>
- <DialogContent className="flex w-120 max-w-[calc(100vw-32px)] flex-col overflow-hidden! rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0! text-left align-middle shadow-xl">
- <div className="relative flex w-full items-start gap-2 px-6 pt-6 pr-14 pb-3">
- <DialogTitle className="min-w-0 flex-1 title-2xl-semi-bold text-text-primary">
+ <DialogContent className="max-w-[calc(100vw-32px)]">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['autoUpdate.autoUpdateSettings'], { ns: 'plugin' })}
</DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- </div>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
{isSettingsLoading && (
- <div
- role="status"
- className="flex min-h-65 items-center justify-center gap-2 px-6 py-6 system-sm-regular text-text-tertiary"
- >
- <span
- aria-hidden
- className="i-ri-loader-2-line size-4 animate-spin motion-reduce:animate-none"
- />
- <span>{t(($) => $.loading, { ns: 'common' })}</span>
- </div>
+ <DialogBody>
+ <div
+ role="status"
+ className="flex min-h-65 items-center justify-center gap-2 system-sm-regular text-text-tertiary"
+ >
+ <span
+ aria-hidden
+ className="i-ri-loader-2-line size-4 animate-spin motion-reduce:animate-none"
+ />
+ <span>{t(($) => $.loading, { ns: 'common' })}</span>
+ </div>
+ </DialogBody>
)}
{!isSettingsLoading && !savedAutoUpgrade && (
- <div className="flex min-h-65 items-center justify-center px-6 py-6 text-center system-sm-regular text-text-tertiary">
- {t(($) => $['api.actionFailed'], { ns: 'common' })}
- </div>
+ <DialogBody>
+ <div className="flex min-h-65 items-center justify-center text-center system-sm-regular text-text-tertiary">
+ {t(($) => $['api.actionFailed'], { ns: 'common' })}
+ </div>
+ </DialogBody>
)}
{savedAutoUpgrade && (
<UpdateSettingDialogForm
diff --git a/web/app/components/main-nav/components/help-menu/account-about-dialog.tsx b/web/app/components/main-nav/components/help-menu/account-about-dialog.tsx
index 0b2a8d493b4..f727e9bd842 100644
--- a/web/app/components/main-nav/components/help-menu/account-about-dialog.tsx
+++ b/web/app/components/main-nav/components/help-menu/account-about-dialog.tsx
@@ -2,8 +2,15 @@
import type { DeploymentEdition } from '@dify/contracts/api/console/system-features/types.gen'
import type { LangGeniusVersionInfo } from '@/context/app-context-types'
import { buttonVariants } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import dayjs from 'dayjs'
import { useTranslation } from 'react-i18next'
import { DifyLogo } from '@/app/components/base/logo/dify-logo'
@@ -28,22 +35,14 @@ export default function AccountAboutDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="overflow-hidden p-0 text-left">
- <DialogTitle className="sr-only">
- {t(($) => $['userProfile.about'], { ns: 'common' })}
- </DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="flex flex-col items-center gap-4 px-6 py-12">
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle className="sr-only">
+ {t(($) => $['userProfile.about'], { ns: 'common' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="flex flex-col items-center gap-4">
<DifyLogo alt="Dify" size="large" className="mx-auto" />
<div className="text-center system-xs-regular text-text-tertiary">
@@ -85,9 +84,9 @@ export default function AccountAboutDialog({
)}
</div>
</div>
- </div>
- <div className="flex flex-col gap-3 border-t border-divider-subtle px-6 py-4 sm:flex-row sm:items-center sm:justify-between">
- <div className="min-w-0 system-xs-medium text-text-tertiary">
+ </DialogBody>
+ <DialogFooter>
+ <div className="me-auto min-w-0 system-xs-medium text-text-tertiary">
{isLatest
? t(($) => $['about.latestAvailable'], {
ns: 'common',
@@ -98,27 +97,25 @@ export default function AccountAboutDialog({
version: langGeniusVersionInfo.latest_version,
})}
</div>
- <div className="flex shrink-0 items-center gap-2">
+ <Link
+ href="https://github.com/langgenius/dify/releases"
+ target="_blank"
+ rel="noopener noreferrer"
+ className={buttonVariants({ size: 'small' })}
+ >
+ {t(($) => $['about.changeLog'], { ns: 'common' })}
+ </Link>
+ {!isLatest && deploymentEdition === 'CLOUD' && (
<Link
- href="https://github.com/langgenius/dify/releases"
+ href={langGeniusVersionInfo.release_notes}
target="_blank"
rel="noopener noreferrer"
- className={buttonVariants({ size: 'small' })}
+ className={buttonVariants({ variant: 'primary', size: 'small' })}
>
- {t(($) => $['about.changeLog'], { ns: 'common' })}
+ {t(($) => $['about.updateNow'], { ns: 'common' })}
</Link>
- {!isLatest && deploymentEdition === 'CLOUD' && (
- <Link
- href={langGeniusVersionInfo.release_notes}
- target="_blank"
- rel="noopener noreferrer"
- className={buttonVariants({ variant: 'primary', size: 'small' })}
- >
- {t(($) => $['about.updateNow'], { ns: 'common' })}
- </Link>
- )}
- </div>
- </div>
+ )}
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/install-plugin/install-bundle/index.tsx b/web/app/components/plugins/install-plugin/install-bundle/index.tsx
index 0a59724c777..a518e11f430 100644
--- a/web/app/components/plugins/install-plugin/install-bundle/index.tsx
+++ b/web/app/components/plugins/install-plugin/install-bundle/index.tsx
@@ -2,8 +2,13 @@
import type { FC } from 'react'
import type { Dependency, InstallStatus, Plugin, VersionProps } from '../../types'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogClose, DialogContent } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogCloseButton,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import * as React from 'react'
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -69,29 +74,12 @@ const InstallBundle: FC<Props> = ({
>
<DialogContent
backdropProps={{ forceRender: true }}
- className={cn(
- 'w-full max-w-120 overflow-hidden! text-left align-middle',
- cn(
- modalClassName,
- 'flex max-h-[calc(100dvh-48px)] min-w-140 flex-col items-start rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0',
- ),
- )}
+ className={cn('w-120', modalClassName, 'max-h-[calc(100dvh-48px)] min-w-140')}
>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
-
- <div className="flex items-start gap-2 self-stretch pt-6 pr-14 pb-3 pl-6">
- <div className="self-stretch title-2xl-semi-bold text-text-primary">{getTitle()}</div>
- </div>
+ <DialogHeader>
+ <DialogTitle>{getTitle()}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
<ReadyToInstall
step={step}
onStepChange={setStep}
diff --git a/web/app/components/plugins/install-plugin/install-from-github/index.tsx b/web/app/components/plugins/install-plugin/install-from-github/index.tsx
index ff711629552..348d30bea6f 100644
--- a/web/app/components/plugins/install-plugin/install-from-github/index.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-github/index.tsx
@@ -3,10 +3,18 @@ import type { PluginCategoryEnum, PluginDeclaration, UpdateFromGitHubPayload } f
import type { InstallState } from '@/app/components/plugins/types'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import * as React from 'react'
import { useCallback, useRef, useState } from 'react'
@@ -192,37 +200,17 @@ const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({
<DialogContent
initialFocus={repoUrlInputRef}
backdropProps={{ forceRender: true }}
- className={cn(
- 'w-140 overflow-hidden! text-left align-middle',
- cn(
- modalClassName,
- 'flex max-h-[calc(100dvh-48px)] flex-col items-start rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0',
- ),
- )}
+ className={cn('w-140', modalClassName, 'max-h-[calc(100dvh-48px)]')}
>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
-
- <div className="flex shrink-0 items-start gap-2 self-stretch pt-6 pr-14 pb-3 pl-6">
- <div className="flex grow flex-col items-start gap-1">
- <DialogTitle className="self-stretch title-2xl-semi-bold text-text-primary">
- {getTitle()}
- </DialogTitle>
- <div className="self-stretch system-xs-regular text-text-tertiary">
- {!completedSteps.includes(state.step) &&
- t(($) => $['installFromGitHub.installNote'], { ns: 'plugin' })}
- </div>
- </div>
- </div>
+ <DialogHeader>
+ <DialogTitle>{getTitle()}</DialogTitle>
+ {!completedSteps.includes(state.step) && (
+ <DialogDescription>
+ {t(($) => $['installFromGitHub.installNote'], { ns: 'plugin' })}
+ </DialogDescription>
+ )}
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
{completedSteps.includes(state.step) ? (
<Installed
payload={manifest}
@@ -231,50 +219,46 @@ const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({
installContextCategory={installContextCategory}
onCancel={onClose}
/>
- ) : (
- <div
- className={`flex min-h-0 flex-1 flex-col items-start justify-center self-stretch overflow-y-auto px-6 py-3 ${state.step === InstallStepFromGitHub.installed ? 'gap-2' : 'gap-4'}`}
- >
- {state.step === InstallStepFromGitHub.setUrl && (
- <Form
- onFormSubmit={handleUrlSubmit}
- className="flex flex-col items-start gap-4 self-stretch"
+ ) : state.step === InstallStepFromGitHub.setUrl ? (
+ <Form onFormSubmit={handleUrlSubmit}>
+ <DialogBody>
+ <Field name="repoUrl" className="gap-4">
+ <FieldLabel className="flex w-full flex-col items-start justify-center p-0 text-text-secondary">
+ <span className="system-sm-semibold">
+ {t(($) => $['installFromGitHub.gitHubRepo'], { ns: 'plugin' })}
+ </span>
+ </FieldLabel>
+ <Input
+ ref={repoUrlInputRef}
+ type="text"
+ inputMode="url"
+ autoComplete="off"
+ spellCheck={false}
+ value={state.repoUrl}
+ onValueChange={(value) =>
+ setState((prevState) => ({ ...prevState, repoUrl: value }))
+ }
+ className="flex grow items-center gap-0.5 self-stretch overflow-hidden rounded-lg border-components-input-border-active bg-components-input-bg-active p-2 text-ellipsis"
+ placeholder="Please enter GitHub repo URL"
+ />
+ </Field>
+ </DialogBody>
+ <DialogFooter>
+ <Button variant="secondary" className="min-w-18" onClick={onClose}>
+ {t(($) => $['installModal.cancel'], { ns: 'plugin' })}
+ </Button>
+ <Button
+ variant="primary"
+ type="submit"
+ className="min-w-18"
+ disabled={!state.repoUrl.trim()}
>
- <Field name="repoUrl" className="gap-4 self-stretch">
- <FieldLabel className="flex w-full flex-col items-start justify-center p-0 text-text-secondary">
- <span className="system-sm-semibold">
- {t(($) => $['installFromGitHub.gitHubRepo'], { ns: 'plugin' })}
- </span>
- </FieldLabel>
- <Input
- ref={repoUrlInputRef}
- type="text"
- inputMode="url"
- autoComplete="off"
- spellCheck={false}
- value={state.repoUrl}
- onValueChange={(value) =>
- setState((prevState) => ({ ...prevState, repoUrl: value }))
- }
- className="flex grow items-center gap-0.5 self-stretch overflow-hidden rounded-lg border-components-input-border-active bg-components-input-bg-active p-2 text-ellipsis"
- placeholder="Please enter GitHub repo URL"
- />
- </Field>
- <div className="mt-4 flex items-center justify-end gap-2 self-stretch">
- <Button variant="secondary" className="min-w-18" onClick={onClose}>
- {t(($) => $['installModal.cancel'], { ns: 'plugin' })}
- </Button>
- <Button
- variant="primary"
- type="submit"
- className="min-w-18"
- disabled={!state.repoUrl.trim()}
- >
- {t(($) => $['installModal.next'], { ns: 'plugin' })}
- </Button>
- </div>
- </Form>
- )}
+ {t(($) => $['installModal.next'], { ns: 'plugin' })}
+ </Button>
+ </DialogFooter>
+ </Form>
+ ) : (
+ <DialogBody className="flex flex-col items-start gap-4">
{state.step === InstallStepFromGitHub.selectPackage && (
<SelectPackage
updatePayload={updatePayload!}
@@ -310,7 +294,7 @@ const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({
onFailed={handleFailed}
/>
)}
- </div>
+ </DialogBody>
)}
</DialogContent>
</Dialog>
diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx
index 229b962c496..85be31f8bae 100644
--- a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx
@@ -1,8 +1,13 @@
'use client'
import type { Dependency, PluginCategoryEnum, PluginDeclaration } from '../../types'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogCloseButton,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import * as React from 'react'
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -89,31 +94,12 @@ const InstallFromLocalPackage: React.FC<InstallFromLocalPackageProps> = ({
>
<DialogContent
backdropProps={{ forceRender: true }}
- className={cn(
- 'w-140 overflow-hidden! text-left align-middle',
- cn(
- modalClassName,
- 'flex max-h-[calc(100dvh-48px)] flex-col items-start rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0',
- ),
- )}
+ className={cn('w-140', modalClassName, 'max-h-[calc(100dvh-48px)]')}
>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
-
- <div className="flex shrink-0 items-start gap-2 self-stretch pt-6 pr-14 pb-3 pl-6">
- <DialogTitle className="self-stretch title-2xl-semi-bold text-text-primary">
- {getTitle()}
- </DialogTitle>
- </div>
+ <DialogHeader>
+ <DialogTitle>{getTitle()}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
{step === InstallStep.uploading && (
<Uploading
isBundle={isBundle}
diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx
index 1c99cc61673..76a913e2294 100644
--- a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx
@@ -88,17 +88,13 @@ const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({
<DialogContent
backdropProps={{ forceRender: true }}
className={cn(
- 'w-140 overflow-hidden! text-left align-middle',
- cn(
- modalClassName,
- 'flex max-h-[calc(100dvh-48px)] flex-col items-start rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0',
- ),
+ 'w-140 overflow-hidden',
+ modalClassName,
+ 'flex max-h-[calc(100dvh-48px)] flex-col items-start',
)}
>
<div className="flex shrink-0 items-start gap-2 self-stretch pt-6 pr-14 pb-3 pl-6">
- <DialogTitle className="self-stretch title-2xl-semi-bold text-text-primary">
- {getTitle()}
- </DialogTitle>
+ <DialogTitle className="self-stretch">{getTitle()}</DialogTitle>
</div>
{isBundle ? (
<ReadyToInstallBundle
diff --git a/web/app/components/plugins/marketplace/detail-dialog/frame.tsx b/web/app/components/plugins/marketplace/detail-dialog/frame.tsx
index 26a6b2e0fef..cf62ce30b91 100644
--- a/web/app/components/plugins/marketplace/detail-dialog/frame.tsx
+++ b/web/app/components/plugins/marketplace/detail-dialog/frame.tsx
@@ -1,14 +1,7 @@
'use client'
import { cn } from '@langgenius/dify-ui/cn'
-import {
- Dialog,
- DialogBackdrop,
- DialogClose,
- DialogPopup,
- DialogPortal,
- DialogTitle,
-} from '@langgenius/dify-ui/dialog'
+import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useEffect, useRef, useState } from 'react'
import { useTranslation } from '#i18n'
@@ -86,72 +79,69 @@ export default function MarketplaceDetailDialogFrame({
return (
<Dialog open={open} onOpenChange={handleOpenChange}>
- <DialogPortal>
- <DialogBackdrop />
- {/* Keep initial focus on the visible close control: while the iframe is
+ {/* Keep initial focus on the visible close control: while the iframe is
still loading it is inert, so default focus could otherwise land on
an invisible cross-origin frame. */}
- <DialogPopup
- initialFocus={closeButtonRef}
- className="fixed top-1/2 left-1/2 h-[min(800px,calc(100dvh-48px))] w-[min(1200px,calc(100vw-48px))] -translate-x-1/2 -translate-y-1/2 overflow-hidden border-0 p-0 shadow-xl"
+ <DialogContent
+ initialFocus={closeButtonRef}
+ className="h-[min(800px,calc(100dvh-48px))] max-h-none w-[min(1200px,calc(100vw-48px))] overflow-hidden"
+ >
+ <DialogTitle className="sr-only">{title}</DialogTitle>
+ <div
+ aria-hidden
+ className={cn(
+ 'absolute inset-0 bg-background-default transition-opacity',
+ isLoading ? 'opacity-100' : 'pointer-events-none opacity-0',
+ )}
>
- <DialogTitle className="sr-only">{title}</DialogTitle>
- <div
- aria-hidden
- className={cn(
- 'absolute inset-0 bg-background-default transition-opacity',
- isLoading ? 'opacity-100' : 'pointer-events-none opacity-0',
- )}
- >
- <div className="flex h-[52px] items-center px-6">
- <div className="h-4 w-40 animate-pulse rounded-md bg-state-base-hover motion-reduce:animate-none" />
+ <div className="flex h-[52px] items-center px-6">
+ <div className="h-4 w-40 animate-pulse rounded-md bg-state-base-hover motion-reduce:animate-none" />
+ </div>
+ <div className="mx-auto flex w-full max-w-[1000px] gap-8 px-12 py-8">
+ <div className="flex flex-1 flex-col gap-4">
+ <div className="h-16 w-2/3 animate-pulse rounded-xl bg-state-base-hover motion-reduce:animate-none" />
+ <div className="h-4 w-full animate-pulse rounded-md bg-state-base-hover motion-reduce:animate-none" />
+ <div className="h-4 w-5/6 animate-pulse rounded-md bg-state-base-hover motion-reduce:animate-none" />
+ <div className="mt-8 h-72 w-full animate-pulse rounded-xl bg-state-base-hover motion-reduce:animate-none" />
</div>
- <div className="mx-auto flex w-full max-w-[1000px] gap-8 px-12 py-8">
- <div className="flex flex-1 flex-col gap-4">
- <div className="h-16 w-2/3 animate-pulse rounded-xl bg-state-base-hover motion-reduce:animate-none" />
- <div className="h-4 w-full animate-pulse rounded-md bg-state-base-hover motion-reduce:animate-none" />
- <div className="h-4 w-5/6 animate-pulse rounded-md bg-state-base-hover motion-reduce:animate-none" />
- <div className="mt-8 h-72 w-full animate-pulse rounded-xl bg-state-base-hover motion-reduce:animate-none" />
- </div>
- <div className="hidden w-60 flex-col gap-4 lg:flex">
- <div className="h-24 animate-pulse rounded-xl bg-state-base-hover motion-reduce:animate-none" />
- <div className="h-52 animate-pulse rounded-xl bg-state-base-hover motion-reduce:animate-none" />
- </div>
+ <div className="hidden w-60 flex-col gap-4 lg:flex">
+ <div className="h-24 animate-pulse rounded-xl bg-state-base-hover motion-reduce:animate-none" />
+ <div className="h-52 animate-pulse rounded-xl bg-state-base-hover motion-reduce:animate-none" />
</div>
</div>
- <iframe
- ref={iframeRef}
- // While loading, remove the invisible frame from focus, pointer,
- // and accessibility interaction until its content is presentable.
- inert={isLoading}
- allow="clipboard-write"
- className={cn(
- 'size-full border-0 bg-background-default transition-opacity',
- isLoading ? 'pointer-events-none opacity-0' : 'opacity-100',
- )}
- onLoad={() => setIsLoading(false)}
- referrerPolicy="strict-origin-when-cross-origin"
- src={src}
- title={title}
- />
- {/* The image preview lives inside a different document, so its
- backdrop cannot cover this host control through z-index. */}
- {!imagePreview.open && (
- <DialogClose
- render={
- <IconButton
- ref={closeButtonRef}
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5 z-10"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
+ </div>
+ <iframe
+ ref={iframeRef}
+ // While loading, remove the invisible frame from focus, pointer,
+ // and accessibility interaction until its content is presentable.
+ inert={isLoading}
+ allow="clipboard-write"
+ className={cn(
+ 'size-full border-0 bg-background-default transition-opacity',
+ isLoading ? 'pointer-events-none opacity-0' : 'opacity-100',
)}
- </DialogPopup>
- </DialogPortal>
+ onLoad={() => setIsLoading(false)}
+ referrerPolicy="strict-origin-when-cross-origin"
+ src={src}
+ title={title}
+ />
+ {/* The image preview lives inside a different document, so its
+ backdrop cannot cover this host control through z-index. */}
+ {!imagePreview.open && (
+ <DialogClose
+ render={
+ <IconButton
+ ref={closeButtonRef}
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ size="lg"
+ className="absolute top-5 right-5 z-10"
+ >
+ <span aria-hidden className="i-ri-close-line size-4" />
+ </IconButton>
+ }
+ />
+ )}
+ </DialogContent>
</Dialog>
)
}
diff --git a/web/app/components/plugins/plugin-auth/authorize/__tests__/api-key-modal.spec.tsx b/web/app/components/plugins/plugin-auth/authorize/__tests__/api-key-modal.spec.tsx
index 1ddbb3f9dd4..2d0451a5644 100644
--- a/web/app/components/plugins/plugin-auth/authorize/__tests__/api-key-modal.spec.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/__tests__/api-key-modal.spec.tsx
@@ -70,6 +70,7 @@ vi.mock('../../../readme-panel/entrance', () => ({
vi.mock('@/app/components/base/encrypted-bottom', () => ({
EncryptedBottom: () => <div data-testid="encrypted-bottom" />,
+ EncryptedFooter: ({ children }: { children: React.ReactNode }) => <>{children}</>,
}))
vi.mock('@/app/components/base/form/form-scenarios/auth', () => {
diff --git a/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx b/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx
index 5e88d4221aa..1016daf3d45 100644
--- a/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx
@@ -2,11 +2,19 @@ import type { PluginPayload } from '../types'
import type { FormRefObject, FormSchema } from '@/app/components/base/form/types'
import type { CredentialPermission } from '@/models/permission'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { memo, useCallback, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { EncryptedBottom } from '@/app/components/base/encrypted-bottom'
+import { EncryptedBottom, EncryptedFooter } from '@/app/components/base/encrypted-bottom'
import AuthForm from '@/app/components/base/form/form-scenarios/auth'
import { FormTypeEnum } from '@/app/components/base/form/types'
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
@@ -147,88 +155,63 @@ const ApiKeyModal = ({
return (
<Dialog open={open} onOpenChange={handleOpenChange}>
- <DialogContent
- backdropProps={{ forceRender: true }}
- className="w-160! max-w-[calc(100vw-2rem)]! p-0!"
- >
- <div data-testid="modal" className="flex max-h-[80dvh] flex-col">
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['auth.useApiAuth'], { ns: 'plugin' })}
- </DialogTitle>
- <div className="mt-1 system-xs-regular text-text-tertiary">
- {t(($) => $['auth.useApiAuthDesc'], { ns: 'plugin' })}
+ <DialogContent backdropProps={{ forceRender: true }} className="w-160">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['auth.useApiAuth'], { ns: 'plugin' })}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $['auth.useApiAuthDesc'], { ns: 'plugin' })}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ {pluginPayload.detail && (
+ <ReadmeEntrance pluginDetail={pluginPayload.detail} presentation="dialog" />
+ )}
+ {isLoading && (
+ <div className="flex h-40 items-center justify-center">
+ <LoadingPlaceholder />
</div>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
+ )}
+ {!isLoading && !!mergedData.length && (
+ <AuthForm
+ ref={formRef}
+ formSchemas={formSchemas}
+ defaultValues={editValues || defaultValues}
+ disabled={disabled}
/>
- </div>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
- {pluginPayload.detail && (
- <ReadmeEntrance pluginDetail={pluginPayload.detail} presentation="dialog" />
- )}
- {isLoading && (
- <div className="flex h-40 items-center justify-center">
- <LoadingPlaceholder />
+ )}
+ {!isLoading && !editValues && (
+ <div className="mt-4 px-1">
+ <div className="mb-1 system-sm-semibold text-text-secondary">
+ {t(($) => $['auth.whoCanUse'], { ns: 'plugin' })}
</div>
- )}
- {!isLoading && !!mergedData.length && (
- <AuthForm
- ref={formRef}
- formSchemas={formSchemas}
- defaultValues={editValues || defaultValues}
+ <PermissionSelector
disabled={disabled}
+ permission={permission}
+ onChange={setPermission}
/>
- )}
- {!isLoading && !editValues && (
- <div className="mt-4 px-1">
- <div className="mb-1 system-sm-semibold text-text-secondary">
- {t(($) => $['auth.whoCanUse'], { ns: 'plugin' })}
- </div>
- <PermissionSelector
- disabled={disabled}
- permission={permission}
- onChange={setPermission}
- />
- </div>
- )}
- </div>
- <div className="flex shrink-0 justify-between p-6 pt-5">
- <div />
- <div className="flex items-center">
- {editValues && (
- <>
- <Button variant="primary" onClick={onRemove} disabled={isDisabled}>
- {t(($) => $['operation.remove'], { ns: 'common' })}
- </Button>
- <div className="mx-3 h-4 w-px bg-divider-regular"></div>
- </>
- )}
- <Button onClick={() => handleOpenChange(false)} disabled={isDisabled}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <Button
- className="ml-2"
- variant="primary"
- onClick={handleConfirm}
- disabled={isDisabled}
- >
- {t(($) => $['operation.save'], { ns: 'common' })}
- </Button>
</div>
- </div>
- <div className="shrink-0">
- <EncryptedBottom />
- </div>
- </div>
+ )}
+ </DialogBody>
+ <EncryptedFooter>
+ <DialogFooter>
+ {editValues && (
+ <>
+ <Button variant="primary" onClick={onRemove} disabled={isDisabled}>
+ {t(($) => $['operation.remove'], { ns: 'common' })}
+ </Button>
+ <div className="mx-1 h-4 w-px bg-divider-regular"></div>
+ </>
+ )}
+ <Button onClick={() => handleOpenChange(false)} disabled={isDisabled}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <Button variant="primary" onClick={handleConfirm} disabled={isDisabled}>
+ {t(($) => $['operation.save'], { ns: 'common' })}
+ </Button>
+ </DialogFooter>
+ <EncryptedBottom />
+ </EncryptedFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx b/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx
index 3124c189a27..9b78d34a75e 100644
--- a/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx
@@ -1,8 +1,15 @@
import type { PluginPayload } from '../types'
import type { FormRefObject, FormSchema } from '@/app/components/base/form/types'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useForm, useStore } from '@tanstack/react-form'
import { memo, useCallback, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -142,75 +149,45 @@ const OAuthClientSettings = ({
return (
<Dialog open={open} disablePointerDismissal onOpenChange={handleOpenChange}>
- <DialogContent
- backdropProps={{ forceRender: true }}
- className="w-120! max-w-[calc(100vw-2rem)]! p-0!"
- >
- <div data-testid="modal" className="flex max-h-[80dvh] flex-col">
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['auth.oauthClientSettings'], { ns: 'plugin' })}
- </DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- </div>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-3 pt-0">
- {pluginPayload.detail && (
- <ReadmeEntrance pluginDetail={pluginPayload.detail} presentation="dialog" />
- )}
- <AuthForm
- formFromProps={form}
- ref={formRef}
- formSchemas={schemas}
- defaultValues={editValues || defaultValues}
- disabled={disabled}
- />
- </div>
- <div className="flex shrink-0 justify-between p-6 pt-5">
- <div>
- {__oauth_client__ === 'custom' && hasOriginalClientParams && (
- <Button
- variant="secondary"
- className="text-components-button-destructive-secondary-text"
- disabled={isDisabled || !editValues}
- onClick={handleRemove}
- >
- {t(($) => $['operation.remove'], { ns: 'common' })}
- </Button>
- )}
- </div>
- <div className="flex items-center">
- <Button
- variant="secondary"
- onClick={() => handleOpenChange(false)}
- disabled={isDisabled}
- >
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <div className="mx-3 h-4 w-px bg-divider-regular"></div>
- <Button onClick={handleConfirm} disabled={isDisabled}>
- {t(($) => $['auth.saveOnly'], { ns: 'plugin' })}
- </Button>
- <Button
- className="ml-2"
- variant="primary"
- onClick={handleConfirmAndAuthorize}
- disabled={isDisabled}
- >
- {t(($) => $['auth.saveAndAuth'], { ns: 'plugin' })}
- </Button>
- </div>
- </div>
- </div>
+ <DialogContent backdropProps={{ forceRender: true }}>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['auth.oauthClientSettings'], { ns: 'plugin' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ {pluginPayload.detail && (
+ <ReadmeEntrance pluginDetail={pluginPayload.detail} presentation="dialog" />
+ )}
+ <AuthForm
+ formFromProps={form}
+ ref={formRef}
+ formSchemas={schemas}
+ defaultValues={editValues || defaultValues}
+ disabled={disabled}
+ />
+ </DialogBody>
+ <DialogFooter>
+ {__oauth_client__ === 'custom' && hasOriginalClientParams && (
+ <Button
+ variant="secondary"
+ className="me-auto text-components-button-destructive-secondary-text"
+ disabled={isDisabled || !editValues}
+ onClick={handleRemove}
+ >
+ {t(($) => $['operation.remove'], { ns: 'common' })}
+ </Button>
+ )}
+ <Button variant="secondary" onClick={() => handleOpenChange(false)} disabled={isDisabled}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <div className="mx-1 h-4 w-px bg-divider-regular"></div>
+ <Button onClick={handleConfirm} disabled={isDisabled}>
+ {t(($) => $['auth.saveOnly'], { ns: 'plugin' })}
+ </Button>
+ <Button variant="primary" onClick={handleConfirmAndAuthorize} disabled={isDisabled}>
+ {t(($) => $['auth.saveAndAuth'], { ns: 'plugin' })}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/plugin-auth/authorize/oauth-visibility-dialog.tsx b/web/app/components/plugins/plugin-auth/authorize/oauth-visibility-dialog.tsx
index eaeddd93b69..cc14976c150 100644
--- a/web/app/components/plugins/plugin-auth/authorize/oauth-visibility-dialog.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/oauth-visibility-dialog.tsx
@@ -2,12 +2,14 @@ import type { CredentialPermission } from '@/models/permission'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
import PermissionSelector from './permission-selector'
@@ -37,44 +39,32 @@ const OAuthVisibilityDialog = ({
return (
<Dialog open={open} onOpenChange={handleOpenChange} disablePointerDismissal={loading}>
- <DialogContent className="w-120! max-w-[calc(100vw-2rem)]! p-0!">
- <div className="flex flex-col">
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['auth.whoCanUse'], { ns: 'plugin' })}
- </DialogTitle>
- <DialogDescription className="mt-1 system-xs-regular text-text-tertiary">
- {t(($) => $['auth.oauthCredentialPermissionDescription'], { ns: 'plugin' })}
- </DialogDescription>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- disabled={loading}
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- </div>
- <div className="px-6 py-3">
- <PermissionSelector
- disabled={loading}
- permission={permission}
- onChange={onPermissionChange}
- />
- </div>
- <div className="flex shrink-0 justify-end p-6 pt-5">
- <Button disabled={loading} onClick={() => handleOpenChange(false)}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <Button variant="primary" className="ml-2" loading={loading} onClick={onConfirm}>
- {t(($) => $['auth.authorize'], { ns: 'plugin' })}
- </Button>
- </div>
- </div>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['auth.whoCanUse'], { ns: 'plugin' })}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $['auth.oauthCredentialPermissionDescription'], { ns: 'plugin' })}
+ </DialogDescription>
+ <DialogCloseButton
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ disabled={loading}
+ />
+ </DialogHeader>
+ <DialogBody>
+ <PermissionSelector
+ disabled={loading}
+ permission={permission}
+ onChange={onPermissionChange}
+ />
+ </DialogBody>
+ <DialogFooter>
+ <Button disabled={loading} onClick={() => handleOpenChange(false)}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <Button variant="primary" loading={loading} onClick={onConfirm}>
+ {t(($) => $['auth.authorize'], { ns: 'plugin' })}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/common-modal.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/common-modal.spec.tsx
index 3a8e737be02..e09bd52ce72 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/common-modal.spec.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/common-modal.spec.tsx
@@ -251,6 +251,7 @@ vi.mock('@/app/components/base/form/components/base', async () => {
vi.mock('@/app/components/base/encrypted-bottom', () => ({
EncryptedBottom: () => <div data-testid="encrypted-bottom">Encrypted</div>,
+ EncryptedFooter: ({ children }: { children: React.ReactNode }) => <>{children}</>,
}))
vi.mock('../../log-viewer', () => ({
@@ -533,7 +534,7 @@ describe('CommonCreateModal', () => {
render(<CommonCreateModal {...defaultProps} />)
- expect(screen.getByTestId('modal')).toBeInTheDocument()
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
})
})
@@ -726,7 +727,7 @@ describe('CommonCreateModal', () => {
fireEvent.click(screen.getByTestId('modal-confirm'))
// Verify the modal is still rendered after error
- expect(screen.getByTestId('modal')).toBeInTheDocument()
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
})
it('should call refetch and onClose on successful create', async () => {
@@ -746,7 +747,7 @@ describe('CommonCreateModal', () => {
)
// Verify component renders with builder
- expect(screen.getByTestId('modal')).toBeInTheDocument()
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
})
})
@@ -1099,19 +1100,19 @@ describe('CommonCreateModal', () => {
it('should use md size for Manual method', () => {
render(<CommonCreateModal {...defaultProps} createType={SupportedCreationMethods.MANUAL} />)
- expect(screen.getByTestId('modal')).toHaveAttribute('data-size', 'md')
+ expect(screen.getByRole('dialog')).toHaveClass('w-160')
})
it('should use sm size for API Key method', () => {
render(<CommonCreateModal {...defaultProps} createType={SupportedCreationMethods.APIKEY} />)
- expect(screen.getByTestId('modal')).toHaveAttribute('data-size', 'sm')
+ expect(screen.getByRole('dialog')).not.toHaveClass('w-160')
})
it('should use sm size for OAuth method', () => {
render(<CommonCreateModal {...defaultProps} createType={SupportedCreationMethods.OAUTH} />)
- expect(screen.getByTestId('modal')).toHaveAttribute('data-size', 'sm')
+ expect(screen.getByRole('dialog')).not.toHaveClass('w-160')
})
})
@@ -1384,7 +1385,7 @@ describe('CommonCreateModal', () => {
)
// Component should render without errors even when getForm returns null
- expect(screen.getByTestId('modal')).toBeInTheDocument()
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
})
})
@@ -2046,7 +2047,7 @@ describe('CommonCreateModal', () => {
render(<CommonCreateModal {...defaultProps} />)
- expect(screen.getByTestId('modal')).toHaveAttribute('data-disabled', 'true')
+ expect(screen.getByTestId('modal-confirm')).toBeDisabled()
})
it('should show disabled state when building', () => {
@@ -2061,7 +2062,7 @@ describe('CommonCreateModal', () => {
/>,
)
- expect(screen.getByTestId('modal')).toHaveAttribute('data-disabled', 'true')
+ expect(screen.getByTestId('modal-confirm')).toBeDisabled()
})
})
@@ -2158,7 +2159,7 @@ describe('CommonCreateModal', () => {
)
// Component should render without errors
- expect(screen.getByTestId('modal')).toBeInTheDocument()
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
})
})
@@ -2186,7 +2187,7 @@ describe('CommonCreateModal', () => {
fireEvent.click(screen.getByTestId('modal-confirm'))
// Should still attempt to verify
- expect(screen.getByTestId('modal')).toBeInTheDocument()
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
})
})
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx
index d57cf3ad910..c1537cc0cdf 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx
@@ -2,10 +2,17 @@
import type { TriggerSubscriptionBuilder } from '@/app/components/workflow/block-selector/types'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useTranslation } from 'react-i18next'
-import { EncryptedBottom } from '@/app/components/base/encrypted-bottom'
+import { EncryptedBottom, EncryptedFooter } from '@/app/components/base/encrypted-bottom'
import { SupportedCreationMethods } from '@/app/components/plugins/types'
import { ConfigurationStepContent, MultiSteps, VerifyStepContent } from './components/modal-steps'
import {
@@ -27,10 +34,8 @@ export const CommonCreateModal = ({ open = true, onClose, createType, builder }:
<DialogContent
backdropProps={{ forceRender: true }}
className={cn(
- 'flex max-h-[80%] min-h-90 flex-col overflow-hidden p-0 shadow-xs',
- createType === SupportedCreationMethods.MANUAL
- ? 'w-160 max-w-[calc(100vw-2rem)]'
- : 'w-120 max-w-[calc(100vw-2rem)]',
+ 'max-h-[80%] min-h-90',
+ createType === SupportedCreationMethods.MANUAL && 'w-160',
)}
>
<CommonCreateModalContent createType={createType} builder={builder} onClose={onClose} />
@@ -67,33 +72,17 @@ function CommonCreateModalContent({ onClose, createType, builder }: Omit<Props,
const isVerifyStep = currentStep === ApiKeyStep.Verify
const isConfigurationStep = currentStep === ApiKeyStep.Configuration
const isDisabled = isVerifyingCredentials || isBuilding
- const modalSize = createType === SupportedCreationMethods.MANUAL ? 'md' : 'sm'
return (
- <div
- className="flex min-h-0 flex-1 flex-col"
- data-testid="modal"
- data-size={modalSize}
- data-disabled={isDisabled}
- >
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <>
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $[MODAL_TITLE_KEY_MAP[createType]], { ns: 'pluginTrigger' })}
</DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- </div>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
+ <DialogBody>
{isApiKeyType && <MultiSteps currentStep={currentStep} />}
{isVerifyStep && (
@@ -120,15 +109,14 @@ function CommonCreateModalContent({ onClose, createType, builder }: Omit<Props,
provider={detail?.provider || ''}
/>
)}
- </div>
+ </DialogBody>
- <div className="flex shrink-0 justify-end p-6 pt-5">
- <div className="flex items-center">
+ <EncryptedFooter>
+ <DialogFooter>
<Button disabled={isDisabled} onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
<Button
- className="ml-2"
variant="primary"
disabled={isDisabled}
data-testid="modal-confirm"
@@ -136,14 +124,9 @@ function CommonCreateModalContent({ onClose, createType, builder }: Omit<Props,
>
{confirmButtonText}
</Button>
- </div>
- </div>
-
- {isVerifyStep && (
- <div className="shrink-0">
- <EncryptedBottom />
- </div>
- )}
- </div>
+ </DialogFooter>
+ {isVerifyStep && <EncryptedBottom />}
+ </EncryptedFooter>
+ </>
)
}
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/oauth-client.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/oauth-client.tsx
index 8f0d5cfacb0..3690c06bb60 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/oauth-client.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/oauth-client.tsx
@@ -4,8 +4,15 @@ import type {
TriggerSubscriptionBuilder,
} from '@/app/components/workflow/block-selector/types'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { BaseForm } from '@/app/components/base/form/components/base'
@@ -67,103 +74,87 @@ export const OAuthClientSettingsModal = ({
return (
<Dialog open={open} disablePointerDismissal onOpenChange={onOpenChange}>
- <DialogContent backdropProps={{ forceRender: true }} className="p-0">
- <div data-testid="modal" className="flex max-h-[80dvh] flex-col">
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">{title}</DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
+ <DialogContent backdropProps={{ forceRender: true }}>
+ <DialogHeader>
+ <DialogTitle>{title}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="mb-2 system-sm-medium text-text-secondary">
+ {t(($) => $['subscription.addType.options.oauth.clientTitle'], {
+ ns: 'pluginTrigger',
+ })}
</div>
- <div data-testid="modal-content" className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
- <div className="mb-2 system-sm-medium text-text-secondary">
- {t(($) => $['subscription.addType.options.oauth.clientTitle'], {
- ns: 'pluginTrigger',
- })}
+
+ {oauthConfig?.system_configured && (
+ <div className="mb-4 flex w-full items-start justify-between gap-2">
+ {CLIENT_TYPE_OPTIONS.map((option) => (
+ <OptionCard
+ key={option}
+ title={t(($) => $[`subscription.addType.options.oauth.${option}`], {
+ ns: 'pluginTrigger',
+ })}
+ onSelect={() => setClientType(option)}
+ selected={clientType === option}
+ className="flex-1"
+ />
+ ))}
</div>
+ )}
- {oauthConfig?.system_configured && (
- <div className="mb-4 flex w-full items-start justify-between gap-2">
- {CLIENT_TYPE_OPTIONS.map((option) => (
- <OptionCard
- key={option}
- title={t(($) => $[`subscription.addType.options.oauth.${option}`], {
- ns: 'pluginTrigger',
- })}
- onSelect={() => setClientType(option)}
- selected={clientType === option}
- className="flex-1"
- />
- ))}
+ {showRedirectInfo && (
+ <div className="mb-4 flex items-start gap-3 rounded-xl bg-background-section-burn p-4">
+ <div className="rounded-lg border-[0.5px] border-components-card-border bg-components-card-bg p-2 shadow-xs shadow-shadow-shadow-3">
+ <span
+ aria-hidden="true"
+ className="i-ri-information-2-fill size-5 shrink-0 text-text-accent"
+ />
</div>
- )}
-
- {showRedirectInfo && (
- <div className="mb-4 flex items-start gap-3 rounded-xl bg-background-section-burn p-4">
- <div className="rounded-lg border-[0.5px] border-components-card-border bg-components-card-bg p-2 shadow-xs shadow-shadow-shadow-3">
- <span
- aria-hidden="true"
- className="i-ri-information-2-fill size-5 shrink-0 text-text-accent"
- />
+ <div className="min-w-0 flex-1 text-text-secondary">
+ <div className="system-sm-regular leading-4 whitespace-pre-wrap">
+ {t(($) => $['modal.oauthRedirectInfo'], { ns: 'pluginTrigger' })}
</div>
- <div className="min-w-0 flex-1 text-text-secondary">
- <div className="system-sm-regular leading-4 whitespace-pre-wrap">
- {t(($) => $['modal.oauthRedirectInfo'], { ns: 'pluginTrigger' })}
- </div>
- <div className="my-1.5 system-sm-medium leading-4 break-all">
- {oauthConfig?.redirect_uri}
- </div>
- <Button variant="secondary" size="small" onClick={handleCopyRedirectUri}>
- <span aria-hidden="true" className="i-ri-clipboard-line h-3.5 w-3.5" />
- {t(($) => $['operation.copy'], { ns: 'common' })}
- </Button>
+ <div className="my-1.5 system-sm-medium leading-4 break-all">
+ {oauthConfig?.redirect_uri}
</div>
- </div>
- )}
-
- {showClientForm && (
- <BaseForm
- formSchemas={oauthClientSchema}
- ref={clientFormRef}
- labelClassName="system-sm-medium mb-2 block text-text-secondary"
- formClassName="space-y-4"
- />
- )}
- </div>
- <div data-testid="modal-footer" className="flex shrink-0 justify-between p-6 pt-5">
- <div>
- {showRemoveButton && (
- <Button
- variant="secondary"
- className="text-components-button-destructive-secondary-text"
- onClick={handleRemove}
- >
- {t(($) => $['operation.remove'], { ns: 'common' })}
+ <Button variant="secondary" size="small" onClick={handleCopyRedirectUri}>
+ <span aria-hidden="true" className="i-ri-clipboard-line h-3.5 w-3.5" />
+ {t(($) => $['operation.copy'], { ns: 'common' })}
</Button>
- )}
- </div>
- <div className="flex items-center">
- <Button variant="secondary" onClick={closeModal}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <div className="mx-3 h-4 w-px bg-divider-regular"></div>
- <Button onClick={() => handleSave(false)}>
- {t(($) => $['auth.saveOnly'], { ns: 'plugin' })}
- </Button>
- <Button className="ml-2" variant="primary" onClick={() => handleSave(true)}>
- {confirmButtonText}
- </Button>
+ </div>
</div>
- </div>
- </div>
+ )}
+
+ {showClientForm && (
+ <BaseForm
+ formSchemas={oauthClientSchema}
+ ref={clientFormRef}
+ labelClassName="system-sm-medium mb-2 block text-text-secondary"
+ formClassName="space-y-4"
+ />
+ )}
+ </DialogBody>
+ <DialogFooter>
+ {showRemoveButton && (
+ <Button
+ variant="secondary"
+ className="me-auto text-components-button-destructive-secondary-text"
+ onClick={handleRemove}
+ >
+ {t(($) => $['operation.remove'], { ns: 'common' })}
+ </Button>
+ )}
+ <Button variant="secondary" onClick={closeModal}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <div className="mx-1 h-4 w-px bg-divider-regular"></div>
+ <Button onClick={() => handleSave(false)}>
+ {t(($) => $['auth.saveOnly'], { ns: 'plugin' })}
+ </Button>
+ <Button variant="primary" onClick={() => handleSave(true)}>
+ {confirmButtonText}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/index.spec.tsx
index 984786c17d1..cee20155d1b 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/index.spec.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/index.spec.tsx
@@ -1,3 +1,4 @@
+import type { ReactNode } from 'react'
import type { PluginDetail } from '@/app/components/plugins/types'
import type { TriggerSubscription } from '@/app/components/workflow/block-selector/types'
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
@@ -122,6 +123,7 @@ vi.mock('@/app/components/plugins/readme-panel/entrance', () => ({
vi.mock('@/app/components/base/encrypted-bottom', () => ({
EncryptedBottom: () => <div data-testid="encrypted-bottom">EncryptedBottom</div>,
+ EncryptedFooter: ({ children }: { children: ReactNode }) => <>{children}</>,
}))
// Form values storage keyed by form identifier
@@ -328,7 +330,7 @@ describe('Edit Modal Components', () => {
subscription={createSubscription({ credential_type: type })}
/>,
)
- expect(screen.getByTestId('modal')).toBeInTheDocument()
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
})
it('should render nothing for unknown credential type', () => {
@@ -1003,7 +1005,6 @@ describe('Edit Modal Components', () => {
it('should render EncryptedBottom in credentials step', () => {
render(<ApiKeyEditModal {...createProps()} />)
- expect(screen.getByTestId('modal-bottom-slot')).toBeInTheDocument()
expect(screen.getByTestId('encrypted-bottom')).toBeInTheDocument()
})
@@ -1182,7 +1183,7 @@ describe('Edit Modal Components', () => {
render(<ApiKeyEditModal {...createProps()} />)
fireEvent.click(getConfirmButton())
await waitFor(() => {
- expect(screen.queryByTestId('modal-bottom-slot')).not.toBeInTheDocument()
+ expect(screen.queryByTestId('encrypted-bottom')).not.toBeInTheDocument()
})
})
@@ -1600,7 +1601,7 @@ describe('Edit Modal Components', () => {
mockPluginStoreDetail.declaration.trigger.subscription_constructor.credentials_schema = []
render(<ApiKeyEditModal {...createProps()} />)
// Should still show the modal but no credentials form fields
- expect(screen.getByTestId('modal')).toBeInTheDocument()
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
})
})
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx
index 6ec599cc54f..abb481a7966 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx
@@ -3,12 +3,19 @@ import type { FormRefObject, FormSchema } from '@/app/components/base/form/types
import type { ParametersSchema, PluginDetail } from '@/app/components/plugins/types'
import type { TriggerSubscription } from '@/app/components/workflow/block-selector/types'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { isEqual } from 'es-toolkit/predicate'
import { useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { EncryptedBottom } from '@/app/components/base/encrypted-bottom'
+import { EncryptedBottom, EncryptedFooter } from '@/app/components/base/encrypted-bottom'
import { BaseForm } from '@/app/components/base/form/components/base'
import { FormTypeEnum } from '@/app/components/base/form/types'
import { ReadmeEntrance } from '@/app/components/plugins/readme-panel/entrance'
@@ -321,94 +328,67 @@ export const ApiKeyEditModal = ({ onClose, subscription, pluginDetail }: Props)
if (!open) onClose()
}}
>
- <DialogContent backdropProps={{ forceRender: true }} className="p-0">
- <div
- data-testid="modal"
- data-title={title}
- data-disabled={isDisabled}
- className="flex max-h-[80dvh] flex-col"
- >
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">{title}</DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- </div>
- <div data-testid="modal-content" className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
- {pluginDetail && <ReadmeEntrance pluginDetail={pluginDetail} presentation="dialog" />}
-
- <MultiSteps currentStep={currentStep} onStepClick={handleBack} />
-
- {currentStep === EditStep.EditCredentials ? (
- <div className="mb-4">
- {credentialsFormSchemas.length > 0 && (
- <BaseForm
- formSchemas={credentialsFormSchemas}
- ref={credentialsFormRef}
- labelClassName="system-sm-medium mb-2 flex items-center gap-1 text-text-primary"
- formClassName="space-y-4"
- preventDefaultSubmit={true}
- />
- )}
- </div>
- ) : (
- <div className="max-h-[70vh]">
+ <DialogContent backdropProps={{ forceRender: true }}>
+ <DialogHeader>
+ <DialogTitle>{title}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ {pluginDetail && <ReadmeEntrance pluginDetail={pluginDetail} presentation="dialog" />}
+
+ <MultiSteps currentStep={currentStep} onStepClick={handleBack} />
+
+ {currentStep === EditStep.EditCredentials ? (
+ <div className="mb-4">
+ {credentialsFormSchemas.length > 0 && (
<BaseForm
- formSchemas={basicFormSchemas}
- ref={basicFormRef}
+ formSchemas={credentialsFormSchemas}
+ ref={credentialsFormRef}
labelClassName="system-sm-medium mb-2 flex items-center gap-1 text-text-primary"
- formClassName="space-y-4 mb-4"
+ formClassName="space-y-4"
+ preventDefaultSubmit={true}
/>
-
- {parametersFormSchemas.length > 0 && (
- <BaseForm
- formSchemas={parametersFormSchemas}
- ref={parametersFormRef}
- labelClassName="system-sm-medium mb-2 flex items-center gap-1 text-text-primary"
- formClassName="space-y-4"
- />
- )}
- </div>
- )}
- </div>
- <div className="flex shrink-0 justify-between p-6 pt-5">
- <div />
- <div className="flex items-center">
- {currentStep === EditStep.EditConfiguration && (
- <>
- <Button variant="secondary" onClick={handleBack} disabled={isDisabled}>
- {t(($) => $['modal.common.back'], { ns: 'pluginTrigger' })}
- </Button>
- <div className="mx-3 h-4 w-px bg-divider-regular"></div>
- </>
)}
- <Button onClick={onClose} disabled={isDisabled}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <Button
- className="ml-2"
- variant="primary"
- onClick={handleConfirm}
- disabled={isDisabled}
- >
- {confirmButtonText}
- </Button>
</div>
- </div>
- {currentStep === EditStep.EditCredentials && (
- <div data-testid="modal-bottom-slot" className="shrink-0">
- <EncryptedBottom />
+ ) : (
+ <div className="max-h-[70vh]">
+ <BaseForm
+ formSchemas={basicFormSchemas}
+ ref={basicFormRef}
+ labelClassName="system-sm-medium mb-2 flex items-center gap-1 text-text-primary"
+ formClassName="space-y-4 mb-4"
+ />
+
+ {parametersFormSchemas.length > 0 && (
+ <BaseForm
+ formSchemas={parametersFormSchemas}
+ ref={parametersFormRef}
+ labelClassName="system-sm-medium mb-2 flex items-center gap-1 text-text-primary"
+ formClassName="space-y-4"
+ />
+ )}
</div>
)}
- </div>
+ </DialogBody>
+ <EncryptedFooter>
+ <DialogFooter>
+ {currentStep === EditStep.EditConfiguration && (
+ <>
+ <Button variant="secondary" onClick={handleBack} disabled={isDisabled}>
+ {t(($) => $['modal.common.back'], { ns: 'pluginTrigger' })}
+ </Button>
+ <div className="mx-1 h-4 w-px bg-divider-regular"></div>
+ </>
+ )}
+ <Button onClick={onClose} disabled={isDisabled}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <Button variant="primary" onClick={handleConfirm} disabled={isDisabled}>
+ {confirmButtonText}
+ </Button>
+ </DialogFooter>
+ {currentStep === EditStep.EditCredentials && <EncryptedBottom />}
+ </EncryptedFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx
index 4f0bf5eb6b2..681f86da946 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx
@@ -3,8 +3,15 @@ import type { FormRefObject, FormSchema } from '@/app/components/base/form/types
import type { ParametersSchema, PluginDetail } from '@/app/components/plugins/types'
import type { TriggerSubscription } from '@/app/components/workflow/block-selector/types'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { isEqual } from 'es-toolkit/predicate'
import { useMemo, useRef } from 'react'
import { useTranslation } from 'react-i18next'
@@ -142,53 +149,28 @@ export const ManualEditModal = ({ onClose, subscription, pluginDetail }: Props)
if (!open) onClose()
}}
>
- <DialogContent backdropProps={{ forceRender: true }} className="p-0">
- <div
- data-testid="modal"
- data-title={title}
- data-disabled={isUpdating}
- className="flex max-h-[80dvh] flex-col"
- >
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">{title}</DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- </div>
- <div data-testid="modal-content" className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
- {pluginDetail && <ReadmeEntrance pluginDetail={pluginDetail} presentation="dialog" />}
- <BaseForm
- formSchemas={formSchemas}
- ref={formRef}
- labelClassName="system-sm-medium mb-2 flex items-center gap-1 text-text-primary"
- formClassName="space-y-4"
- />
- </div>
- <div className="flex shrink-0 justify-between p-6 pt-5">
- <div />
- <div className="flex items-center">
- <Button onClick={onClose} disabled={isUpdating}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <Button
- className="ml-2"
- variant="primary"
- onClick={handleConfirm}
- disabled={isUpdating}
- >
- {confirmButtonText}
- </Button>
- </div>
- </div>
- </div>
+ <DialogContent backdropProps={{ forceRender: true }}>
+ <DialogHeader>
+ <DialogTitle>{title}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ {pluginDetail && <ReadmeEntrance pluginDetail={pluginDetail} presentation="dialog" />}
+ <BaseForm
+ formSchemas={formSchemas}
+ ref={formRef}
+ labelClassName="system-sm-medium mb-2 flex items-center gap-1 text-text-primary"
+ formClassName="space-y-4"
+ />
+ </DialogBody>
+ <DialogFooter>
+ <Button onClick={onClose} disabled={isUpdating}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <Button variant="primary" onClick={handleConfirm} disabled={isUpdating}>
+ {confirmButtonText}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx
index 139909db167..05ad9b54b89 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx
@@ -3,8 +3,15 @@ import type { FormRefObject, FormSchema } from '@/app/components/base/form/types
import type { ParametersSchema, PluginDetail } from '@/app/components/plugins/types'
import type { TriggerSubscription } from '@/app/components/workflow/block-selector/types'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { isEqual } from 'es-toolkit/predicate'
import { useMemo, useRef } from 'react'
import { useTranslation } from 'react-i18next'
@@ -167,53 +174,28 @@ export const OAuthEditModal = ({ onClose, subscription, pluginDetail }: Props) =
if (!open) onClose()
}}
>
- <DialogContent backdropProps={{ forceRender: true }} className="p-0">
- <div
- data-testid="modal"
- data-title={title}
- data-disabled={isUpdating}
- className="flex max-h-[80dvh] flex-col"
- >
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">{title}</DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- </div>
- <div data-testid="modal-content" className="min-h-0 flex-1 overflow-y-auto px-6 py-3">
- {pluginDetail && <ReadmeEntrance pluginDetail={pluginDetail} presentation="dialog" />}
- <BaseForm
- formSchemas={formSchemas}
- ref={formRef}
- labelClassName="system-sm-medium mb-2 flex items-center gap-1 text-text-primary"
- formClassName="space-y-4"
- />
- </div>
- <div className="flex shrink-0 justify-between p-6 pt-5">
- <div />
- <div className="flex items-center">
- <Button onClick={onClose} disabled={isUpdating}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <Button
- className="ml-2"
- variant="primary"
- onClick={handleConfirm}
- disabled={isUpdating}
- >
- {confirmButtonText}
- </Button>
- </div>
- </div>
- </div>
+ <DialogContent backdropProps={{ forceRender: true }}>
+ <DialogHeader>
+ <DialogTitle>{title}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ {pluginDetail && <ReadmeEntrance pluginDetail={pluginDetail} presentation="dialog" />}
+ <BaseForm
+ formSchemas={formSchemas}
+ ref={formRef}
+ labelClassName="system-sm-medium mb-2 flex items-center gap-1 text-text-primary"
+ formClassName="space-y-4"
+ />
+ </DialogBody>
+ <DialogFooter>
+ <Button onClick={onClose} disabled={isUpdating}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <Button variant="primary" onClick={handleConfirm} disabled={isUpdating}>
+ {confirmButtonText}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/schema-dialog.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/schema-dialog.tsx
index 74e11de8536..bb1767334f5 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/schema-dialog.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/schema-dialog.tsx
@@ -3,8 +3,9 @@ import type { Field } from '@/app/components/workflow/nodes/llm/types'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogCloseButton,
DialogContent,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
@@ -62,23 +63,13 @@ export function SchemaDialog({ schema, rootName, compact = false }: SchemaDialog
return (
<Dialog>
{entry}
- <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-240 min-w-0 flex-col overflow-hidden p-0">
- <div className="relative shrink-0 p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-240 min-w-0 flex-col overflow-hidden">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['nodes.agent.parameterSchema'], { ns: 'workflowAgent' })}
</DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- >
- <span aria-hidden className="i-ri-close-line size-4.5" />
- </IconButton>
- }
- />
- </div>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
<div className="min-h-0 overflow-y-auto px-6 pt-2 pb-6">
<MittProvider>
<VisualEditorContextProvider>
diff --git a/web/app/components/plugins/plugin-mutation-model/index.tsx b/web/app/components/plugins/plugin-mutation-model/index.tsx
index 346a1237bd0..2ea80fe3ce9 100644
--- a/web/app/components/plugins/plugin-mutation-model/index.tsx
+++ b/web/app/components/plugins/plugin-mutation-model/index.tsx
@@ -2,8 +2,15 @@ import type { UseMutationResult } from '@tanstack/react-query'
import type { FC, ReactNode } from 'react'
import type { Plugin } from '../types'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import * as React from 'react'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
@@ -43,38 +50,29 @@ const PluginMutationModal: FC<Props> = ({
if (!open) onCancel()
}}
>
- <DialogContent className="w-full min-w-140 overflow-hidden! border-none text-left align-middle">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="title-2xl-semi-bold text-text-primary">{modelTitle}</DialogTitle>
-
- <div className="mt-3 mb-2 system-md-regular text-text-secondary">{description}</div>
- <div className="flex flex-wrap content-start items-start gap-1 self-stretch rounded-2xl bg-background-section-burn p-2">
- <Card
- installed={mutation.isSuccess}
- payload={plugin}
- className="w-full"
- titleLeft={cardTitleLeft}
- />
- </div>
- <div className="flex items-center gap-2 self-stretch pt-5">
- <div>{modalBottomLeft}</div>
- <div className="ml-auto flex gap-2">
- {!mutation.isPending && <Button onClick={onCancel}>{cancelButtonText}</Button>}
- <Button variant="primary" loading={mutation.isPending} onClick={mutate}>
- {confirmButtonText}
- </Button>
+ <DialogContent className="w-full min-w-140">
+ <DialogHeader>
+ <DialogTitle>{modelTitle}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="mb-2 system-md-regular text-text-secondary">{description}</div>
+ <div className="flex flex-wrap content-start items-start gap-1 self-stretch rounded-2xl bg-background-section-burn p-2">
+ <Card
+ installed={mutation.isSuccess}
+ payload={plugin}
+ className="w-full"
+ titleLeft={cardTitleLeft}
+ />
</div>
- </div>
+ </DialogBody>
+ <DialogFooter>
+ <div className="me-auto">{modalBottomLeft}</div>
+ {!mutation.isPending && <Button onClick={onCancel}>{cancelButtonText}</Button>}
+ <Button variant="primary" loading={mutation.isPending} onClick={mutate}>
+ {confirmButtonText}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/plugin-page/plugin-info.tsx b/web/app/components/plugins/plugin-page/plugin-info.tsx
index b60bea8e945..dfe9d8327d6 100644
--- a/web/app/components/plugins/plugin-page/plugin-info.tsx
+++ b/web/app/components/plugins/plugin-page/plugin-info.tsx
@@ -1,7 +1,13 @@
'use client'
import type { FC } from 'react'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import KeyValueItem from '../base/key-value-item'
@@ -25,23 +31,12 @@ const PlugInfo: FC<Props> = ({ repository, release, packageName, onHide }) => {
if (!open) onHide()
}}
>
- <DialogContent className="w-full max-w-120! overflow-hidden! border-none text-left align-middle">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $[`${i18nPrefix}.title`], { ns: 'plugin' })}
- </DialogTitle>
-
- <div className="mt-5 space-y-3">
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $[`${i18nPrefix}.title`], { ns: 'plugin' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="space-y-3">
{repository && (
<KeyValueItem
label={t(($) => $[`${i18nPrefix}.repository`], { ns: 'plugin' })}
@@ -64,7 +59,7 @@ const PlugInfo: FC<Props> = ({ repository, release, packageName, onHide }) => {
value={packageName}
/>
)}
- </div>
+ </DialogBody>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/plugins/readme-panel/dialog.tsx b/web/app/components/plugins/readme-panel/dialog.tsx
index 1215455dd64..a7ab7e1c4a8 100644
--- a/web/app/components/plugins/readme-panel/dialog.tsx
+++ b/web/app/components/plugins/readme-panel/dialog.tsx
@@ -17,11 +17,14 @@ export function ReadmeDialog({ detail, open, onOpenChange, triggerId }: ReadmeDi
return (
<Dialog open={open} onOpenChange={onOpenChange} triggerId={triggerId}>
- <DialogContent className="h-[calc(100dvh-16px)] w-full max-w-200 overflow-hidden p-0">
+ <DialogContent className="h-[calc(100dvh-16px)] w-full max-w-200 overflow-hidden">
<ReadmePanelContent
detail={detail}
title={
- <DialogTitle className="truncate text-xs font-medium text-text-tertiary uppercase">
+ <DialogTitle
+ // oxlint-disable-next-line shadcn/no-restyle -- README panel title is a section label in the panel header.
+ className="truncate text-xs font-medium text-text-tertiary uppercase"
+ >
{t(($) => $['readmeInfo.title'], { ns: 'plugin' })}
</DialogTitle>
}
diff --git a/web/app/components/plugins/update-plugin/from-market-place.tsx b/web/app/components/plugins/update-plugin/from-market-place.tsx
index 19cfd5dca40..533353dbd3f 100644
--- a/web/app/components/plugins/update-plugin/from-market-place.tsx
+++ b/web/app/components/plugins/update-plugin/from-market-place.tsx
@@ -2,8 +2,15 @@
import type { UpdateFromMarketPlacePayload } from '../types'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import * as React from 'react'
import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -148,58 +155,55 @@ const UpdatePluginModal = ({
<Dialog open onOpenChange={() => onCancel()}>
<DialogContent
backdropProps={{ forceRender: true }}
- className={cn('min-w-140', doShowDowngradeWarningModal && 'min-w-160')}
+ className={cn('min-w-140', doShowDowngradeWarningModal && 'min-w-160 p-6')}
>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
{doShowDowngradeWarningModal && (
- <DowngradeWarningModal
- onCancel={onCancel}
- onJustDowngrade={handleConfirm}
- onExcludeAndDowngrade={handleExcludeAndDownload}
- />
+ <>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ <DowngradeWarningModal
+ onCancel={onCancel}
+ onJustDowngrade={handleConfirm}
+ onExcludeAndDowngrade={handleExcludeAndDownload}
+ />
+ </>
)}
{!doShowDowngradeWarningModal && (
<>
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(
- ($) =>
- $[
- `${i18nPrefix}.${uploadStep === UploadStep.installed ? 'successfulTitle' : 'title'}`
- ],
- { ns: 'plugin' },
- )}
- </DialogTitle>
- <div className="mt-3 mb-2 system-md-regular text-text-secondary">
- {t(($) => $[`${i18nPrefix}.description`], { ns: 'plugin' })}
- </div>
- <div className="flex flex-wrap content-start items-start gap-1 self-stretch rounded-2xl bg-background-section-burn p-2">
- <Card
- installed={uploadStep === UploadStep.installed}
- payload={pluginManifestToCardPluginProps({
- ...originalPackageInfo.payload,
- icon: icon!,
- })}
- className="w-full"
- titleLeft={
- <>
- <Badge className="mx-1" size="s" variant="warning">
- {`${originalPackageInfo.payload.version} -> ${targetPackageInfo.version}`}
- </Badge>
- </>
- }
- />
- </div>
- <div className="flex items-center justify-end gap-2 self-stretch pt-5">
+ <DialogHeader>
+ <DialogTitle>
+ {t(
+ ($) =>
+ $[
+ `${i18nPrefix}.${uploadStep === UploadStep.installed ? 'successfulTitle' : 'title'}`
+ ],
+ { ns: 'plugin' },
+ )}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="mb-2 system-md-regular text-text-secondary">
+ {t(($) => $[`${i18nPrefix}.description`], { ns: 'plugin' })}
+ </div>
+ <div className="flex flex-wrap content-start items-start gap-1 self-stretch rounded-2xl bg-background-section-burn p-2">
+ <Card
+ installed={uploadStep === UploadStep.installed}
+ payload={pluginManifestToCardPluginProps({
+ ...originalPackageInfo.payload,
+ icon: icon!,
+ })}
+ className="w-full"
+ titleLeft={
+ <>
+ <Badge className="mx-1" size="s" variant="warning">
+ {`${originalPackageInfo.payload.version} -> ${targetPackageInfo.version}`}
+ </Badge>
+ </>
+ }
+ />
+ </div>
+ </DialogBody>
+ <DialogFooter>
{uploadStep === UploadStep.notStarted && (
<Button onClick={handleCancel}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
@@ -213,7 +217,7 @@ const UpdatePluginModal = ({
>
<span id={upgradeButtonLabelId}>{configBtnText}</span>
</Button>
- </div>
+ </DialogFooter>
</>
)}
</DialogContent>
diff --git a/web/app/components/rag-pipeline/components/publish-as-knowledge-pipeline-modal.tsx b/web/app/components/rag-pipeline/components/publish-as-knowledge-pipeline-modal.tsx
index d6c973e8cae..8202e61b60a 100644
--- a/web/app/components/rag-pipeline/components/publish-as-knowledge-pipeline-modal.tsx
+++ b/web/app/components/rag-pipeline/components/publish-as-knowledge-pipeline-modal.tsx
@@ -2,9 +2,16 @@
import type { IconPickerValue } from '@/app/components/base/icon-picker'
import type { IconInfo } from '@/models/datasets'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Field, FieldLabel } from '@langgenius/dify-ui/field'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { Textarea } from '@langgenius/dify-ui/textarea'
import { useCallback, useState } from 'react'
@@ -67,27 +74,18 @@ const PublishAsKnowledgePipelineModal = ({
if (!open) onCancel()
}}
>
- <DialogContent className="w-full max-w-120! overflow-hidden! border-none p-0! text-left align-middle">
+ <DialogContent className="w-120">
<form
onSubmit={(event) => {
event.preventDefault()
handleConfirm()
}}
>
- <div className="relative flex items-center p-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['common.publishAs'], { ns: 'pipeline' })}
- </DialogTitle>
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-5 right-5"
- onClick={onCancel}
- >
- <span aria-hidden="true" className="i-ri-close-line size-4" />
- </IconButton>
- </div>
- <div className="px-6 py-3">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['common.publishAs'], { ns: 'pipeline' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
<div className="mb-5 flex">
<Field className="mr-3 grow" name="name">
<FieldLabel>
@@ -144,8 +142,8 @@ const PublishAsKnowledgePipelineModal = ({
onValueChange={(value) => setDescription(value)}
/>
</Field>
- </div>
- <div className="flex items-center justify-end gap-2 px-6 py-5">
+ </DialogBody>
+ <DialogFooter>
<Button type="button" onClick={onCancel}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
@@ -156,7 +154,7 @@ const PublishAsKnowledgePipelineModal = ({
>
{t(($) => $['common.publish'], { ns: 'workflow' })}
</Button>
- </div>
+ </DialogFooter>
</form>
</DialogContent>
</Dialog>
diff --git a/web/app/components/rag-pipeline/components/update-dsl-modal.tsx b/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
index 861839c37fd..c4d06e83db9 100644
--- a/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
+++ b/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
@@ -1,8 +1,16 @@
'use client'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
-import { RiAlertFill, RiCloseLine, RiFileDownloadLine } from '@remixicon/react'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
+import { RiAlertFill, RiFileDownloadLine } from '@remixicon/react'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
import { Uploader } from '@/app/components/app/create-from-dsl-modal/uploader'
@@ -37,53 +45,46 @@ const UpdateDSLModal = ({ onCancel, onBackup, onImport }: UpdateDSLModalProps) =
if (!open) onCancel()
}}
>
- <DialogContent className="w-full max-w-120! overflow-hidden! rounded-2xl border-none p-6 text-left align-middle">
- <div className="mb-3 flex items-center justify-between">
- <div className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['common.importDSL'], { ns: 'workflow' })}
- </div>
- <button
- type="button"
- className="flex h-5.5 w-5.5 cursor-pointer items-center justify-center border-none bg-transparent p-0 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- onClick={onCancel}
- >
- <RiCloseLine className="h-4.5 w-4.5 text-text-tertiary" aria-hidden="true" />
- </button>
- </div>
- <div className="relative mb-2 flex grow gap-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs">
- <div className="pointer-events-none absolute top-0 left-0 size-full bg-toast-warning-bg opacity-40" />
- <div className="flex items-start justify-center p-1">
- <RiAlertFill className="size-4 shrink-0 text-text-warning-secondary" />
- </div>
- <div className="flex grow flex-col items-start gap-0.5 py-1">
- <div className="system-xs-medium whitespace-pre-line text-text-primary">
- {t(($) => $['common.importDSLTip'], { ns: 'workflow' })}
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['common.importDSL'], { ns: 'workflow' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <div className="relative mb-2 flex grow gap-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs">
+ <div className="pointer-events-none absolute top-0 left-0 size-full bg-toast-warning-bg opacity-40" />
+ <div className="flex items-start justify-center p-1">
+ <RiAlertFill className="size-4 shrink-0 text-text-warning-secondary" />
</div>
- <div className="flex items-start gap-1 self-stretch pt-1 pb-0.5">
- <Button size="small" variant="secondary" className="relative" onClick={onBackup}>
- <RiFileDownloadLine className="size-3.5 text-components-button-secondary-text" />
- <div className="flex items-center justify-center gap-1">
- {t(($) => $['common.backupCurrentDraft'], { ns: 'workflow' })}
- </div>
- </Button>
+ <div className="flex grow flex-col items-start gap-0.5 py-1">
+ <div className="system-xs-medium whitespace-pre-line text-text-primary">
+ {t(($) => $['common.importDSLTip'], { ns: 'workflow' })}
+ </div>
+ <div className="flex items-start gap-1 self-stretch pt-1 pb-0.5">
+ <Button size="small" variant="secondary" className="relative" onClick={onBackup}>
+ <RiFileDownloadLine className="size-3.5 text-components-button-secondary-text" />
+ <div className="flex items-center justify-center gap-1">
+ {t(($) => $['common.backupCurrentDraft'], { ns: 'workflow' })}
+ </div>
+ </Button>
+ </div>
</div>
</div>
- </div>
- <div>
- <div className="pt-2 system-md-semibold text-text-primary">
- {t(($) => $['common.chooseDSL'], { ns: 'workflow' })}
- </div>
- <div className="flex w-full flex-col items-start justify-center gap-4 self-stretch py-4">
- <Uploader
- file={currentFile}
- updateFile={handleFile}
- className="mt-0! w-full"
- importType="pipeline"
- />
+ <div>
+ <div className="pt-2 system-md-semibold text-text-primary">
+ {t(($) => $['common.chooseDSL'], { ns: 'workflow' })}
+ </div>
+ <div className="flex w-full flex-col items-start justify-center gap-4 self-stretch py-4">
+ <Uploader
+ file={currentFile}
+ updateFile={handleFile}
+ className="mt-0! w-full"
+ importType="pipeline"
+ />
+ </div>
</div>
- </div>
- <div className="flex items-center justify-end gap-2 self-stretch pt-5">
+ </DialogBody>
+ <DialogFooter>
<Button onClick={onCancel}>{t(($) => $['newApp.Cancel'], { ns: 'app' })}</Button>
<Button
disabled={!currentFile}
@@ -94,7 +95,7 @@ const UpdateDSLModal = ({ onCancel, onBackup, onImport }: UpdateDSLModalProps) =
>
{t(($) => $['common.overwriteAndImport'], { ns: 'workflow' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
<VersionMismatchModal
diff --git a/web/app/components/share/text-generation/info-modal.tsx b/web/app/components/share/text-generation/info-modal.tsx
index 61aa0239b25..b8ce0a3df63 100644
--- a/web/app/components/share/text-generation/info-modal.tsx
+++ b/web/app/components/share/text-generation/info-modal.tsx
@@ -24,7 +24,7 @@ const InfoModal = ({ isShow, onClose, data }: Props) => {
if (!open) onClose()
}}
>
- <DialogContent className="w-full max-w-100 min-w-100 overflow-hidden! border-none p-0! text-left align-middle">
+ <DialogContent className="w-100 min-w-100 overflow-hidden">
<DialogClose
render={
<IconButton
@@ -44,7 +44,7 @@ const InfoModal = ({ isShow, onClose, data }: Props) => {
icon={data}
/>
<div className="w-full text-center">
- <DialogTitle className="system-xl-semibold text-text-secondary">
+ <DialogTitle>
{data?.title || t(($) => $['userProfile.about'], { ns: 'common' })}
</DialogTitle>
<div className="mt-1 system-xl-medium text-text-tertiary">{data?.description}</div>
diff --git a/web/app/components/snippets/create-snippet-dialog.tsx b/web/app/components/snippets/create-snippet-dialog.tsx
index 320c8a1c47e..a811fe71865 100644
--- a/web/app/components/snippets/create-snippet-dialog.tsx
+++ b/web/app/components/snippets/create-snippet-dialog.tsx
@@ -5,13 +5,13 @@ import type { SnippetCanvasData } from '@/models/snippet'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogBackdrop,
- DialogClose,
- DialogPopup,
- DialogPortal,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { Textarea } from '@langgenius/dify-ui/textarea'
import { matchesKeyboardEvent } from '@tanstack/react-hotkeys'
@@ -97,100 +97,85 @@ export function CreateSnippetDialog({
return (
<>
<Dialog open={isOpen} onOpenChange={(open) => !open && handleClose()}>
- <DialogPortal>
- <DialogBackdrop />
- <DialogPopup
- onKeyDown={(event) => {
- if (
- !isOpen ||
- isSubmitting ||
- !name.trim() ||
- event.defaultPrevented ||
- event.nativeEvent.isComposing ||
- !(event.target instanceof Node) ||
- !event.currentTarget.contains(event.target) ||
- !matchesKeyboardEvent(event.nativeEvent, CREATE_SNIPPET_HOTKEY)
- )
- return
- event.preventDefault()
- event.stopPropagation()
- if (event.repeat) return
- handleConfirm()
- }}
- initialFocus={nameInputRef}
- className="fixed top-1/2 left-1/2 max-h-[80dvh] w-120 max-w-120 -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain p-0"
- >
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
-
- <div className="px-6 pt-6 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {title || t(($) => $['snippet.createDialogTitle'], { ns: 'workflow' })}
- </DialogTitle>
- </div>
-
- <div className="space-y-4 px-6 py-2">
- <div>
- <label
- htmlFor={nameInputId}
- className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"
- >
- {t(($) => $['snippet.nameLabel'], { ns: 'workflow' })}
- </label>
- <Input
- ref={nameInputRef}
- id={nameInputId}
- value={name}
- onChange={(e) => setName(e.target.value)}
- placeholder={t(($) => $['snippet.namePlaceholder'], { ns: 'workflow' }) || ''}
- disabled={isSubmitting}
- />
- </div>
-
- <div>
- <label
- htmlFor={descriptionInputId}
- className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"
- >
- {t(($) => $['snippet.descriptionLabel'], { ns: 'workflow' })}
- </label>
- <Textarea
- id={descriptionInputId}
- className="resize-none"
- value={description}
- onValueChange={(value) => setDescription(value)}
- placeholder={
- t(($) => $['snippet.descriptionPlaceholder'], { ns: 'workflow' }) || ''
- }
- disabled={isSubmitting}
- />
- </div>
+ <DialogContent
+ onKeyDown={(event) => {
+ if (
+ !isOpen ||
+ isSubmitting ||
+ !name.trim() ||
+ event.defaultPrevented ||
+ event.nativeEvent.isComposing ||
+ !(event.target instanceof Node) ||
+ !event.currentTarget.contains(event.target) ||
+ !matchesKeyboardEvent(event.nativeEvent, CREATE_SNIPPET_HOTKEY)
+ )
+ return
+ event.preventDefault()
+ event.stopPropagation()
+ if (event.repeat) return
+ handleConfirm()
+ }}
+ initialFocus={nameInputRef}
+ >
+ <DialogHeader>
+ <DialogTitle>
+ {title || t(($) => $['snippet.createDialogTitle'], { ns: 'workflow' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+
+ <DialogBody className="space-y-4">
+ <div>
+ <label
+ htmlFor={nameInputId}
+ className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"
+ >
+ {t(($) => $['snippet.nameLabel'], { ns: 'workflow' })}
+ </label>
+ <Input
+ ref={nameInputRef}
+ id={nameInputId}
+ value={name}
+ onChange={(e) => setName(e.target.value)}
+ placeholder={t(($) => $['snippet.namePlaceholder'], { ns: 'workflow' }) || ''}
+ disabled={isSubmitting}
+ />
</div>
- <div className="flex items-center justify-end gap-2 px-6 pb-6">
- <Button disabled={isSubmitting} onClick={handleClose}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <Button
- variant="primary"
- disabled={!name.trim()}
- loading={isSubmitting}
- onClick={handleConfirm}
+ <div>
+ <label
+ htmlFor={descriptionInputId}
+ className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"
>
- {confirmText || t(($) => $['snippet.confirm'], { ns: 'workflow' })}
- </Button>
+ {t(($) => $['snippet.descriptionLabel'], { ns: 'workflow' })}
+ </label>
+ <Textarea
+ id={descriptionInputId}
+ className="resize-none"
+ value={description}
+ onValueChange={(value) => setDescription(value)}
+ placeholder={
+ t(($) => $['snippet.descriptionPlaceholder'], { ns: 'workflow' }) || ''
+ }
+ disabled={isSubmitting}
+ />
</div>
- </DialogPopup>
- </DialogPortal>
+ </DialogBody>
+
+ <DialogFooter>
+ <Button disabled={isSubmitting} onClick={handleClose}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
+ <Button
+ variant="primary"
+ disabled={!name.trim()}
+ loading={isSubmitting}
+ onClick={handleConfirm}
+ >
+ {confirmText || t(($) => $['snippet.confirm'], { ns: 'workflow' })}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
</Dialog>
</>
)
diff --git a/web/app/components/snippets/import-snippet-dsl-dialog.tsx b/web/app/components/snippets/import-snippet-dsl-dialog.tsx
index c8cd1f99cbd..bbf9c45496b 100644
--- a/web/app/components/snippets/import-snippet-dsl-dialog.tsx
+++ b/web/app/components/snippets/import-snippet-dsl-dialog.tsx
@@ -13,7 +13,15 @@ import {
AlertDialogTitle,
} from '@langgenius/dify-ui/alert-dialog'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Input } from '@langgenius/dify-ui/input'
import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'
import { ORPCError } from '@orpc/client'
@@ -229,20 +237,11 @@ function ImportSnippetDSLDialog({ isOpen, onClose }: ImportSnippetDSLDialogProps
return (
<>
<Dialog open={isOpen} onOpenChange={(open) => !open && !showConfirmModal && onClose()}>
- <DialogContent className="w-full max-w-120! overflow-hidden! rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0! text-left align-middle shadow-xl">
- <div className="flex items-center justify-between pt-6 pr-5 pb-3 pl-6">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $.importDialogTitle, { ns: 'snippet' })}
- </DialogTitle>
- <button
- type="button"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="flex size-8 cursor-pointer items-center justify-center rounded-lg text-text-tertiary hover:bg-state-base-hover"
- onClick={onClose}
- >
- <span className="i-ri-close-line size-5" />
- </button>
- </div>
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.importDialogTitle, { ns: 'snippet' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
<Tabs value={currentTab} onValueChange={handleTabChange}>
<TabsList
aria-label={t(($) => $.importDialogTitle, { ns: 'snippet' })}
@@ -263,19 +262,13 @@ function ImportSnippetDSLDialog({ isOpen, onClose }: ImportSnippetDSLDialogProps
{t(($) => $.importFromDSLUrl, { ns: 'snippet' })}
</TabsTab>
</TabsList>
- <TabsPanel
- value={ImportSnippetDSLDialogTab.FromFile}
- tabIndex={-1}
- className="px-6 py-4"
- >
- <Uploader className="mt-0" file={currentFile} updateFile={handleFileChange} />
+ <TabsPanel value={ImportSnippetDSLDialogTab.FromFile} tabIndex={-1}>
+ <DialogBody>
+ <Uploader className="mt-0" file={currentFile} updateFile={handleFileChange} />
+ </DialogBody>
</TabsPanel>
- <TabsPanel
- value={ImportSnippetDSLDialogTab.FromUrl}
- tabIndex={-1}
- className="px-6 py-4"
- >
- <div>
+ <TabsPanel value={ImportSnippetDSLDialogTab.FromUrl} tabIndex={-1}>
+ <DialogBody>
<label
htmlFor={dslUrlInputId}
className="mb-1 block system-md-semibold text-text-secondary"
@@ -288,11 +281,11 @@ function ImportSnippetDSLDialog({ isOpen, onClose }: ImportSnippetDSLDialogProps
value={dslUrl}
onChange={(event) => setDslUrl(event.target.value)}
/>
- </div>
+ </DialogBody>
</TabsPanel>
</Tabs>
- <div className="flex justify-end px-6 py-5">
- <Button className="mr-2" disabled={isSubmitting} onClick={onClose}>
+ <DialogFooter>
+ <Button disabled={isSubmitting} onClick={onClose}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
<Button
@@ -303,7 +296,7 @@ function ImportSnippetDSLDialog({ isOpen, onClose }: ImportSnippetDSLDialogProps
>
{t(($) => $['operation.create'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
{showConfirmModal && (
diff --git a/web/app/components/tools/mcp/mcp-server-modal.tsx b/web/app/components/tools/mcp/mcp-server-modal.tsx
index f4313504945..22e46e47f90 100644
--- a/web/app/components/tools/mcp/mcp-server-modal.tsx
+++ b/web/app/components/tools/mcp/mcp-server-modal.tsx
@@ -1,10 +1,17 @@
'use client'
import type { MCPServerDetail } from '@/app/components/tools/types'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Separator } from '@langgenius/dify-ui/separator'
import { Textarea } from '@langgenius/dify-ui/textarea'
-import { RiCloseLine } from '@remixicon/react'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
@@ -101,76 +108,70 @@ const MCPServerModal = ({ appID, latestParams = [], data, show, onHide, appInfo
if (!open) onHide()
}}
>
- <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-130! flex-col overflow-hidden! border-none p-0! text-left align-middle transition-all duration-100 ease-in">
- <button
- type="button"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="absolute top-5 right-5 z-10 cursor-pointer border-none bg-transparent p-1.5 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- onClick={onHide}
- >
- <RiCloseLine className="size-5 text-text-tertiary" aria-hidden="true" />
- </button>
- <div className="relative shrink-0 p-6 pr-12 pb-3 title-2xl-semi-bold text-xl wrap-break-word text-text-primary">
- {!data
- ? t(($) => $['mcp.server.modal.addTitle'], { ns: 'tools' })
- : t(($) => $['mcp.server.modal.editTitle'], { ns: 'tools' })}
- </div>
- <div className="min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto">
- <div className="min-w-0 space-y-5 px-6 py-3">
- <div className="space-y-0.5">
- <div className="flex h-6 items-center gap-1">
- <div className="system-sm-medium text-text-secondary">
- {t(($) => $['mcp.server.modal.description'], { ns: 'tools' })}
- </div>
- <div className="system-xs-regular text-text-destructive-secondary">*</div>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] w-130">
+ <DialogHeader>
+ <DialogTitle>
+ {!data
+ ? t(($) => $['mcp.server.modal.addTitle'], { ns: 'tools' })
+ : t(($) => $['mcp.server.modal.editTitle'], { ns: 'tools' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="space-y-5">
+ <div className="space-y-0.5">
+ <div className="flex h-6 items-center gap-1">
+ <div className="system-sm-medium text-text-secondary">
+ {t(($) => $['mcp.server.modal.description'], { ns: 'tools' })}
</div>
- <Textarea
- aria-label={t(($) => $['mcp.server.modal.description'], { ns: 'tools' })}
- className="h-24 resize-none"
- value={description}
- placeholder={t(($) => $['mcp.server.modal.descriptionPlaceholder'], {
- ns: 'tools',
- })}
- onValueChange={(value) => setDescription(value)}
- />
+ <div className="system-xs-regular text-text-destructive-secondary">*</div>
</div>
+ <Textarea
+ aria-label={t(($) => $['mcp.server.modal.description'], { ns: 'tools' })}
+ className="h-24 resize-none"
+ value={description}
+ placeholder={t(($) => $['mcp.server.modal.descriptionPlaceholder'], {
+ ns: 'tools',
+ })}
+ onValueChange={(value) => setDescription(value)}
+ />
+ </div>
- {latestParams.length > 0 && (
- <div className="min-w-0">
- <div className="mb-1 flex items-center gap-2">
- <div className="shrink-0 system-xs-medium-uppercase text-text-primary">
- {t(($) => $['mcp.server.modal.parameters'], { ns: 'tools' })}
- </div>
- <Separator
- decorative
- orientation="horizontal"
- className="m-0 grow bg-divider-subtle"
- />
+ {latestParams.length > 0 && (
+ <div className="min-w-0">
+ <div className="mb-1 flex items-center gap-2">
+ <div className="shrink-0 system-xs-medium-uppercase text-text-primary">
+ {t(($) => $['mcp.server.modal.parameters'], { ns: 'tools' })}
</div>
- <div className="mb-2 body-xs-regular text-text-tertiary">
- {t(($) => $['mcp.server.modal.parametersTip'], { ns: 'tools' })}
- </div>
- <div className="min-w-0 space-y-3">
- {latestParams.map((paramItem) => {
- if (!paramItem.variable) return null
+ <Separator
+ decorative
+ orientation="horizontal"
+ className="m-0 grow bg-divider-subtle"
+ />
+ </div>
+ <div className="mb-2 body-xs-regular text-text-tertiary">
+ {t(($) => $['mcp.server.modal.parametersTip'], { ns: 'tools' })}
+ </div>
+ <div className="min-w-0 space-y-3">
+ {latestParams.map((paramItem) => {
+ if (!paramItem.variable) return null
- const { variable } = paramItem
+ const { variable } = paramItem
- return (
- <MCPServerParamItem
- key={variable}
- data={paramItem}
- value={params[variable] || ''}
- onChange={(value) => handleParamChange(variable, value)}
- />
- )
- })}
- </div>
+ return (
+ <MCPServerParamItem
+ key={variable}
+ data={paramItem}
+ value={params[variable] || ''}
+ onChange={(value) => handleParamChange(variable, value)}
+ />
+ )
+ })}
</div>
- )}
- </div>
- </div>
- <div className="flex shrink-0 flex-row-reverse flex-wrap gap-2 p-6 pt-5">
+ </div>
+ )}
+ </DialogBody>
+ <DialogFooter>
+ <Button onClick={onHide}>{t(($) => $['mcp.modal.cancel'], { ns: 'tools' })}</Button>
<Button
disabled={!description || creating || updating}
variant="primary"
@@ -180,8 +181,7 @@ const MCPServerModal = ({ appID, latestParams = [], data, show, onHide, appInfo
? t(($) => $['mcp.modal.save'], { ns: 'tools' })
: t(($) => $['mcp.server.modal.confirm'], { ns: 'tools' })}
</Button>
- <Button onClick={onHide}>{t(($) => $['mcp.modal.cancel'], { ns: 'tools' })}</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/tools/mcp/modal.tsx b/web/app/components/tools/mcp/modal.tsx
index ab9c0390493..c122479926b 100644
--- a/web/app/components/tools/mcp/modal.tsx
+++ b/web/app/components/tools/mcp/modal.tsx
@@ -7,7 +7,15 @@ import type { AppIconType } from '@/types/app'
import { zSsoProtocol } from '@dify/contracts/api/console/system-features/zod.gen'
import { Avatar, AvatarFallback } from '@langgenius/dify-ui/avatar'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { SegmentedControl, SegmentedControlItem } from '@langgenius/dify-ui/segmented-control'
@@ -147,21 +155,16 @@ const MCPModalContent: FC<MCPModalContentProps> = ({ data, onConfirm, onHide })
return (
<>
- <button
- type="button"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="absolute top-5 right-5 z-10 cursor-pointer border-none bg-transparent p-1.5 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- onClick={onHide}
- >
- <span aria-hidden className="i-ri-close-line size-5 text-text-tertiary" />
- </button>
- <DialogTitle className="relative pb-3 title-2xl-semi-bold text-xl text-text-primary">
- {!isCreate
- ? t(($) => $['mcp.modal.editTitle'], { ns: 'tools' })
- : t(($) => $['mcp.modal.title'], { ns: 'tools' })}
- </DialogTitle>
+ <DialogHeader>
+ <DialogTitle>
+ {!isCreate
+ ? t(($) => $['mcp.modal.editTitle'], { ns: 'tools' })
+ : t(($) => $['mcp.modal.title'], { ns: 'tools' })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
- <div className="space-y-5 py-3">
+ <DialogBody className="space-y-5">
{/* Server URL */}
<div>
<div className="mb-1 flex h-6 items-center">
@@ -345,17 +348,16 @@ const MCPModalContent: FC<MCPModalContentProps> = ({ data, onConfirm, onHide })
onSseReadTimeoutChange={actions.setSseReadTimeout}
/>
)}
- </div>
+ </DialogBody>
- {/* Actions */}
- <div className="flex flex-row-reverse pt-5">
- <Button disabled={isSubmitDisabled} className="ml-2" variant="primary" onClick={submit}>
+ <DialogFooter>
+ <Button onClick={onHide}>{t(($) => $['mcp.modal.cancel'], { ns: 'tools' })}</Button>
+ <Button disabled={isSubmitDisabled} variant="primary" onClick={submit}>
{data
? t(($) => $['mcp.modal.save'], { ns: 'tools' })
: t(($) => $['mcp.modal.confirm'], { ns: 'tools' })}
</Button>
- <Button onClick={onHide}>{t(($) => $['mcp.modal.cancel'], { ns: 'tools' })}</Button>
- </div>
+ </DialogFooter>
</>
)
}
@@ -377,7 +379,7 @@ const MCPModal: FC<DuplicateAppModalProps> = ({ data, show, onConfirm, onHide })
if (!open) onHide()
}}
>
- <DialogContent className="w-full max-w-130! border-none p-6 text-left align-middle">
+ <DialogContent className="w-130">
<MCPModalContent key={formKey} data={data} onConfirm={onConfirm} onHide={onHide} />
</DialogContent>
</Dialog>
diff --git a/web/app/components/tools/workflow-tool/confirm-modal/index.tsx b/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
index 27b0e6b0cbe..d7881a81e76 100644
--- a/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
+++ b/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
@@ -1,8 +1,15 @@
'use client'
import { Button } from '@langgenius/dify-ui/button'
-import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
+import {
+ Dialog,
+ DialogCloseButton,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useTranslation } from 'react-i18next'
type ConfirmModalProps = {
@@ -15,38 +22,33 @@ const ConfirmModal = ({ show, onConfirm, onClose }: ConfirmModalProps) => {
const { t } = useTranslation(['common', 'tools'])
return (
- <Dialog open={show} disablePointerDismissal>
- <DialogContent backdropProps={{ forceRender: true }} className={cn('w-150! max-w-150! p-8!')}>
- <button
- type="button"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="absolute top-4 right-4 cursor-pointer border-none bg-transparent p-2"
- onClick={onClose}
- >
- <span aria-hidden className="i-ri-close-line size-4 text-text-tertiary" />
- </button>
- <div className="h-12 w-12 rounded-xl border-[0.5px] border-divider-regular bg-background-section p-3 shadow-xl">
- <span
- aria-hidden
- className="i-custom-vender-solid-alertsAndFeedback-alert-triangle h-6 w-6 text-[rgb(247,144,9)]"
- />
- </div>
- <DialogTitle className="relative mt-3 text-xl leading-7.5 font-semibold text-text-primary">
- {t(($) => $['createTool.confirmTitle'], { ns: 'tools' })}
- </DialogTitle>
- <div className="my-1 text-sm/5 text-text-tertiary">
- {t(($) => $['createTool.confirmTip'], { ns: 'tools' })}
- </div>
- <div className="flex items-center justify-end pt-6">
- <div className="flex items-center">
- <Button className="mr-2" onClick={onClose}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- <Button variant="primary" tone="destructive" onClick={onConfirm}>
- {t(($) => $['operation.confirm'], { ns: 'common' })}
- </Button>
+ <Dialog
+ open={show}
+ onOpenChange={(open) => {
+ if (!open) onClose()
+ }}
+ disablePointerDismissal
+ >
+ <DialogContent backdropProps={{ forceRender: true }} className="w-150 max-w-150">
+ <DialogHeader>
+ <div className="mb-2 h-12 w-12 rounded-xl border-[0.5px] border-divider-regular bg-background-section p-3 shadow-xl">
+ <span
+ aria-hidden
+ className="i-custom-vender-solid-alertsAndFeedback-alert-triangle h-6 w-6 text-[rgb(247,144,9)]"
+ />
</div>
- </div>
+ <DialogTitle>{t(($) => $['createTool.confirmTitle'], { ns: 'tools' })}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $['createTool.confirmTip'], { ns: 'tools' })}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogFooter>
+ <Button onClick={onClose}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>
+ <Button variant="primary" tone="destructive" onClick={onConfirm}>
+ {t(($) => $['operation.confirm'], { ns: 'common' })}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/workflow-app/components/workflow-onboarding-modal/index.tsx b/web/app/components/workflow-app/components/workflow-onboarding-modal/index.tsx
index 0c508f2940d..6dc2b8a4602 100644
--- a/web/app/components/workflow-app/components/workflow-onboarding-modal/index.tsx
+++ b/web/app/components/workflow-app/components/workflow-onboarding-modal/index.tsx
@@ -3,12 +3,13 @@ import type { FC } from 'react'
import type { BlockDefaultValue } from '@/app/components/workflow/block-selector/types'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useTranslation } from 'react-i18next'
import { BlockEnum } from '@/app/components/workflow/types'
import StartNodeSelectionPanel from './start-node-selection-panel'
@@ -29,36 +30,23 @@ const WorkflowOnboardingModal: FC<WorkflowOnboardingModalProps> = ({
return (
<Dialog open={isShow} onOpenChange={onClose} disablePointerDismissal>
<DialogContent
- className="w-154.5 max-w-154.5 rounded-2xl border border-effects-highlight bg-background-default-subtle shadow-lg"
+ className="w-154.5 max-w-154.5"
backdropProps={{ className: 'bg-workflow-canvas-canvas-overlay' }}
>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
-
- <div className="pb-4">
- <div className="mb-6">
- <DialogTitle className="mb-2 title-2xl-semi-bold text-text-primary">
- {t(($) => $['onboarding.title'], { ns: 'workflow' })}
- </DialogTitle>
- <DialogDescription className="body-xs-regular leading-4 text-text-tertiary">
- {t(($) => $['onboarding.description'], { ns: 'workflow' })}
- </DialogDescription>
- </div>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['onboarding.title'], { ns: 'workflow' })}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $['onboarding.description'], { ns: 'workflow' })}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
<StartNodeSelectionPanel
onSelectUserInput={() => onSelectStartNode(BlockEnum.Start)}
onSelectTrigger={onSelectStartNode}
/>
- </div>
+ </DialogBody>
</DialogContent>
</Dialog>
)
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 dbf9e824c86..9720e0adfea 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
@@ -306,7 +306,7 @@ function AgentRosterInlineConfigureDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange} disablePointerDismissal>
<DialogTrigger render={trigger} />
- <DialogContent className="h-[min(760px,calc(100dvh-32px))] w-[min(1120px,calc(100vw-32px))] max-w-none overflow-hidden p-0">
+ <DialogContent className="h-[min(760px,calc(100dvh-32px))] w-[min(1120px,calc(100vw-32px))] max-w-none overflow-hidden">
<DialogTitle className="sr-only">{agent.name}</DialogTitle>
<DialogDescription className="sr-only">
{t(($) => $[`${i18nPrefix}.roster.inlineSetup.description`], { ns: 'workflowAgent' })}
diff --git a/web/app/components/workflow/nodes/agent-v2/components/save-inline-agent-to-roster-dialog.tsx b/web/app/components/workflow/nodes/agent-v2/components/save-inline-agent-to-roster-dialog.tsx
index 0d0aa7ff2a8..bf4e2caece3 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/save-inline-agent-to-roster-dialog.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/save-inline-agent-to-roster-dialog.tsx
@@ -13,13 +13,14 @@ import type {
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useMutation } from '@tanstack/react-query'
import { useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -65,18 +66,16 @@ function SaveInlineAgentToRosterFormSession({
return (
<>
- <div className="shrink-0 ps-6 pe-14 pt-6 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['roster.saveToRosterDialog.title'], { ns: 'agentRoster' })}
</DialogTitle>
<DialogDescription className="sr-only">
{t(($) => $['roster.saveToRosterDialog.description'], { ns: 'agentRoster' })}
</DialogDescription>
- </div>
- <Form<AgentFormValues>
- className="flex min-h-0 flex-1 flex-col"
- onFormSubmit={(formValues) => onSubmit(formValues, agentIcon)}
- >
+ <DialogCloseButton aria-label={tCommon(($) => $['operation.close'])} disabled={pending} />
+ </DialogHeader>
+ <Form<AgentFormValues> onFormSubmit={(formValues) => onSubmit(formValues, agentIcon)}>
<AgentFormFields
ref={nameInputRef}
defaultValues={initialValues.fields}
@@ -84,14 +83,14 @@ function SaveInlineAgentToRosterFormSession({
iconAriaLabel={t(($) => $['roster.saveToRosterForm.changeIcon'], { ns: 'agentRoster' })}
onIconChange={setAgentIcon}
/>
- <div className="flex shrink-0 justify-end gap-2 px-6 pt-5 pb-6">
+ <DialogFooter>
<Button type="button" className="min-w-18" onClick={onCancel} disabled={pending}>
{tCommon(($) => $['operation.cancel'])}
</Button>
<Button type="submit" variant="primary" className="min-w-18" loading={pending}>
{tCommon(($) => $['operation.save'])}
</Button>
- </div>
+ </DialogFooter>
</Form>
</>
)
@@ -105,7 +104,6 @@ export function SaveInlineAgentToRosterDialog({
onOpenChange,
onSaved,
}: SaveInlineAgentToRosterDialogProps) {
- const { t } = useTranslation(['common'])
const nameInputRef = useRef<HTMLInputElement>(null)
const appSaveToRosterMutation = useMutation(
consoleQuery.apps.byAppId.workflows.draft.nodes.byNodeId.agentComposer.saveToRoster.post.mutationOptions(),
@@ -174,22 +172,7 @@ export function SaveInlineAgentToRosterDialog({
return (
<>
<Dialog open={open} onOpenChange={handleOpenChange} disablePointerDismissal>
- <DialogContent
- initialFocus={nameInputRef}
- className="flex max-h-[calc(100dvh-2rem)] w-130 flex-col overflow-hidden! p-0!"
- >
- <DialogClose
- disabled={isSavingToRoster}
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-5 top-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
+ <DialogContent initialFocus={nameInputRef} className="max-h-[calc(100dvh-2rem)] w-130">
<SaveInlineAgentToRosterFormSession
initialAgent={initialAgent}
nameInputRef={nameInputRef}
diff --git a/web/app/components/workflow/nodes/http/components/authorization/index.tsx b/web/app/components/workflow/nodes/http/components/authorization/index.tsx
index 88498e2a7f6..75a24ce9194 100644
--- a/web/app/components/workflow/nodes/http/components/authorization/index.tsx
+++ b/web/app/components/workflow/nodes/http/components/authorization/index.tsx
@@ -7,8 +7,11 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
+ DialogBody,
DialogClose,
DialogContent,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
@@ -141,9 +144,11 @@ function AuthorizationForm({
return (
<>
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $[`${i18nPrefix}.authorization`], { ns: 'workflowIntegrations' })}
- </DialogTitle>
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $[`${i18nPrefix}.authorization`], { ns: 'workflowIntegrations' })}
+ </DialogTitle>
+ </DialogHeader>
<form
onSubmit={(event) => {
@@ -152,7 +157,7 @@ function AuthorizationForm({
onSaved()
}}
>
- <div className="space-y-2">
+ <DialogBody className="space-y-2">
<Field
title={t(($) => $[`${i18nPrefix}.authorizationType`], { ns: 'workflowIntegrations' })}
>
@@ -234,15 +239,15 @@ function AuthorizationForm({
</Field>
</>
)}
- </div>
- <div className="mt-6 flex justify-end space-x-2">
+ </DialogBody>
+ <DialogFooter>
<DialogClose render={<Button />}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</DialogClose>
<Button variant="primary" type="submit">
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
</>
)
@@ -278,7 +283,7 @@ export function AuthorizationDialog({
/>
{label}
</DialogTrigger>
- <DialogContent className="border-none text-left align-middle">
+ <DialogContent>
<AuthorizationForm
nodeId={nodeId}
payload={payload}
diff --git a/web/app/components/workflow/nodes/http/components/curl-import-dialog.tsx b/web/app/components/workflow/nodes/http/components/curl-import-dialog.tsx
index 71bd1b882d5..c273ac4cec9 100644
--- a/web/app/components/workflow/nodes/http/components/curl-import-dialog.tsx
+++ b/web/app/components/workflow/nodes/http/components/curl-import-dialog.tsx
@@ -5,8 +5,11 @@ import type { HttpNodeType } from '../types'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
+ DialogBody,
DialogClose,
DialogContent,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
@@ -34,20 +37,22 @@ function CurlImportForm({ onImport }: Pick<CurlImportDialogProps, 'onImport'>) {
else toast.error(result.error)
}}
>
- <Textarea
- name="curl"
- aria-label={t(($) => $['nodes.http.curl.title'], { ns: 'workflowIntegrations' })}
- className="my-3 h-40 w-full grow"
- placeholder={t(($) => $['nodes.http.curl.placeholder'], { ns: 'workflowIntegrations' })}
- />
- <div className="mt-4 flex justify-end space-x-2">
+ <DialogBody>
+ <Textarea
+ name="curl"
+ aria-label={t(($) => $['nodes.http.curl.title'], { ns: 'workflowIntegrations' })}
+ className="h-40 w-full grow"
+ placeholder={t(($) => $['nodes.http.curl.placeholder'], { ns: 'workflowIntegrations' })}
+ />
+ </DialogBody>
+ <DialogFooter>
<DialogClose render={<Button className="w-23.75!" />}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</DialogClose>
<Button type="submit" className="w-23.75!" variant="primary">
{t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
)
}
@@ -78,10 +83,12 @@ export function CurlImportDialog({ readOnly, onImport }: CurlImportDialogProps)
/>
{label}
</DialogTrigger>
- <DialogContent className="w-100! max-w-100! overflow-hidden! border-none p-4! text-left align-middle">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['nodes.http.curl.title'], { ns: 'workflowIntegrations' })}
- </DialogTitle>
+ <DialogContent className="w-100 max-w-100">
+ <DialogHeader>
+ <DialogTitle>
+ {t(($) => $['nodes.http.curl.title'], { ns: 'workflowIntegrations' })}
+ </DialogTitle>
+ </DialogHeader>
<CurlImportForm onImport={handleImport} />
</DialogContent>
</Dialog>
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
index 5d3e3215502..4019c466500 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
@@ -1,8 +1,16 @@
import type { EmailConfig } from '../../types'
import type { Node, NodeOutPutVar } from '@/app/components/workflow/types'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Input } from '@langgenius/dify-ui/input'
import { Switch } from '@langgenius/dify-ui/switch'
import { RiBugLine } from '@remixicon/react'
@@ -97,31 +105,21 @@ const EmailConfigureModal = ({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="max-h-[calc(100dvh-64px)]! w-180!">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="space-y-1 pr-8">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogContent className="max-h-[calc(100dvh-64px)] w-180">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $[`${i18nPrefix}.deliveryMethod.emailConfigure.title`], {
ns: 'workflowHumanInput',
})}
</DialogTitle>
- <div className="system-xs-regular text-text-tertiary">
+ <DialogDescription>
{t(($) => $[`${i18nPrefix}.deliveryMethod.emailConfigure.description`], {
ns: 'workflowHumanInput',
})}
- </div>
- </div>
- <div className="mt-6 space-y-5">
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="space-y-5">
<div>
<label
htmlFor={subjectId}
@@ -199,15 +197,15 @@ const EmailConfigureModal = ({
onCheckedChange={(checked) => setDebugMode(checked)}
/>
</div>
- </div>
- <div className="mt-6 flex flex-row-reverse gap-2">
- <Button variant="primary" className="w-18" onClick={handleConfirm}>
- {t(($) => $['operation.save'], { ns: 'common' })}
- </Button>
+ </DialogBody>
+ <DialogFooter>
<Button className="w-18" onClick={() => onOpenChange(false)}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</Button>
- </div>
+ <Button variant="primary" className="w-18" onClick={handleConfirm}>
+ {t(($) => $['operation.save'], { ns: 'common' })}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx
index ecd612c5ad5..4b485a9305d 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx
@@ -2,8 +2,15 @@ import type { EmailConfig, FormInputItem } from '../../types'
import type { Node, NodeOutPutVar, Var } from '@/app/components/workflow/types'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { Separator } from '@langgenius/dify-ui/separator'
import { RiArrowRightSFill } from '@remixicon/react'
import { useQuery, useSuspenseQuery } from '@tanstack/react-query'
@@ -249,96 +256,92 @@ const EmailSenderContent = ({
}
}, [confirmChecked, generatedInputs, inputs, testEmailSender, appId, nodeId, deliveryId, t])
+ const hasBody =
+ ((onlySpecificUsers || combinedRecipients) && !debugEnabled) || generatedInputs.length > 0
+
if (done) {
return (
<>
- <div className="space-y-2">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $[`${i18nPrefix}.deliveryMethod.emailSender.done`], {
ns: 'workflowHumanInput',
})}
</DialogTitle>
- {debugEnabled && (
- <div className="system-md-regular text-text-secondary">
- <Trans
- i18nKey={($) => $[`${i18nPrefix}.deliveryMethod.emailSender.debugDone`]}
- ns="workflowHumanInput"
- components={{
- email: <span className="system-md-semibold text-text-secondary"></span>,
- }}
- values={{ email: userProfileEmail }}
- />
- </div>
- )}
- {!debugEnabled && onlyWholeTeam && (
- <div className="system-md-regular text-text-secondary">
- <Trans
- i18nKey={($) => $[`${i18nPrefix}.deliveryMethod.emailSender.wholeTeamDone2`]}
- ns="workflowHumanInput"
- components={{
- team: <span className="system-md-medium text-text-secondary"></span>,
- }}
- values={{ team: currentWorkspace.name.replace(/'/g, '’') }}
- />
- </div>
- )}
- {!debugEnabled && onlySpecificUsers && (
- <div className="system-md-regular text-text-secondary">
- {t(($) => $[`${i18nPrefix}.deliveryMethod.emailSender.wholeTeamDone3`], {
- ns: 'workflowHumanInput',
- })}
- </div>
- )}
- {!debugEnabled && combinedRecipients && (
- <div className="system-md-regular text-text-secondary">
- <Trans
- i18nKey={($) => $[`${i18nPrefix}.deliveryMethod.emailSender.wholeTeamDone1`]}
- ns="workflowHumanInput"
- components={{
- team: <span className="system-md-medium text-text-secondary"></span>,
- }}
- values={{ team: currentWorkspace.name.replace(/'/g, '’') }}
+ </DialogHeader>
+ <DialogBody>
+ <div className="space-y-2">
+ {debugEnabled && (
+ <div className="system-md-regular text-text-secondary">
+ <Trans
+ i18nKey={($) => $[`${i18nPrefix}.deliveryMethod.emailSender.debugDone`]}
+ ns="workflowHumanInput"
+ components={{
+ email: <span className="system-md-semibold text-text-secondary"></span>,
+ }}
+ values={{ email: userProfileEmail }}
+ />
+ </div>
+ )}
+ {!debugEnabled && onlyWholeTeam && (
+ <div className="system-md-regular text-text-secondary">
+ <Trans
+ i18nKey={($) => $[`${i18nPrefix}.deliveryMethod.emailSender.wholeTeamDone2`]}
+ ns="workflowHumanInput"
+ components={{
+ team: <span className="system-md-medium text-text-secondary"></span>,
+ }}
+ values={{ team: currentWorkspace.name.replace(/'/g, '’') }}
+ />
+ </div>
+ )}
+ {!debugEnabled && onlySpecificUsers && (
+ <div className="system-md-regular text-text-secondary">
+ {t(($) => $[`${i18nPrefix}.deliveryMethod.emailSender.wholeTeamDone3`], {
+ ns: 'workflowHumanInput',
+ })}
+ </div>
+ )}
+ {!debugEnabled && combinedRecipients && (
+ <div className="system-md-regular text-text-secondary">
+ <Trans
+ i18nKey={($) => $[`${i18nPrefix}.deliveryMethod.emailSender.wholeTeamDone1`]}
+ ns="workflowHumanInput"
+ components={{
+ team: <span className="system-md-medium text-text-secondary"></span>,
+ }}
+ values={{ team: currentWorkspace.name.replace(/'/g, '’') }}
+ />
+ </div>
+ )}
+ </div>
+ {(onlySpecificUsers || combinedRecipients) && !debugEnabled && (
+ <div className="mt-4">
+ <EmailInput
+ disabled
+ email={userProfileEmail}
+ value={config?.recipients?.items}
+ list={accounts}
+ onDelete={noop}
+ onSelect={noop}
+ onAdd={noop}
/>
</div>
)}
- </div>
- {(onlySpecificUsers || combinedRecipients) && !debugEnabled && (
- <div className="mt-4">
- <EmailInput
- disabled
- email={userProfileEmail}
- value={config?.recipients?.items}
- list={accounts}
- onDelete={noop}
- onSelect={noop}
- onAdd={noop}
- />
- </div>
- )}
- <div className="mt-6 flex flex-row-reverse gap-2">
+ </DialogBody>
+ <DialogFooter>
<Button variant="primary" className="w-18" onClick={() => onOpenChange(false)}>
{t(($) => $['operation.ok'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</>
)
}
return (
<>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="space-y-1 pr-8">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $[`${i18nPrefix}.deliveryMethod.emailSender.title`], {
ns: 'workflowHumanInput',
})}
@@ -393,86 +396,92 @@ const EmailSenderContent = ({
/>
</div>
)}
- </div>
- {(onlySpecificUsers || combinedRecipients) && !debugEnabled && (
- <>
- <div className="mt-4">
- <EmailInput
- disabled
- email={userProfileEmail}
- value={config?.recipients?.items}
- list={accounts}
- onDelete={noop}
- onSelect={noop}
- onAdd={noop}
- />
- </div>
- <div className="mt-1 system-xs-regular text-text-tertiary">
- <Trans
- i18nKey={($) => $[`${i18nPrefix}.deliveryMethod.emailSender.tip`]}
- ns="workflowHumanInput"
- components={{
- strong: (
- <button
- type="button"
- onClick={jumpToEmailConfigModal}
- className="inline cursor-pointer border-none bg-transparent p-0 text-left system-xs-regular text-text-accent"
- />
- ),
- }}
- />
- </div>
- </>
- )}
- {/* vars */}
- {generatedInputs.length > 0 && (
- <>
- <div>
- <Separator className="mt-4 mb-2 w-12" />
- </div>
- <div className="py-2">
- <button
- type="button"
- aria-expanded={!collapsed}
- className="group flex h-6 cursor-pointer items-center border-none bg-transparent p-0 text-left"
- onClick={() => setCollapsed(!collapsed)}
- >
- <div className="mr-1 system-sm-semibold-uppercase text-text-secondary">
- {t(($) => $[`${i18nPrefix}.deliveryMethod.emailSender.vars`], {
- ns: 'workflowHumanInput',
- })}
- </div>
- <RiArrowRightSFill
- className={cn(
- 'size-4 text-text-quaternary group-hover:text-text-primary',
- !collapsed && 'rotate-90',
- )}
- aria-hidden
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ {hasBody && (
+ <DialogBody>
+ {(onlySpecificUsers || combinedRecipients) && !debugEnabled && (
+ <>
+ <EmailInput
+ disabled
+ email={userProfileEmail}
+ value={config?.recipients?.items}
+ list={accounts}
+ onDelete={noop}
+ onSelect={noop}
+ onAdd={noop}
/>
- </button>
- <div className="system-xs-regular text-text-tertiary">
- {t(($) => $[`${i18nPrefix}.deliveryMethod.emailSender.varsTip`], {
- ns: 'workflowHumanInput',
- })}
- </div>
- {!collapsed && (
- <div className="mt-3 space-y-4">
- {generatedInputs.map((variable, index) => (
- <div key={variable.variable} className="mb-4 last-of-type:mb-0">
- <FormItem
- autoFocus={index === 0}
- payload={variable}
- value={inputs[variable.variable]}
- onChange={(v) => handleValueChange(variable.variable, v)}
- />
+ <div className="mt-1 system-xs-regular text-text-tertiary">
+ <Trans
+ i18nKey={($) => $[`${i18nPrefix}.deliveryMethod.emailSender.tip`]}
+ ns="workflowHumanInput"
+ components={{
+ strong: (
+ <button
+ type="button"
+ onClick={jumpToEmailConfigModal}
+ className="inline cursor-pointer border-none bg-transparent p-0 text-left system-xs-regular text-text-accent"
+ />
+ ),
+ }}
+ />
+ </div>
+ </>
+ )}
+ {/* vars */}
+ {generatedInputs.length > 0 && (
+ <>
+ <div>
+ <Separator className="mt-4 mb-2 w-12" />
+ </div>
+ <div className="py-2">
+ <button
+ type="button"
+ aria-expanded={!collapsed}
+ className="group flex h-6 cursor-pointer items-center border-none bg-transparent p-0 text-left"
+ onClick={() => setCollapsed(!collapsed)}
+ >
+ <div className="mr-1 system-sm-semibold-uppercase text-text-secondary">
+ {t(($) => $[`${i18nPrefix}.deliveryMethod.emailSender.vars`], {
+ ns: 'workflowHumanInput',
+ })}
+ </div>
+ <RiArrowRightSFill
+ className={cn(
+ 'size-4 text-text-quaternary group-hover:text-text-primary',
+ !collapsed && 'rotate-90',
+ )}
+ aria-hidden
+ />
+ </button>
+ <div className="system-xs-regular text-text-tertiary">
+ {t(($) => $[`${i18nPrefix}.deliveryMethod.emailSender.varsTip`], {
+ ns: 'workflowHumanInput',
+ })}
+ </div>
+ {!collapsed && (
+ <div className="mt-3 space-y-4">
+ {generatedInputs.map((variable, index) => (
+ <div key={variable.variable} className="mb-4 last-of-type:mb-0">
+ <FormItem
+ autoFocus={index === 0}
+ payload={variable}
+ value={inputs[variable.variable]}
+ onChange={(v) => handleValueChange(variable.variable, v)}
+ />
+ </div>
+ ))}
</div>
- ))}
+ )}
</div>
- )}
- </div>
- </>
+ </>
+ )}
+ </DialogBody>
)}
- <div className="mt-6 flex flex-row-reverse gap-2">
+ <DialogFooter>
+ <Button className="w-18" onClick={() => onOpenChange(false)}>
+ {t(($) => $['operation.cancel'], { ns: 'common' })}
+ </Button>
<Button
disabled={!confirmChecked}
loading={sendingEmail}
@@ -483,10 +492,7 @@ const EmailSenderContent = ({
ns: 'workflowHumanInput',
})}
</Button>
- <Button className="w-18" onClick={() => onOpenChange(false)}>
- {t(($) => $['operation.cancel'], { ns: 'common' })}
- </Button>
- </div>
+ </DialogFooter>
</>
)
}
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx
index 70adecb843d..4d7343246ee 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx
@@ -199,7 +199,10 @@ function JsonSchemaConfigContent({ defaultSchema, onSave }: JsonSchemaConfigProp
>
{/* Header */}
<div className="relative flex p-6 pr-14 pb-3">
- <DialogTitle className="grow truncate title-2xl-semi-bold text-text-primary">
+ <DialogTitle
+ // oxlint-disable-next-line shadcn/no-restyle -- Title shares the editor's header row with its actions.
+ className="grow"
+ >
{t(($) => $['nodes.llm.jsonSchema.title'], { ns: 'workflowModels' })}
</DialogTitle>
<DialogClose
diff --git a/web/app/components/workflow/nodes/llm/components/structure-output.tsx b/web/app/components/workflow/nodes/llm/components/structure-output.tsx
index db8af498aca..66efebb3ca7 100644
--- a/web/app/components/workflow/nodes/llm/components/structure-output.tsx
+++ b/web/app/components/workflow/nodes/llm/components/structure-output.tsx
@@ -72,7 +72,7 @@ export function StructureOutput({ className, value, onChange, readOnly }: Props)
{!readOnly && (
<Dialog handle={dialogHandle}>
<DialogContent
- className="h-[calc(100dvh-32px)] max-h-200 w-full max-w-240 overflow-hidden! border-none p-0 text-left align-middle"
+ className="h-[calc(100dvh-32px)] max-h-200 w-full max-w-240 overflow-hidden"
finalFocus={hasSchema ? configureButtonRef : undefined}
>
<JsonSchemaConfig defaultSchema={value?.schema} onSave={handleChange} />
diff --git a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx
index 2ecbc71b519..aa91e5c5e69 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx
+++ b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx
@@ -5,8 +5,11 @@ import type { MoreInfo } from '@/app/components/workflow/types'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
+ DialogBody,
DialogClose,
DialogContent,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
@@ -77,8 +80,10 @@ export function ParameterDialog(props: Props) {
</IconButton>
}
/>
- <DialogContent className="w-100! max-w-100! overflow-hidden! border-none p-4! text-left align-middle">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">{triggerLabel}</DialogTitle>
+ <DialogContent className="w-100 max-w-100">
+ <DialogHeader>
+ <DialogTitle>{triggerLabel}</DialogTitle>
+ </DialogHeader>
<ParameterForm {...props} onSaved={() => actionsRef.current?.close()} />
</DialogContent>
</Dialog>
@@ -162,7 +167,7 @@ function ParameterForm({ type, payload, onSave, onSaved }: Props & { onSaved: ()
handleSave()
}}
>
- <div className="space-y-2">
+ <DialogBody className="space-y-2">
<Field title={nameLabel}>
<Input
aria-label={nameLabel}
@@ -243,8 +248,8 @@ function ParameterForm({ type, payload, onSave, onSaved }: Props & { onSaved: ()
/>
</>
</Field>
- </div>
- <div className="mt-4 flex justify-end space-x-2">
+ </DialogBody>
+ <DialogFooter>
<DialogClose render={<Button className="w-23.75!" />}>
{t(($) => $['operation.cancel'], { ns: 'common' })}
</DialogClose>
@@ -253,7 +258,7 @@ function ParameterForm({ type, payload, onSave, onSaved }: Props & { onSaved: ()
? t(($) => $['operation.add'], { ns: 'common' })
: t(($) => $['operation.save'], { ns: 'common' })}
</Button>
- </div>
+ </DialogFooter>
</form>
)
}
diff --git a/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx b/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx
index 15070e5087b..f43e0cf9ff1 100644
--- a/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx
+++ b/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx
@@ -72,12 +72,7 @@ const ConversationVariableModal = ({ conversationID, onHide }: Props) => {
return (
<Dialog open>
- <DialogContent
- className={cn(
- 'w-full overflow-hidden! border-none text-left align-middle',
- cn('h-[min(640px,calc(100dvh-2rem))] max-h-none! w-230 max-w-[calc(100vw-2rem)] p-0'),
- )}
- >
+ <DialogContent className="h-[min(640px,calc(100dvh-2rem))] max-h-none w-230 overflow-hidden">
<button
type="button"
aria-label={t(($) => $['operation.close'], { ns: 'common' })}
diff --git a/web/app/components/workflow/update-dsl-modal.tsx b/web/app/components/workflow/update-dsl-modal.tsx
index 864c8e94bf6..3d1a7e2f682 100644
--- a/web/app/components/workflow/update-dsl-modal.tsx
+++ b/web/app/components/workflow/update-dsl-modal.tsx
@@ -3,8 +3,16 @@
import type { AppDetailWithSite, Import } from '@dify/contracts/api/console/apps/types.gen'
import type { MouseEventHandler } from 'react'
import { Button } from '@langgenius/dify-ui/button'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
-import { RiAlertFill, RiCloseLine, RiFileDownloadLine } from '@remixicon/react'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
+import { RiAlertFill, RiFileDownloadLine } from '@remixicon/react'
import { useMutation } from '@tanstack/react-query'
import { memo, useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -193,61 +201,56 @@ const UpdateDSLModal = ({ appId, appMode, onCancel, onBackup, onImport }: Update
if (!open && !isImporting) onCancel()
}}
>
- <DialogContent className="w-full max-w-120! overflow-hidden! rounded-2xl border-none p-6 text-left align-middle">
- <div className="mb-3 flex items-center justify-between">
- <div className="title-2xl-semi-bold text-text-primary">
- {t(($) => $.importApp, { ns: 'app' })}
- </div>
- <button
- type="button"
- className="flex h-5.5 w-5.5 cursor-pointer items-center justify-center border-none bg-transparent p-0 focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.importApp, { ns: 'app' })}</DialogTitle>
+ <DialogCloseButton
aria-label={t(($) => $['operation.close'], { ns: 'common' })}
disabled={isImporting}
- onClick={onCancel}
- >
- <RiCloseLine className="h-4.5 w-4.5 text-text-tertiary" aria-hidden="true" />
- </button>
- </div>
- <div className="relative mb-2 flex grow gap-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs">
- <div className="pointer-events-none absolute top-0 left-0 size-full bg-toast-warning-bg opacity-40" />
- <div className="flex items-start justify-center p-1">
- <RiAlertFill className="size-4 shrink-0 text-text-warning-secondary" />
+ />
+ </DialogHeader>
+ <DialogBody>
+ <div className="relative mb-2 flex grow gap-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs">
+ <div className="pointer-events-none absolute top-0 left-0 size-full bg-toast-warning-bg opacity-40" />
+ <div className="flex items-start justify-center p-1">
+ <RiAlertFill className="size-4 shrink-0 text-text-warning-secondary" />
+ </div>
+ <div className="flex grow flex-col items-start gap-0.5 py-1">
+ <div className="system-xs-medium whitespace-pre-line text-text-primary">
+ {t(($) => $['common.importDSLTip'], { ns: 'workflow' })}
+ </div>
+ <div className="flex items-start gap-1 self-stretch pt-1 pb-0.5">
+ <Button
+ size="small"
+ variant="secondary"
+ className="relative"
+ disabled={isImporting}
+ onClick={onBackup}
+ >
+ <RiFileDownloadLine className="size-3.5 text-components-button-secondary-text" />
+ <div className="flex items-center justify-center gap-1">
+ {t(($) => $['common.backupCurrentDraft'], { ns: 'workflow' })}
+ </div>
+ </Button>
+ </div>
+ </div>
</div>
- <div className="flex grow flex-col items-start gap-0.5 py-1">
- <div className="system-xs-medium whitespace-pre-line text-text-primary">
- {t(($) => $['common.importDSLTip'], { ns: 'workflow' })}
+ <div>
+ <div className="pt-2 system-md-semibold text-text-primary">
+ {t(($) => $.chooseAppFile, { ns: 'app' })}
</div>
- <div className="flex items-start gap-1 self-stretch pt-1 pb-0.5">
- <Button
- size="small"
- variant="secondary"
- className="relative"
+ <div className="flex w-full flex-col items-start justify-center gap-4 self-stretch py-4">
+ <Uploader
+ importType="app"
disabled={isImporting}
- onClick={onBackup}
- >
- <RiFileDownloadLine className="size-3.5 text-components-button-secondary-text" />
- <div className="flex items-center justify-center gap-1">
- {t(($) => $['common.backupCurrentDraft'], { ns: 'workflow' })}
- </div>
- </Button>
+ file={currentFile}
+ updateFile={setCurrentFile}
+ className="mt-0! w-full"
+ />
</div>
</div>
- </div>
- <div>
- <div className="pt-2 system-md-semibold text-text-primary">
- {t(($) => $.chooseAppFile, { ns: 'app' })}
- </div>
- <div className="flex w-full flex-col items-start justify-center gap-4 self-stretch py-4">
- <Uploader
- importType="app"
- disabled={isImporting}
- file={currentFile}
- updateFile={setCurrentFile}
- className="mt-0! w-full"
- />
- </div>
- </div>
- <div className="flex items-center justify-end gap-2 self-stretch pt-5">
+ </DialogBody>
+ <DialogFooter>
<Button disabled={isImporting} onClick={onCancel}>
{t(($) => $['newApp.Cancel'], { ns: 'app' })}
</Button>
@@ -260,7 +263,7 @@ const UpdateDSLModal = ({ appId, appMode, onCancel, onBackup, onImport }: Update
>
{t(($) => $['common.overwriteAndImport'], { ns: 'workflow' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
<Dialog
@@ -269,12 +272,12 @@ const UpdateDSLModal = ({ appId, appMode, onCancel, onBackup, onImport }: Update
if (!open && !isImporting) onCancel()
}}
>
- <DialogContent className="w-full max-w-120! overflow-hidden! border-none text-left align-middle">
- <div className="flex flex-col items-start gap-2 self-stretch pb-4">
- <div className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['newApp.appCreateDSLErrorTitle'], { ns: 'app' })}
- </div>
- <div className="flex grow flex-col system-md-regular text-text-secondary">
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['newApp.appCreateDSLErrorTitle'], { ns: 'app' })}</DialogTitle>
+ </DialogHeader>
+ <DialogBody>
+ <div className="flex flex-col system-md-regular text-text-secondary">
<div>{t(($) => $['newApp.appCreateDSLErrorPart1'], { ns: 'app' })}</div>
<div>{t(($) => $['newApp.appCreateDSLErrorPart2'], { ns: 'app' })}</div>
<br />
@@ -287,8 +290,8 @@ const UpdateDSLModal = ({ appId, appMode, onCancel, onBackup, onImport }: Update
<span className="system-md-medium">{pendingImport?.current_dsl_version}</span>
</div>
</div>
- </div>
- <div className="flex items-start justify-end gap-2 self-stretch pt-6">
+ </DialogBody>
+ <DialogFooter>
<Button variant="secondary" disabled={isImporting} onClick={onCancel}>
{t(($) => $['newApp.Cancel'], { ns: 'app' })}
</Button>
@@ -301,7 +304,7 @@ const UpdateDSLModal = ({ appId, appMode, onCancel, onBackup, onImport }: Update
>
{t(($) => $['newApp.Confirm'], { ns: 'app' })}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
</>
diff --git a/web/app/components/workflow/workflow-generator/index.tsx b/web/app/components/workflow/workflow-generator/index.tsx
index b755d9d529e..b42d0270483 100644
--- a/web/app/components/workflow/workflow-generator/index.tsx
+++ b/web/app/components/workflow/workflow-generator/index.tsx
@@ -591,13 +591,13 @@ function WorkflowGeneratorModal() {
>
<DialogContent
initialFocus={instructionRef}
- className="h-[min(680px,calc(100dvh-2rem))] max-h-none! w-[calc(100vw-2rem)] max-w-285! min-w-0 overflow-hidden! border-none p-0! text-left align-middle"
+ className="h-[min(680px,calc(100dvh-2rem))] max-h-none w-285 min-w-0 overflow-hidden"
>
<div className="flex h-full min-h-0 flex-col md:flex-row">
{/* Left pane: instructions + ideal output + model selector */}
<div className="max-h-[55%] w-full shrink-0 overflow-y-auto border-b border-divider-regular p-6 md:h-full md:max-h-none md:w-1/2 md:border-r md:border-b-0 lg:w-142.5">
<div className="mb-5">
- <DialogTitle className="text-lg leading-7 font-bold text-text-primary">
+ <DialogTitle>
{isRefine
? t(($) => $['workflowGenerator.refineTitle'], {
ns: 'workflowGenerator',
@@ -608,7 +608,7 @@ function WorkflowGeneratorModal() {
mode: modeLabel,
})}
</DialogTitle>
- <DialogDescription className="mt-1 text-[13px] font-normal text-text-tertiary">
+ <DialogDescription>
{isRefine
? t(($) => $['workflowGenerator.refineDescription'], { ns: 'workflowGenerator' })
: t(($) => $['workflowGenerator.description'], { ns: 'workflowGenerator' })}
diff --git a/web/app/education/expire-notice/modal.tsx b/web/app/education/expire-notice/modal.tsx
index 2096de27ac0..aa6403b28d9 100644
--- a/web/app/education/expire-notice/modal.tsx
+++ b/web/app/education/expire-notice/modal.tsx
@@ -1,8 +1,15 @@
'use client'
import { Button, buttonVariants } from '@langgenius/dify-ui/button'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useQueryState } from 'nuqs'
import * as React from 'react'
@@ -44,64 +51,64 @@ const ExpireNoticeModal: React.FC<Props> = ({ expireAt, expired, onClose }) => {
if (!open) onClose()
}}
>
- <DialogContent className="w-full max-w-150 overflow-hidden! border-none text-left align-middle">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {expired
- ? t(($) => $[`${i18nPrefix}.expired.title`], { ns: 'education' })
- : t(($) => $[`${i18nPrefix}.isAboutToExpire.title`], {
- ns: 'education',
- date: formatTime(
- expireAt,
- t(($) => $[`${i18nPrefix}.dateFormat`], { ns: 'education' }) as string,
- ),
- interpolation: { escapeValue: false },
- })}
- </DialogTitle>
+ <DialogContent className="w-150">
+ <DialogHeader>
+ <DialogTitle>
+ {expired
+ ? t(($) => $[`${i18nPrefix}.expired.title`], { ns: 'education' })
+ : t(($) => $[`${i18nPrefix}.isAboutToExpire.title`], {
+ ns: 'education',
+ date: formatTime(
+ expireAt,
+ t(($) => $[`${i18nPrefix}.dateFormat`], { ns: 'education' }) as string,
+ ),
+ interpolation: { escapeValue: false },
+ })}
+ </DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
- <div className="mt-5 space-y-5 body-md-regular text-text-secondary">
- <div>
- {expired ? (
- <>
- <div>{t(($) => $[`${i18nPrefix}.expired.summary.line1`], { ns: 'education' })}</div>
- <div>{t(($) => $[`${i18nPrefix}.expired.summary.line2`], { ns: 'education' })}</div>
- </>
- ) : (
- t(($) => $[`${i18nPrefix}.isAboutToExpire.summary`], { ns: 'education' })
- )}
- </div>
- <div>
- <strong className="block title-md-semi-bold">
- {t(($) => $[`${i18nPrefix}.stillInEducation.title`], { ns: 'education' })}
- </strong>
- {t(
- ($) => $[`${i18nPrefix}.stillInEducation.${expired ? 'expired' : 'isAboutToExpire'}`],
- { ns: 'education' },
- )}
- </div>
- <div>
- <strong className="block title-md-semi-bold">
- {t(($) => $[`${i18nPrefix}.alreadyGraduated.title`], { ns: 'education' })}
- </strong>
- {t(
- ($) => $[`${i18nPrefix}.alreadyGraduated.${expired ? 'expired' : 'isAboutToExpire'}`],
- { ns: 'education' },
- )}
+ <DialogBody>
+ <div className="space-y-5 body-md-regular text-text-secondary">
+ <div>
+ {expired ? (
+ <>
+ <div>
+ {t(($) => $[`${i18nPrefix}.expired.summary.line1`], { ns: 'education' })}
+ </div>
+ <div>
+ {t(($) => $[`${i18nPrefix}.expired.summary.line2`], { ns: 'education' })}
+ </div>
+ </>
+ ) : (
+ t(($) => $[`${i18nPrefix}.isAboutToExpire.summary`], { ns: 'education' })
+ )}
+ </div>
+ <div>
+ <strong className="block title-md-semi-bold">
+ {t(($) => $[`${i18nPrefix}.stillInEducation.title`], { ns: 'education' })}
+ </strong>
+ {t(
+ ($) =>
+ $[`${i18nPrefix}.stillInEducation.${expired ? 'expired' : 'isAboutToExpire'}`],
+ { ns: 'education' },
+ )}
+ </div>
+ <div>
+ <strong className="block title-md-semi-bold">
+ {t(($) => $[`${i18nPrefix}.alreadyGraduated.title`], { ns: 'education' })}
+ </strong>
+ {t(
+ ($) =>
+ $[`${i18nPrefix}.alreadyGraduated.${expired ? 'expired' : 'isAboutToExpire'}`],
+ { ns: 'education' },
+ )}
+ </div>
</div>
- </div>
- <div className="mt-7 flex items-center justify-between space-x-2">
+ </DialogBody>
+ <DialogFooter>
<Link
- className="flex items-center space-x-1 system-xs-regular text-text-accent"
+ className="me-auto flex items-center space-x-1 system-xs-regular text-text-accent"
href={eduDocLink}
target="_blank"
rel="noopener noreferrer"
@@ -109,37 +116,35 @@ const ExpireNoticeModal: React.FC<Props> = ({ expireAt, expired, onClose }) => {
<span>{t(($) => $.learn, { ns: 'education' })}</span>
<span className="i-ri-external-link-line size-3" aria-hidden="true" />
</Link>
- <div className="flex space-x-2">
- {expired && deploymentEdition === 'CLOUD' ? (
- <Button
- onClick={() => {
- onClose()
- setPricing('open')
- }}
- className="flex items-center"
- >
- <span
- className="i-custom-public-common-sparkles-soft-accent size-4"
- aria-hidden="true"
- />
- <span className="text-components-button-secondary-accent-text">
- {t(($) => $[`${i18nPrefix}.action.upgrade`], { ns: 'education' })}
- </span>
- </Button>
- ) : (
- <Button onClick={onClose}>
- {t(($) => $[`${i18nPrefix}.action.dismiss`], { ns: 'education' })}
- </Button>
- )}
- <Link
- className={buttonVariants({ variant: 'primary' })}
- href="/education/verify"
- onClick={onClose}
+ {expired && deploymentEdition === 'CLOUD' ? (
+ <Button
+ onClick={() => {
+ onClose()
+ setPricing('open')
+ }}
+ className="flex items-center"
>
- {t(($) => $[`${i18nPrefix}.action.reVerify`], { ns: 'education' })}
- </Link>
- </div>
- </div>
+ <span
+ className="i-custom-public-common-sparkles-soft-accent size-4"
+ aria-hidden="true"
+ />
+ <span className="text-components-button-secondary-accent-text">
+ {t(($) => $[`${i18nPrefix}.action.upgrade`], { ns: 'education' })}
+ </span>
+ </Button>
+ ) : (
+ <Button onClick={onClose}>
+ {t(($) => $[`${i18nPrefix}.action.dismiss`], { ns: 'education' })}
+ </Button>
+ )}
+ <Link
+ className={buttonVariants({ variant: 'primary' })}
+ href="/education/verify"
+ onClick={onClose}
+ >
+ {t(($) => $[`${i18nPrefix}.action.reVerify`], { ns: 'education' })}
+ </Link>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx b/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx
index 9f17e4c1228..fd742ec9a11 100644
--- a/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx
+++ b/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx
@@ -1237,7 +1237,7 @@ describe('Agent access surface cards', () => {
expect(screen.getByRole('textbox', { name: 'appApi.apiKeyModal.secretKey' })).toHaveValue(
'app-new-secret-key-token',
)
- const result = screen.getByRole('alertdialog', { name: 'appApi.apiKeyModal.createdTitle' })
+ const result = screen.getByRole('dialog', { name: 'appApi.apiKeyModal.createdTitle' })
await user.click(within(result).getByRole('button', { name: 'appApi.apiKeyModal.saved' }))
await user.click(
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/upload-dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/upload-dialog.tsx
index 7222d52130b..38ada2e4247 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/upload-dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/upload-dialog.tsx
@@ -12,9 +12,12 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import { FileTreeIcon } from '@langgenius/dify-ui/file-tree'
@@ -141,7 +144,6 @@ function AgentFileUploader({ file, onChange }: { file?: File; onChange: (file?:
return (
<div
- className="mt-6"
role="group"
aria-label={t(($) => $['agentDetail.configure.files.upload.title'])}
onDragEnter={handleDragEnter}
@@ -323,25 +325,17 @@ export function AgentFileUploadDialog({
return (
<Dialog open={open} onOpenChange={handleOpenChange} disablePointerDismissal>
<DialogContent backdropProps={{ forceRender: true, className: 'fixed' }}>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['agentDetail.configure.files.upload.title'])}
- </DialogTitle>
- <DialogDescription className="mt-1 system-sm-regular text-text-tertiary">
- {t(($) => $['agentDetail.configure.files.upload.description'])}
- </DialogDescription>
- <AgentFileUploader file={file} onChange={setFile} />
- <div className="flex justify-end gap-2 pt-6">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['agentDetail.configure.files.upload.title'])}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $['agentDetail.configure.files.upload.description'])}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <AgentFileUploader file={file} onChange={setFile} />
+ </DialogBody>
+ <DialogFooter>
<Button type="button" onClick={() => handleOpenChange(false)} disabled={isUploading}>
{tCommon(($) => $['operation.cancel'])}
</Button>
@@ -354,7 +348,7 @@ export function AgentFileUploadDialog({
>
{t(($) => $['agentDetail.configure.files.upload.action'])}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/dialog.tsx
index 6d16d5e6e5d..9cb4377f277 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/dialog.tsx
@@ -747,7 +747,7 @@ export function AgentKnowledgeRetrievalDialog({
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
backdropProps={{ forceRender: true }}
- className="flex h-130 max-h-[calc(100dvh-2rem)] w-100 flex-col overflow-hidden p-0"
+ className="flex h-130 max-h-[calc(100dvh-2rem)] w-100 flex-col overflow-hidden"
>
<AgentKnowledgeRetrievalDialogContent
item={item}
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/__tests__/index.spec.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/__tests__/index.spec.tsx
index 835dd189af7..f3a28a4d7d8 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/__tests__/index.spec.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/__tests__/index.spec.tsx
@@ -1733,21 +1733,6 @@ describe('AgentSkills', () => {
})
})
- it('should wrap long preview lines instead of forcing a horizontal code block', async () => {
- const user = userEvent.setup()
- renderAgentSkills()
-
- await user.click(screen.getByText('Tender Analyzer').closest('button')!)
-
- const skillMdCode = await screen.findByText('# Skill')
- expect(skillMdCode.tagName).toBe('CODE')
- expect(skillMdCode).toHaveClass('wrap-anywhere')
- expect(skillMdCode).toHaveClass('wrap-break-word')
- expect(skillMdCode).toHaveClass('whitespace-pre-wrap')
- expect(skillMdCode).not.toHaveClass('whitespace-pre')
- expect(skillMdCode).not.toHaveClass('min-w-max')
- })
-
it('should download skill package members from the detail file tree', async () => {
const user = userEvent.setup()
const { queryClient } = renderAgentSkills()
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx
index 5306e0cc513..24af8b73639 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx
@@ -327,7 +327,7 @@ function AgentFilePreviewContent({
>
{line.lineNumber}
</span>
- <code className="block min-w-0 flex-1 wrap-anywhere wrap-break-word whitespace-pre-wrap text-text-primary">
+ <code className="block min-w-0 flex-1 wrap-anywhere whitespace-pre-wrap text-text-primary">
{line.content}
</code>
</div>
@@ -351,7 +351,7 @@ export function AgentSkillDetailDialog({
return (
<DialogContent
backdropProps={{ forceRender: true, className: 'fixed' }}
- className="flex h-[min(720px,calc(100dvh-2rem))] max-h-none w-[min(960px,calc(100vw-2rem))] flex-row overflow-hidden rounded-2xl p-0"
+ className="flex h-[min(720px,calc(100dvh-2rem))] max-h-none w-[min(960px,calc(100vw-2rem))] overflow-hidden"
>
<div
className={cn(
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/upload-dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/upload-dialog.tsx
index b666e04d314..36d9ea3d618 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/upload-dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/upload-dialog.tsx
@@ -9,9 +9,12 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import { IconButton } from '@langgenius/dify-ui/icon-button'
@@ -139,7 +142,6 @@ function AgentSkillPackageUploader({
return (
<div
- className="mt-6"
role="group"
aria-label={t(($) => $['agentDetail.configure.skills.upload.title'])}
onDragEnter={handleDragEnter}
@@ -327,29 +329,21 @@ export function AgentSkillUploadDialog({
return (
<Dialog open={open} onOpenChange={handleOpenChange} disablePointerDismissal>
<DialogContent backdropProps={{ forceRender: true, className: 'fixed' }}>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['agentDetail.configure.skills.upload.title'])}
- </DialogTitle>
- <DialogDescription className="mt-1 system-sm-regular text-text-tertiary">
- {t(($) => $['agentDetail.configure.skills.upload.description'])}
- </DialogDescription>
- <AgentSkillPackageUploader
- file={file}
- onChange={setFile}
- showWarning={uploadSkillMutation.isError}
- />
- <div className="flex justify-end gap-2 pt-6">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['agentDetail.configure.skills.upload.title'])}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $['agentDetail.configure.skills.upload.description'])}
+ </DialogDescription>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody>
+ <AgentSkillPackageUploader
+ file={file}
+ onChange={setFile}
+ showWarning={uploadSkillMutation.isError}
+ />
+ </DialogBody>
+ <DialogFooter>
<Button
type="button"
onClick={() => handleOpenChange(false)}
@@ -366,7 +360,7 @@ export function AgentSkillUploadDialog({
>
{t(($) => $['agentDetail.configure.skills.upload.action'])}
</Button>
- </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx
index f934a29ae11..26345f3ea40 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx
@@ -7,14 +7,16 @@ import type {
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogBody,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import { Field, FieldDescription, FieldLabel } from '@langgenius/dify-ui/field'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Input } from '@langgenius/dify-ui/input'
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -161,20 +163,9 @@ export function CliToolDialog({
return (
<Dialog open={open} onOpenChange={handleOpenChange} disablePointerDismissal>
- <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-160 flex-col overflow-hidden p-0">
- <div className="relative px-6 pt-6 pb-3">
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogContent className="max-h-[calc(100dvh-2rem)] w-160">
+ <DialogHeader>
+ <DialogTitle>
{t(
($) =>
$[
@@ -184,15 +175,13 @@ export function CliToolDialog({
],
)}
</DialogTitle>
- <DialogDescription className="mt-1 system-xs-regular text-text-tertiary">
+ <DialogDescription>
{t(($) => $['agentDetail.configure.tools.cliDialog.description'])}
</DialogDescription>
- </div>
- <Form<CliToolFormValues>
- className="min-h-0 flex-1 overflow-y-auto px-6 py-3"
- onFormSubmit={handleSubmit}
- >
- <div className="flex flex-col gap-4">
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <Form<CliToolFormValues> onFormSubmit={handleSubmit}>
+ <DialogBody className="flex flex-col gap-4">
<Field name="installCommand">
<FieldLabel>
{t(($) => $['agentDetail.configure.tools.cliDialog.installCommand.label'])}
@@ -245,36 +234,32 @@ export function CliToolDialog({
showScope={false}
/>
</div>
- </div>
- <div className="flex items-center gap-3 py-8">
+ </DialogBody>
+ <DialogFooter>
<a
href={docLink()}
target="_blank"
rel="noreferrer"
- className="inline-flex min-w-0 flex-1 items-center gap-1 system-xs-regular text-text-accent hover:underline focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
+ className="me-auto inline-flex min-w-0 items-center gap-1 system-xs-regular text-text-accent hover:underline focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
>
<span>{t(($) => $['agentDetail.configure.tools.cliDialog.learnMore'])}</span>
<span aria-hidden className="i-ri-external-link-line size-3" />
</a>
- <div className="flex shrink-0 items-center gap-3">
- {mode === 'edit' && tool && onDeleteCliTool && (
- <div className="flex items-center gap-3">
- <Button type="button" tone="destructive" onClick={handleDelete}>
- {tCommon(($) => $['operation.remove'])}
- </Button>
- <div className="h-4 w-px bg-divider-regular" aria-hidden />
- </div>
- )}
- <div className="flex items-center gap-2">
- <Button type="button" onClick={handleCancel}>
- {tCommon(($) => $['operation.cancel'])}
- </Button>
- <Button type="submit" variant="primary">
- {tCommon(($) => $[mode === 'edit' ? 'operation.save' : 'operation.add'])}
+ {mode === 'edit' && tool && onDeleteCliTool && (
+ <>
+ <Button type="button" tone="destructive" onClick={handleDelete}>
+ {tCommon(($) => $['operation.remove'])}
</Button>
- </div>
- </div>
- </div>
+ <div className="h-4 w-px bg-divider-regular" aria-hidden />
+ </>
+ )}
+ <Button type="button" onClick={handleCancel}>
+ {tCommon(($) => $['operation.cancel'])}
+ </Button>
+ <Button type="submit" variant="primary">
+ {tCommon(($) => $[mode === 'edit' ? 'operation.save' : 'operation.add'])}
+ </Button>
+ </DialogFooter>
</Form>
<div className="flex items-start justify-center gap-1 border-t-[0.5px] border-divider-subtle bg-background-soft px-2 py-3">
<span aria-hidden className="mt-0.5 i-ri-lock-2-fill size-3 text-text-tertiary" />
diff --git a/web/features/agent-v2/roster/components/agent-form-fields.tsx b/web/features/agent-v2/roster/components/agent-form-fields.tsx
index 0fc7521ffef..8b454af1de0 100644
--- a/web/features/agent-v2/roster/components/agent-form-fields.tsx
+++ b/web/features/agent-v2/roster/components/agent-form-fields.tsx
@@ -1,6 +1,7 @@
import type { Ref } from 'react'
import type { AgentFormValues, AgentIconSelection } from './agent-form'
import type { IconPickerValue } from '@/app/components/base/icon-picker'
+import { DialogBody } from '@langgenius/dify-ui/dialog'
import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'
import { Input } from '@langgenius/dify-ui/input'
import { Textarea } from '@langgenius/dify-ui/textarea'
@@ -31,7 +32,7 @@ export function AgentFormFields({
const { t: tCommon } = useTranslation(['common'])
return (
- <div className="min-h-0 flex-1 space-y-5 overflow-y-auto overscroll-contain px-6 py-3">
+ <DialogBody className="space-y-5">
<div className="flex items-start gap-4">
<IconPicker value={icon} onValueChange={onIconChange}>
<IconPickerTrigger aria-label={iconAriaLabel} className="shrink-0 rounded-full">
@@ -99,6 +100,6 @@ export function AgentFormFields({
})}
/>
</Field>
- </div>
+ </DialogBody>
)
}
diff --git a/web/features/agent-v2/roster/components/create-agent-dialog.tsx b/web/features/agent-v2/roster/components/create-agent-dialog.tsx
index 1b8122cfa5e..ad7dc6c8444 100644
--- a/web/features/agent-v2/roster/components/create-agent-dialog.tsx
+++ b/web/features/agent-v2/roster/components/create-agent-dialog.tsx
@@ -5,14 +5,15 @@ import type { AgentFormValues, AgentIconSelection } from './agent-form'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from '@langgenius/dify-ui/dialog'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useMutation } from '@tanstack/react-query'
import { useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -54,18 +55,14 @@ function CreateAgentFormSession({
return (
<>
- <div className="shrink-0 ps-6 pe-14 pt-6 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['roster.createDialog.title'], { ns: 'agentRoster' })}
- </DialogTitle>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['roster.createDialog.title'], { ns: 'agentRoster' })}</DialogTitle>
<DialogDescription className="sr-only">
{t(($) => $['roster.createDialog.description'], { ns: 'agentRoster' })}
</DialogDescription>
- </div>
- <Form<AgentFormValues>
- className="flex min-h-0 flex-1 flex-col"
- onFormSubmit={(formValues) => onSubmit(formValues, agentIcon)}
- >
+ <DialogCloseButton aria-label={tCommon(($) => $['operation.close'])} disabled={pending} />
+ </DialogHeader>
+ <Form<AgentFormValues> onFormSubmit={(formValues) => onSubmit(formValues, agentIcon)}>
<AgentFormFields
ref={nameInputRef}
defaultValues={createAgentDefaultValues}
@@ -73,14 +70,14 @@ function CreateAgentFormSession({
iconAriaLabel={t(($) => $['roster.createForm.changeIcon'], { ns: 'agentRoster' })}
onIconChange={setAgentIcon}
/>
- <div className="flex shrink-0 justify-end gap-2 px-6 pt-5 pb-6">
+ <DialogFooter>
<Button type="button" className="min-w-18" onClick={onCancel} disabled={pending}>
{tCommon(($) => $['operation.cancel'])}
</Button>
<Button type="submit" variant="primary" className="min-w-18" loading={pending}>
{tCommon(($) => $['operation.create'])}
</Button>
- </div>
+ </DialogFooter>
</Form>
</>
)
@@ -148,22 +145,7 @@ export function CreateAgentDialog({ open, onOpenChange }: CreateAgentDialogProps
</span>
</DialogTrigger>
)}
- <DialogContent
- initialFocus={nameInputRef}
- className="flex max-h-[calc(100dvh-2rem)] w-130 flex-col overflow-hidden! p-0!"
- >
- <DialogClose
- disabled={createAgentMutation.isPending}
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-5 top-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
+ <DialogContent initialFocus={nameInputRef} className="max-h-[calc(100dvh-2rem)] w-130">
<CreateAgentFormSession
nameInputRef={nameInputRef}
pending={createAgentMutation.isPending}
diff --git a/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx b/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx
index e8cd2a9c8bf..4e110fa4c0c 100644
--- a/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx
+++ b/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx
@@ -5,13 +5,14 @@ import type { AgentFormSource, AgentFormValues, AgentIconSelection } from './age
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -60,8 +61,8 @@ function DuplicateAgentFormSession({
return (
<>
- <div className="shrink-0 ps-6 pe-14 pt-6 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
+ <DialogHeader>
+ <DialogTitle>
{t(($) => $['roster.duplicateDialog.title'], { ns: 'agentRoster' })}
</DialogTitle>
<DialogDescription className="sr-only">
@@ -70,11 +71,9 @@ function DuplicateAgentFormSession({
name: initialValues.sourceName,
})}
</DialogDescription>
- </div>
- <Form<AgentFormValues>
- className="flex min-h-0 flex-1 flex-col"
- onFormSubmit={(formValues) => onSubmit(formValues, agentIcon)}
- >
+ <DialogCloseButton aria-label={tCommon(($) => $['operation.close'])} disabled={pending} />
+ </DialogHeader>
+ <Form<AgentFormValues> onFormSubmit={(formValues) => onSubmit(formValues, agentIcon)}>
<AgentFormFields
ref={nameInputRef}
defaultValues={initialValues.fields}
@@ -85,21 +84,20 @@ function DuplicateAgentFormSession({
})}
onIconChange={setAgentIcon}
/>
- <div className="flex shrink-0 justify-end gap-2 px-6 pt-5 pb-6">
+ <DialogFooter>
<Button type="button" className="min-w-18" onClick={onCancel} disabled={pending}>
{tCommon(($) => $['operation.cancel'])}
</Button>
<Button type="submit" variant="primary" className="min-w-18" loading={pending}>
{tCommon(($) => $['operation.duplicate'])}
</Button>
- </div>
+ </DialogFooter>
</Form>
</>
)
}
export function DuplicateAgentDialog({ agent, open, onOpenChange }: DuplicateAgentDialogProps) {
- const { t } = useTranslation(['common', 'agentRoster'])
const queryClient = useQueryClient()
const latestAgent =
queryClient.getQueryData<AgentFormSource>(
@@ -150,22 +148,7 @@ export function DuplicateAgentDialog({ agent, open, onOpenChange }: DuplicateAge
return (
<>
<Dialog open={open} onOpenChange={handleOpenChange} disablePointerDismissal>
- <DialogContent
- initialFocus={nameInputRef}
- className="flex max-h-[calc(100dvh-2rem)] w-130 flex-col overflow-hidden! p-0!"
- >
- <DialogClose
- disabled={duplicateAgentMutation.isPending}
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-5 top-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
+ <DialogContent initialFocus={nameInputRef} className="max-h-[calc(100dvh-2rem)] w-130">
<DuplicateAgentFormSession
key={latestAgent.id}
agent={latestAgent}
diff --git a/web/features/agent-v2/roster/components/edit-agent-dialog.tsx b/web/features/agent-v2/roster/components/edit-agent-dialog.tsx
index e34b9631670..1d099ec49ff 100644
--- a/web/features/agent-v2/roster/components/edit-agent-dialog.tsx
+++ b/web/features/agent-v2/roster/components/edit-agent-dialog.tsx
@@ -5,13 +5,14 @@ import type { AgentFormSource, AgentFormValues, AgentIconSelection } from './age
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
- DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import { Form } from '@langgenius/dify-ui/form'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useMutation } from '@tanstack/react-query'
import { useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -80,16 +81,14 @@ function EditAgentFormSession({
return (
<>
- <div className="shrink-0 ps-6 pe-14 pt-6 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['roster.editDialog.title'], { ns: 'agentRoster' })}
- </DialogTitle>
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['roster.editDialog.title'], { ns: 'agentRoster' })}</DialogTitle>
<DialogDescription className="sr-only">
{t(($) => $['roster.editDialog.description'], { ns: 'agentRoster' })}
</DialogDescription>
- </div>
+ <DialogCloseButton aria-label={tCommon(($) => $['operation.close'])} disabled={pending} />
+ </DialogHeader>
<Form<AgentFormValues>
- className="flex min-h-0 flex-1 flex-col"
onChange={handleFormChange}
onFormSubmit={(formValues) => {
if (hasChanges) onSubmit(formValues, agentIcon)
@@ -102,7 +101,7 @@ function EditAgentFormSession({
iconAriaLabel={t(($) => $['roster.createForm.changeIcon'], { ns: 'agentRoster' })}
onIconChange={setAgentIcon}
/>
- <div className="flex shrink-0 justify-end gap-2 px-6 pt-5 pb-6">
+ <DialogFooter>
<Button type="button" className="min-w-18" onClick={onCancel} disabled={pending}>
{tCommon(($) => $['operation.cancel'])}
</Button>
@@ -115,14 +114,13 @@ function EditAgentFormSession({
>
{tCommon(($) => $['operation.save'])}
</Button>
- </div>
+ </DialogFooter>
</Form>
</>
)
}
export function EditAgentDialog({ agent, open, onOpenChange }: EditAgentDialogProps) {
- const { t } = useTranslation(['common'])
const nameInputRef = useRef<HTMLInputElement>(null)
const updateAgentMutation = useMutation(consoleQuery.agent.byAgentId.put.mutationOptions())
@@ -162,22 +160,7 @@ export function EditAgentDialog({ agent, open, onOpenChange }: EditAgentDialogPr
return (
<>
<Dialog open={open} onOpenChange={handleOpenChange} disablePointerDismissal>
- <DialogContent
- initialFocus={nameInputRef}
- className="flex max-h-[calc(100dvh-2rem)] w-130 flex-col overflow-hidden! p-0!"
- >
- <DialogClose
- disabled={updateAgentMutation.isPending}
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute inset-e-5 top-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
+ <DialogContent initialFocus={nameInputRef} className="max-h-[calc(100dvh-2rem)] w-130">
<EditAgentFormSession
key={agent.id}
agent={agent}
diff --git a/web/features/skills/detail/upload-dialogs.tsx b/web/features/skills/detail/upload-dialogs.tsx
index 76a13a41aaf..8591e96fda3 100644
--- a/web/features/skills/detail/upload-dialogs.tsx
+++ b/web/features/skills/detail/upload-dialogs.tsx
@@ -6,12 +6,15 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
+ DialogBody,
DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useTranslation } from 'react-i18next'
import { getPathBaseName } from './shared'
import { isUploadReviewItemSkipped, isUploadReviewResolved } from './upload-workflow'
@@ -169,27 +172,13 @@ export function SkillUploadReviewDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="w-150 max-w-[calc(100vw-32px)] overflow-hidden! p-0!">
- <DialogClose
- render={
- <IconButton
- aria-label={tCommon(($) => $['operation.close'])}
- size="lg"
- className="absolute inset-e-5 top-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <header className="px-6 pt-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['skillManagement.detail.uploadReviewTitle'])}
- </DialogTitle>
- <DialogDescription className="mt-1 system-xs-regular text-text-tertiary">
- {summary}
- </DialogDescription>
- </header>
- <div className="flex max-h-[min(520px,60dvh)] flex-col gap-4 overflow-y-auto px-6 py-3">
+ <DialogContent className="w-150 max-w-[calc(100vw-32px)]">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['skillManagement.detail.uploadReviewTitle'])}</DialogTitle>
+ <DialogDescription>{summary}</DialogDescription>
+ <DialogCloseButton aria-label={tCommon(($) => $['operation.close'])} />
+ </DialogHeader>
+ <DialogBody className="flex flex-col gap-4">
{candidateItems.length > 0 && (
<div className="flex flex-col gap-1">
{candidateItems.map((item) => (
@@ -209,8 +198,8 @@ export function SkillUploadReviewDialog({
))}
</section>
)}
- </div>
- <footer className="flex h-19 items-start justify-end gap-2 px-6 pt-5 pb-6">
+ </DialogBody>
+ <DialogFooter>
<DialogClose render={<Button size="large" />}>
{tCommon(($) => $['operation.cancel'])}
</DialogClose>
@@ -222,7 +211,7 @@ export function SkillUploadReviewDialog({
>
{t(($) => $['skillManagement.detail.uploadFilesButton'], { count: readyCount })}
</Button>
- </footer>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
@@ -249,30 +238,18 @@ export function SkillUploadFailuresDialog({
const retryableItems = failedItems.filter((item) => item.failureKind !== 'conflict')
return (
<Dialog open={open} onOpenChange={(nextOpen) => !nextOpen && onDismiss()}>
- <DialogContent className="w-150 max-w-[calc(100vw-32px)] overflow-hidden! p-0!">
- <DialogClose
- render={
- <IconButton
- aria-label={tCommon(($) => $['operation.close'])}
- size="lg"
- className="absolute inset-e-5 top-5"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <header className="px-6 pt-6 pr-14 pb-3">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['skillManagement.detail.uploadFailureTitle'])}
- </DialogTitle>
- <DialogDescription className="mt-1 system-xs-regular text-text-tertiary">
+ <DialogContent className="w-150 max-w-[calc(100vw-32px)]">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['skillManagement.detail.uploadFailureTitle'])}</DialogTitle>
+ <DialogDescription>
{t(($) => $['skillManagement.detail.uploadFailureSummary'], {
failed: failedItems.length,
total: items.length,
})}
</DialogDescription>
- </header>
- <div className="flex max-h-[min(520px,60dvh)] flex-col gap-1 overflow-y-auto px-6 py-3">
+ <DialogCloseButton aria-label={tCommon(($) => $['operation.close'])} />
+ </DialogHeader>
+ <DialogBody className="flex flex-col gap-1">
{failedItems.map((item) => (
<UploadRowShell
key={item.id}
@@ -299,8 +276,8 @@ export function SkillUploadFailuresDialog({
}
/>
))}
- </div>
- <footer className="flex h-19 items-start justify-end gap-2 px-6 pt-5 pb-6">
+ </DialogBody>
+ <DialogFooter>
<DialogClose render={<Button size="large" />}>
{tCommon(($) => $['operation.cancel'])}
</DialogClose>
@@ -314,7 +291,7 @@ export function SkillUploadFailuresDialog({
count: retryableItems.length,
})}
</Button>
- </footer>
+ </DialogFooter>
</DialogContent>
</Dialog>
)
diff --git a/web/features/skills/detail/version-panel.tsx b/web/features/skills/detail/version-panel.tsx
index c6749ad8067..a50e69c155c 100644
--- a/web/features/skills/detail/version-panel.tsx
+++ b/web/features/skills/detail/version-panel.tsx
@@ -16,9 +16,13 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
+ DialogBody,
DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import {
@@ -29,7 +33,6 @@ 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 { Input } from '@langgenius/dify-ui/input'
import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover'
import { Textarea } from '@langgenius/dify-ui/textarea'
@@ -345,27 +348,15 @@ function VersionRow({
</div>
</li>
<Dialog open={renameOpen} onOpenChange={setRenameOpen}>
- <DialogContent className="w-full max-w-120 overflow-hidden! border-none p-0 text-left align-middle">
- <DialogClose
- render={
- <IconButton
- aria-label={tCommon(($) => $['operation.close'])}
- size="lg"
- className="absolute inset-e-6 top-6"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="px-6 pt-6 pr-14 pb-4">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {versionInfoLabel}
- </DialogTitle>
+ <DialogContent className="w-120">
+ <DialogHeader>
+ <DialogTitle>{versionInfoLabel}</DialogTitle>
<DialogDescription className="sr-only">
{t(($) => $['skillManagement.detail.renameVersionPrompt'])}
</DialogDescription>
- </div>
- <div className="flex flex-col gap-y-4 px-6 py-3">
+ <DialogCloseButton aria-label={tCommon(($) => $['operation.close'])} />
+ </DialogHeader>
+ <DialogBody className="flex flex-col gap-y-4">
<Field name="versionTitle">
<FieldLabel className="system-sm-semibold">
{t(($) => $['skillManagement.detail.versionTitle'])}
@@ -386,17 +377,15 @@ function VersionRow({
onValueChange={setPublishNote}
/>
</Field>
- </div>
- <div className="flex justify-end p-6 pt-5">
- <div className="flex items-center gap-x-3">
- <DialogClose render={<Button disabled={renameMutation.isPending} />}>
- {tCommon(($) => $['operation.cancel'])}
- </DialogClose>
- <Button variant="primary" loading={renameMutation.isPending} onClick={handleRename}>
- {t(($) => $['skillManagement.detail.publish'])}
- </Button>
- </div>
- </div>
+ </DialogBody>
+ <DialogFooter>
+ <DialogClose render={<Button disabled={renameMutation.isPending} />}>
+ {tCommon(($) => $['operation.cancel'])}
+ </DialogClose>
+ <Button variant="primary" loading={renameMutation.isPending} onClick={handleRename}>
+ {t(($) => $['skillManagement.detail.publish'])}
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
<AlertDialog
diff --git a/web/features/skills/page.tsx b/web/features/skills/page.tsx
index 660ebccea2c..af4326131b0 100644
--- a/web/features/skills/page.tsx
+++ b/web/features/skills/page.tsx
@@ -17,9 +17,13 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
Dialog,
+ DialogBody,
DialogClose,
+ DialogCloseButton,
DialogContent,
DialogDescription,
+ DialogFooter,
+ DialogHeader,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
import {
@@ -883,20 +887,11 @@ function ImportSkillDialogForm({
if (file && !importing) onImport(file)
}}
>
- <div className="flex items-center justify-between border-b border-divider-subtle px-5 py-4">
- <DialogTitle className="title-2xl-semi-bold text-text-primary">
- {t(($) => $['skillManagement.importDialog.title'])}
- </DialogTitle>
- <DialogClose
- disabled={importing}
- render={
- <IconButton aria-label={tCommon(($) => $['operation.close'])}>
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- </div>
- <div className="p-5">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['skillManagement.importDialog.title'])}</DialogTitle>
+ <DialogCloseButton aria-label={tCommon(($) => $['operation.close'])} disabled={importing} />
+ </DialogHeader>
+ <DialogBody>
<div
role="group"
aria-label={t(($) => $['skillManagement.importDialog.title'])}
@@ -984,7 +979,8 @@ function ImportSkillDialogForm({
)}
<DialogDescription
id={descriptionId}
- className="text-center system-sm-regular text-text-tertiary"
+ // oxlint-disable-next-line shadcn/no-restyle -- Description is centred under the upload drop zone.
+ className="text-center"
>
{t(($) => $['skillManagement.importDialog.description'])}
</DialogDescription>
@@ -994,15 +990,15 @@ function ImportSkillDialogForm({
{t(($) => $['skillManagement.importDialog.invalidFile'])}
</p>
)}
- </div>
- <div className="flex justify-end gap-2 border-t border-divider-subtle px-5 py-4">
+ </DialogBody>
+ <DialogFooter>
<DialogClose disabled={importing} render={<Button />}>
{tCommon(($) => $['operation.cancel'])}
</DialogClose>
<Button type="submit" variant="primary" disabled={!file} loading={importing}>
{t(($) => $['skillManagement.import'])}
</Button>
- </div>
+ </DialogFooter>
</form>
)
}
@@ -1242,7 +1238,7 @@ export default function SkillsPage() {
if (!importMutation.isPending) setImportOpen(open)
}}
>
- <DialogContent className="p-0">
+ <DialogContent>
<ImportSkillDialogForm importing={importMutation.isPending} onImport={handleImport} />
</DialogContent>
</Dialog>
diff --git a/web/features/tag-management/components/tag-management-modal.tsx b/web/features/tag-management/components/tag-management-modal.tsx
index 9c424ad5d05..c2a7490c1c8 100644
--- a/web/features/tag-management/components/tag-management-modal.tsx
+++ b/web/features/tag-management/components/tag-management-modal.tsx
@@ -1,7 +1,13 @@
'use client'
import type { TagType } from '@dify/contracts/api/console/tags/types.gen'
-import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
+import {
+ Dialog,
+ DialogBody,
+ DialogCloseButton,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from '@langgenius/dify-ui/dialog'
import { useMutation, useQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import { useState } from 'react'
@@ -73,22 +79,12 @@ export const TagManagementModal = ({
return (
<Dialog open={show} onOpenChange={(open) => !open && handleClose()}>
- <DialogContent className="w-150 rounded-xl p-8">
- <DialogTitle className="relative pb-2 text-xl/7.5 font-semibold text-text-primary">
- {t(($) => $['tag.manageTags'], { ns: 'common' })}
- </DialogTitle>
- <DialogClose
- render={
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- size="lg"
- className="absolute top-4 right-4"
- >
- <span aria-hidden className="i-ri-close-line size-4" />
- </IconButton>
- }
- />
- <div className="mt-3 flex flex-wrap gap-2">
+ <DialogContent className="w-150">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $['tag.manageTags'], { ns: 'common' })}</DialogTitle>
+ <DialogCloseButton aria-label={t(($) => $['operation.close'], { ns: 'common' })} />
+ </DialogHeader>
+ <DialogBody className="flex flex-wrap gap-2">
<input
aria-label={t(($) => $['tag.addNew'], { ns: 'common' }) || ''}
className="w-25 shrink-0 appearance-none rounded-lg border border-dashed border-divider-regular bg-transparent px-2 py-1 text-sm/5 text-text-secondary caret-primary-600 outline-hidden placeholder:text-text-quaternary focus:border-solid"
@@ -101,7 +97,7 @@ export const TagManagementModal = ({
{tagList.map((tag) => (
<TagItemEditor key={tag.id} tag={tag} onTagsChange={onTagsChange} />
))}
- </div>
+ </DialogBody>
</DialogContent>
</Dialog>
)
diff --git a/web/hooks/use-pay.tsx b/web/hooks/use-pay.tsx
index 91351e7c9cb..b225d6ecf1b 100644
--- a/web/hooks/use-pay.tsx
+++ b/web/hooks/use-pay.tsx
@@ -1,87 +1,43 @@
'use client'
-import {
- AlertDialog,
- AlertDialogConfirmButton,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogTitle,
-} from '@langgenius/dify-ui/alert-dialog'
import { skipToken, useQuery } from '@tanstack/react-query'
-import { useCallback, useEffect, useState } from 'react'
+import { useEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
+import { toast } from '@/app/notifications'
import { useRouter, useSearchParams } from '@/next/navigation'
import { consoleQuery } from '@/service/console'
-type ConfirmType = {
- type: 'info' | 'warning'
+type CheckResult = {
+ type: 'success' | 'warning' | 'error'
title: string
}
-const useAnthropicCheckPay = () => {
+const usePayResult = (): CheckResult | null => {
const { t } = useTranslation(['common'])
- const [confirm, setConfirm] = useState<ConfirmType | null>(null)
const searchParams = useSearchParams()
- const providerName = searchParams.get('provider_name')
+ const isPayment =
+ searchParams.get('provider_name') === 'anthropic' ||
+ searchParams.get('payment_type') === 'billing'
const paymentResult = searchParams.get('payment_result')
- useEffect(() => {
- if (
- providerName === 'anthropic' &&
- (paymentResult === 'succeeded' || paymentResult === 'cancelled')
- ) {
- setConfirm({
- type: paymentResult === 'succeeded' ? 'info' : 'warning',
- title:
- paymentResult === 'succeeded'
- ? t(($) => $['actionMsg.paySucceeded'], { ns: 'common' })
- : t(($) => $['actionMsg.payCancelled'], { ns: 'common' }),
- })
- }
- }, [providerName, paymentResult, t])
-
- return confirm
+ if (!isPayment) return null
+ if (paymentResult === 'succeeded')
+ return { type: 'success', title: t(($) => $['actionMsg.paySucceeded'], { ns: 'common' }) }
+ if (paymentResult === 'cancelled')
+ return { type: 'warning', title: t(($) => $['actionMsg.payCancelled'], { ns: 'common' }) }
+ return null
}
-const useBillingPay = () => {
- const { t } = useTranslation(['common'])
- const [confirm, setConfirm] = useState<ConfirmType | null>(null)
- const searchParams = useSearchParams()
- const paymentType = searchParams.get('payment_type')
- const paymentResult = searchParams.get('payment_result')
-
- useEffect(() => {
- if (
- paymentType === 'billing' &&
- (paymentResult === 'succeeded' || paymentResult === 'cancelled')
- ) {
- setConfirm({
- type: paymentResult === 'succeeded' ? 'info' : 'warning',
- title:
- paymentResult === 'succeeded'
- ? t(($) => $['actionMsg.paySucceeded'], { ns: 'common' })
- : t(($) => $['actionMsg.payCancelled'], { ns: 'common' }),
- })
- }
- }, [paymentType, paymentResult, t])
-
- return confirm
-}
-
-const useCheckNotion = () => {
+const useCheckNotion = (): CheckResult | null => {
const router = useRouter()
- const [confirm, setConfirm] = useState<ConfirmType | null>(null)
- const [canBinding, setCanBinding] = useState(false)
const searchParams = useSearchParams()
- const type = searchParams.get('type')
+ const isNotion = searchParams.get('type') === 'notion'
const notionCode = searchParams.get('code')
const notionError = searchParams.get('error')
const { data } = useQuery(
consoleQuery.oauth.dataSource.binding.byProvider.get.queryOptions({
input:
- notionCode && canBinding
+ isNotion && notionCode && !notionError
? { params: { provider: 'notion' }, query: { code: notionCode } }
: skipToken,
}),
@@ -90,62 +46,23 @@ const useCheckNotion = () => {
useEffect(() => {
if (data) router.replace('/')
}, [data, router])
- useEffect(() => {
- if (type === 'notion') {
- if (notionError) {
- setConfirm({
- type: 'warning',
- title: notionError,
- })
- } else if (notionCode) {
- setCanBinding(true)
- }
- }
- }, [type, notionCode, notionError])
- return confirm
+ return isNotion && notionError ? { type: 'error', title: notionError } : null
}
-export const CheckModal = () => {
+export const CheckResultToast = () => {
const router = useRouter()
- const { t } = useTranslation(['common'])
- const [showPayStatusModal, setShowPayStatusModal] = useState(true)
- const anthropicConfirmInfo = useAnthropicCheckPay()
- const notionConfirmInfo = useCheckNotion()
- const billingConfirmInfo = useBillingPay()
+ const payResult = usePayResult()
+ const notionResult = useCheckNotion()
+ const result = payResult ?? notionResult
+ const shownRef = useRef(false)
- const handleCancelShowPayStatusModal = useCallback(() => {
- setShowPayStatusModal(false)
+ useEffect(() => {
+ if (!result || shownRef.current) return
+ shownRef.current = true
+ toast[result.type](result.title)
router.replace('/')
- }, [router])
+ }, [result, router])
- const confirmInfo = anthropicConfirmInfo || notionConfirmInfo || billingConfirmInfo
-
- if (!confirmInfo) return null
-
- const description = (confirmInfo as { desc?: string }).desc || ''
-
- return (
- <AlertDialog
- open={showPayStatusModal}
- onOpenChange={(open) => !open && handleCancelShowPayStatusModal()}
- >
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogTitle>{confirmInfo.title}</AlertDialogTitle>
- {description && <AlertDialogDescription>{description}</AlertDialogDescription>}
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogConfirmButton
- tone={confirmInfo.type !== 'info' ? 'destructive' : 'default'}
- onClick={handleCancelShowPayStatusModal}
- >
- {confirmInfo.type === 'info'
- ? t(($) => $['operation.ok'], { ns: 'common' })
- : t(($) => $['operation.confirm'], { ns: 'common' })}
- </AlertDialogConfirmButton>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
- )
+ return null
}
diff --git a/web/plugins/eslint/hint-content.test.ts b/web/plugins/eslint/hint-content.test.ts
index 70fb34dc563..820621d0835 100644
--- a/web/plugins/eslint/hint-content.test.ts
+++ b/web/plugins/eslint/hint-content.test.ts
@@ -4,7 +4,7 @@ import { createRequire } from 'node:module'
import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
import { expect, it } from 'vite-plus/test'
-import { hintContentRules } from '../../../lint.config'
+import { stylingContractRules } from '../../../lint.config'
function lintFixture(source: string) {
const require = createRequire(import.meta.url)
@@ -17,7 +17,7 @@ function lintFixture(source: string) {
JSON.stringify({
categories: { correctness: 'off' },
jsPlugins: [require.resolve('@shadcn/lint')],
- rules: hintContentRules,
+ rules: stylingContractRules,
}),
)
writeFileSync(join(directory, 'fixture.tsx'), source)
@@ -133,7 +133,7 @@ it('allows Infotip widths and content line breaks while retaining its own conten
const examples = <>
<Explanation />
<Explanation className="w-60 max-w-75 whitespace-pre-wrap" />
- <Explanation className="max-w-[261px] sm:w-60" />
+ <Explanation className="max-w-65.25 sm:w-60" />
<Explanation className={expanded ? 'w-60' : 'w-45'} />
</>
`)
@@ -193,3 +193,17 @@ it('checks Infotip class helpers and same-file props without restricting unrelat
expect(diagnostics.some(({ message }) => message.includes('"shadow-none"'))).toBe(true)
expect(diagnostics.some(({ message }) => message.includes('"p-2"'))).toBe(true)
})
+
+it('keeps centered dialogs on DialogContent while DialogPopup places custom surfaces', () => {
+ const diagnostics = lintFixture(`
+ import { DialogContent, DialogPopup } from '@langgenius/dify-ui/dialog'
+ const examples = <>
+ <DialogContent className="flex max-h-[calc(100dvh-2rem)] w-160 flex-col overflow-hidden" />
+ <DialogPopup className="fixed top-2 right-2 bottom-2 flex w-160 flex-col overflow-hidden rounded-xl" />
+ <DialogPopup className="fixed top-1/2 left-1/2 w-120 -translate-x-1/2 -translate-y-1/2" />
+ </>
+ `)
+ expect(diagnostics).toHaveLength(4)
+ for (const className of ['top-1/2', 'left-1/2', '-translate-x-1/2', '-translate-y-1/2'])
+ expect(diagnostics.some(({ message }) => message.includes(`"${className}"`))).toBe(true)
+})