diff --git a/.github/workflows/web-tests.yml b/.github/workflows/web-tests.yml index f3ab4c62c7..dcee8863ce 100644 --- a/.github/workflows/web-tests.yml +++ b/.github/workflows/web-tests.yml @@ -89,3 +89,34 @@ jobs: flags: web env: CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }} + + dify-ui-test: + name: dify-ui Tests + runs-on: ubuntu-latest + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + defaults: + run: + shell: bash + working-directory: ./packages/dify-ui + + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Setup web environment + uses: ./.github/actions/setup-web + + - name: Run dify-ui tests + run: vp test run --coverage --silent=passed-only + + - name: Report coverage + if: ${{ env.CODECOV_TOKEN != '' }} + uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 + with: + directory: packages/dify-ui/coverage + flags: dify-ui + env: + CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }} diff --git a/codecov.yml b/codecov.yml index 54ac2a4b36..a506087698 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,6 +3,10 @@ coverage: project: default: target: auto + # Absorb sub-percent coverage noise (rounding, trivial added lines, CVA variants, etc). + threshold: 1% + # Deleting covered code during refactors/migrations must not regress base. + removed_code_behavior: adjust_base flags: web: @@ -10,6 +14,11 @@ flags: - "web/" carryforward: true + dify-ui: + paths: + - "packages/dify-ui/" + carryforward: true + api: paths: - "api/" diff --git a/eslint-suppressions.json b/eslint-suppressions.json index 173a3a7bd7..477391e2de 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -2113,11 +2113,6 @@ "count": 1 } }, - "web/app/components/base/switch/index.stories.tsx": { - "ts/no-explicit-any": { - "count": 1 - } - }, "web/app/components/base/tab-slider/index.tsx": { "react/set-state-in-effect": { "count": 2 diff --git a/packages/dify-ui/.gitignore b/packages/dify-ui/.gitignore new file mode 100644 index 0000000000..befe881885 --- /dev/null +++ b/packages/dify-ui/.gitignore @@ -0,0 +1,3 @@ +/coverage +/dist +/storybook-static diff --git a/packages/dify-ui/.storybook/main.ts b/packages/dify-ui/.storybook/main.ts new file mode 100644 index 0000000000..c8b7ee8e3f --- /dev/null +++ b/packages/dify-ui/.storybook/main.ts @@ -0,0 +1,27 @@ +import type { StorybookConfig } from '@storybook/react-vite' +import tailwindcss from '@tailwindcss/vite' +import { mergeConfig } from 'vite' + +const config: StorybookConfig = { + stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], + addons: [ + '@storybook/addon-links', + '@storybook/addon-docs', + '@storybook/addon-themes', + '@chromatic-com/storybook', + ], + framework: '@storybook/react-vite', + core: { + disableWhatsNewNotifications: true, + }, + docs: { + defaultName: 'Documentation', + }, + async viteFinal(config) { + return mergeConfig(config, { + plugins: [tailwindcss()], + }) + }, +} + +export default config diff --git a/packages/dify-ui/.storybook/preview.tsx b/packages/dify-ui/.storybook/preview.tsx new file mode 100644 index 0000000000..a5bfc5d8af --- /dev/null +++ b/packages/dify-ui/.storybook/preview.tsx @@ -0,0 +1,31 @@ +import type { Preview } from '@storybook/react-vite' +import { withThemeByDataAttribute } from '@storybook/addon-themes' +import './storybook.css' + +export const decorators = [ + withThemeByDataAttribute({ + themes: { + light: 'light', + dark: 'dark', + }, + defaultTheme: 'light', + attributeName: 'data-theme', + }), +] + +const preview: Preview = { + parameters: { + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/i, + }, + }, + docs: { + toc: true, + }, + }, + tags: ['autodocs'], +} + +export default preview diff --git a/packages/dify-ui/.storybook/storybook.css b/packages/dify-ui/.storybook/storybook.css new file mode 100644 index 0000000000..e9796fd046 --- /dev/null +++ b/packages/dify-ui/.storybook/storybook.css @@ -0,0 +1,19 @@ +@import 'tailwindcss'; + +@config '../tailwind.config.ts'; + +@import '../src/styles/styles.css'; + +html { + color-scheme: light; +} + +html[data-theme='dark'] { + color-scheme: dark; +} + +body { + background: var(--color-components-panel-bg); + color: var(--color-text-primary, #101828); + font-family: Inter, ui-sans-serif, system-ui, sans-serif; +} diff --git a/packages/dify-ui/AGENTS.md b/packages/dify-ui/AGENTS.md index ecc968e130..651b117070 100644 --- a/packages/dify-ui/AGENTS.md +++ b/packages/dify-ui/AGENTS.md @@ -1,6 +1,15 @@ # @langgenius/dify-ui -This package provides shared design tokens (colors, shadows, typography), the `cn()` utility, and a Tailwind CSS preset consumed by `web/`. +Shared design tokens, the `cn()` utility, a Tailwind CSS preset, and headless primitive components consumed by `web/`. + +## Component Authoring Rules + +- Use `@base-ui/react` primitives + `cva` + `cn`. +- Inside dify-ui, cross-component imports use relative paths (`../button`). External consumers use subpath exports (`@langgenius/dify-ui/button`). +- No imports from `web/`. No dependencies on next / i18next / ky / jotai / zustand. +- One component per folder: `src//index.tsx`, optional `index.stories.tsx` and `__tests__/index.spec.tsx`. Add a matching `./` subpath to `package.json#exports`. +- Props pattern: `Omit & VariantProps & { /* custom */ }`. +- When a component accepts a prop typed from a shared internal module, `export type` it from that component so consumers import it from the component subpath. ## Border Radius: Figma Token → Tailwind Class Mapping diff --git a/packages/dify-ui/package.json b/packages/dify-ui/package.json index b54fde9b89..2b78b25ed6 100644 --- a/packages/dify-ui/package.json +++ b/packages/dify-ui/package.json @@ -12,18 +12,109 @@ "./cn": { "types": "./src/cn.ts", "import": "./src/cn.ts" + }, + "./alert-dialog": { + "types": "./src/alert-dialog/index.tsx", + "import": "./src/alert-dialog/index.tsx" + }, + "./avatar": { + "types": "./src/avatar/index.tsx", + "import": "./src/avatar/index.tsx" + }, + "./button": { + "types": "./src/button/index.tsx", + "import": "./src/button/index.tsx" + }, + "./context-menu": { + "types": "./src/context-menu/index.tsx", + "import": "./src/context-menu/index.tsx" + }, + "./dialog": { + "types": "./src/dialog/index.tsx", + "import": "./src/dialog/index.tsx" + }, + "./dropdown-menu": { + "types": "./src/dropdown-menu/index.tsx", + "import": "./src/dropdown-menu/index.tsx" + }, + "./number-field": { + "types": "./src/number-field/index.tsx", + "import": "./src/number-field/index.tsx" + }, + "./popover": { + "types": "./src/popover/index.tsx", + "import": "./src/popover/index.tsx" + }, + "./scroll-area": { + "types": "./src/scroll-area/index.tsx", + "import": "./src/scroll-area/index.tsx" + }, + "./select": { + "types": "./src/select/index.tsx", + "import": "./src/select/index.tsx" + }, + "./slider": { + "types": "./src/slider/index.tsx", + "import": "./src/slider/index.tsx" + }, + "./switch": { + "types": "./src/switch/index.tsx", + "import": "./src/switch/index.tsx" + }, + "./toast": { + "types": "./src/toast/index.tsx", + "import": "./src/toast/index.tsx" + }, + "./tooltip": { + "types": "./src/tooltip/index.tsx", + "import": "./src/tooltip/index.tsx" } }, "scripts": { + "storybook": "storybook dev", + "storybook:build": "storybook build", + "test": "vp test", + "test:watch": "vp test --watch", "type-check": "tsc" }, + "peerDependencies": { + "@base-ui/react": "catalog:", + "class-variance-authority": "catalog:", + "react": "catalog:", + "react-dom": "catalog:", + "tailwindcss": "catalog:" + }, "dependencies": { "clsx": "catalog:", "tailwind-merge": "catalog:" }, "devDependencies": { + "@base-ui/react": "catalog:", + "@chromatic-com/storybook": "catalog:", "@dify/tsconfig": "workspace:*", + "@egoist/tailwindcss-icons": "catalog:", + "@iconify-json/ri": "catalog:", + "@storybook/addon-docs": "catalog:", + "@storybook/addon-links": "catalog:", + "@storybook/addon-themes": "catalog:", + "@storybook/react-vite": "catalog:", + "@tailwindcss/vite": "catalog:", + "@testing-library/jest-dom": "catalog:", + "@testing-library/react": "catalog:", + "@testing-library/user-event": "catalog:", + "@types/react": "catalog:", + "@types/react-dom": "catalog:", + "@vitejs/plugin-react": "catalog:", + "@vitest/coverage-v8": "catalog:", + "class-variance-authority": "catalog:", + "happy-dom": "catalog:", + "react": "catalog:", + "react-dom": "catalog:", + "storybook": "catalog:", "tailwindcss": "catalog:", - "typescript": "catalog:" + "typescript": "catalog:", + "vite": "catalog:", + "vite-plus": "catalog:", + "vitest": "catalog:" } } diff --git a/web/app/components/base/ui/alert-dialog/__tests__/index.spec.tsx b/packages/dify-ui/src/alert-dialog/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/alert-dialog/__tests__/index.spec.tsx rename to packages/dify-ui/src/alert-dialog/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/alert-dialog/index.stories.tsx b/packages/dify-ui/src/alert-dialog/index.stories.tsx similarity index 99% rename from web/app/components/base/ui/alert-dialog/index.stories.tsx rename to packages/dify-ui/src/alert-dialog/index.stories.tsx index c9deaa53ed..0b6f60f01e 100644 --- a/web/app/components/base/ui/alert-dialog/index.stories.tsx +++ b/packages/dify-ui/src/alert-dialog/index.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import { useState } from 'react' import { AlertDialog, diff --git a/web/app/components/base/ui/alert-dialog/index.tsx b/packages/dify-ui/src/alert-dialog/index.tsx similarity index 94% rename from web/app/components/base/ui/alert-dialog/index.tsx rename to packages/dify-ui/src/alert-dialog/index.tsx index 5f2af43df8..7b432c87dc 100644 --- a/web/app/components/base/ui/alert-dialog/index.tsx +++ b/packages/dify-ui/src/alert-dialog/index.tsx @@ -1,10 +1,10 @@ 'use client' import type { ComponentPropsWithoutRef, ReactNode } from 'react' -import type { ButtonProps } from '@/app/components/base/ui/button' +import type { ButtonProps } from '../button' import { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog' -import { cn } from '@langgenius/dify-ui/cn' -import { Button } from '@/app/components/base/ui/button' +import { Button } from '../button' +import { cn } from '../cn' export const AlertDialog = BaseAlertDialog.Root export const AlertDialogTrigger = BaseAlertDialog.Trigger diff --git a/web/app/components/base/ui/avatar/__tests__/index.spec.tsx b/packages/dify-ui/src/avatar/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/avatar/__tests__/index.spec.tsx rename to packages/dify-ui/src/avatar/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/avatar/index.stories.tsx b/packages/dify-ui/src/avatar/index.stories.tsx similarity index 97% rename from web/app/components/base/ui/avatar/index.stories.tsx rename to packages/dify-ui/src/avatar/index.stories.tsx index 22de82e6db..f8b90c0b16 100644 --- a/web/app/components/base/ui/avatar/index.stories.tsx +++ b/packages/dify-ui/src/avatar/index.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import { Avatar, AvatarFallback, AvatarRoot } from '.' const meta = { diff --git a/web/app/components/base/ui/avatar/index.tsx b/packages/dify-ui/src/avatar/index.tsx similarity index 98% rename from web/app/components/base/ui/avatar/index.tsx rename to packages/dify-ui/src/avatar/index.tsx index 6fca2e87dc..8cf893fbbd 100644 --- a/web/app/components/base/ui/avatar/index.tsx +++ b/packages/dify-ui/src/avatar/index.tsx @@ -1,6 +1,6 @@ import type { ImageLoadingStatus } from '@base-ui/react/avatar' import { Avatar as BaseAvatar } from '@base-ui/react/avatar' -import { cn } from '@langgenius/dify-ui/cn' +import { cn } from '../cn' const avatarSizeClasses = { 'xxs': { root: 'size-4', text: 'text-[7px]' }, diff --git a/web/app/components/base/ui/button/__tests__/index.spec.tsx b/packages/dify-ui/src/button/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/button/__tests__/index.spec.tsx rename to packages/dify-ui/src/button/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/button/index.stories.tsx b/packages/dify-ui/src/button/index.stories.tsx similarity index 97% rename from web/app/components/base/ui/button/index.stories.tsx rename to packages/dify-ui/src/button/index.stories.tsx index 40dce31dd4..b70a76f431 100644 --- a/web/app/components/base/ui/button/index.stories.tsx +++ b/packages/dify-ui/src/button/index.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import { Button } from '.' diff --git a/web/app/components/base/ui/button/index.tsx b/packages/dify-ui/src/button/index.tsx similarity index 99% rename from web/app/components/base/ui/button/index.tsx rename to packages/dify-ui/src/button/index.tsx index 73d5ecc3c9..03e5c4a937 100644 --- a/web/app/components/base/ui/button/index.tsx +++ b/packages/dify-ui/src/button/index.tsx @@ -1,8 +1,8 @@ import type { Button as BaseButtonNS } from '@base-ui/react/button' import type { VariantProps } from 'class-variance-authority' import { Button as BaseButton } from '@base-ui/react/button' -import { cn } from '@langgenius/dify-ui/cn' import { cva } from 'class-variance-authority' +import { cn } from '../cn' const buttonVariants = cva( 'inline-flex cursor-pointer items-center justify-center whitespace-nowrap outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid data-[disabled]:cursor-not-allowed', diff --git a/web/app/components/base/ui/context-menu/__tests__/index.spec.tsx b/packages/dify-ui/src/context-menu/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/context-menu/__tests__/index.spec.tsx rename to packages/dify-ui/src/context-menu/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/context-menu/index.stories.tsx b/packages/dify-ui/src/context-menu/index.stories.tsx similarity index 99% rename from web/app/components/base/ui/context-menu/index.stories.tsx rename to packages/dify-ui/src/context-menu/index.stories.tsx index b3b43399f6..0be5727e7a 100644 --- a/web/app/components/base/ui/context-menu/index.stories.tsx +++ b/packages/dify-ui/src/context-menu/index.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import { useState } from 'react' import { ContextMenu, diff --git a/web/app/components/base/ui/context-menu/index.tsx b/packages/dify-ui/src/context-menu/index.tsx similarity index 95% rename from web/app/components/base/ui/context-menu/index.tsx rename to packages/dify-ui/src/context-menu/index.tsx index c92c4d6ab9..fc2ae1d454 100644 --- a/web/app/components/base/ui/context-menu/index.tsx +++ b/packages/dify-ui/src/context-menu/index.tsx @@ -1,10 +1,10 @@ 'use client' import type { ReactNode } from 'react' -import type { OverlayItemVariant } from '@/app/components/base/ui/overlay-shared' -import type { Placement } from '@/app/components/base/ui/placement' +import type { OverlayItemVariant } from '../overlay-shared' +import type { Placement } from '../placement' import { ContextMenu as BaseContextMenu } from '@base-ui/react/context-menu' -import { cn } from '@langgenius/dify-ui/cn' +import { cn } from '../cn' import { overlayBackdropClassName, overlayDestructiveClassName, @@ -14,8 +14,11 @@ import { overlayPopupBaseClassName, overlayRowClassName, overlaySeparatorClassName, -} from '@/app/components/base/ui/overlay-shared' -import { parsePlacement } from '@/app/components/base/ui/placement' +} from '../overlay-shared' +import { parsePlacement } from '../placement' + +/** @public */ +export type { Placement } export const ContextMenu = BaseContextMenu.Root export const ContextMenuTrigger = BaseContextMenu.Trigger diff --git a/web/app/components/base/ui/dialog/__tests__/index.spec.tsx b/packages/dify-ui/src/dialog/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/dialog/__tests__/index.spec.tsx rename to packages/dify-ui/src/dialog/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/dialog/index.stories.tsx b/packages/dify-ui/src/dialog/index.stories.tsx similarity index 99% rename from web/app/components/base/ui/dialog/index.stories.tsx rename to packages/dify-ui/src/dialog/index.stories.tsx index 0e8f478520..f9caa0d8c5 100644 --- a/web/app/components/base/ui/dialog/index.stories.tsx +++ b/packages/dify-ui/src/dialog/index.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import { useState } from 'react' import { Dialog, diff --git a/web/app/components/base/ui/dialog/index.tsx b/packages/dify-ui/src/dialog/index.tsx similarity index 98% rename from web/app/components/base/ui/dialog/index.tsx rename to packages/dify-ui/src/dialog/index.tsx index bc82230f58..c24acd5924 100644 --- a/web/app/components/base/ui/dialog/index.tsx +++ b/packages/dify-ui/src/dialog/index.tsx @@ -9,7 +9,7 @@ import type { ReactNode } from 'react' import { Dialog as BaseDialog } from '@base-ui/react/dialog' -import { cn } from '@langgenius/dify-ui/cn' +import { cn } from '../cn' export const Dialog = BaseDialog.Root /** @public */ diff --git a/web/app/components/base/ui/dropdown-menu/__tests__/index.spec.tsx b/packages/dify-ui/src/dropdown-menu/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/dropdown-menu/__tests__/index.spec.tsx rename to packages/dify-ui/src/dropdown-menu/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/dropdown-menu/index.stories.tsx b/packages/dify-ui/src/dropdown-menu/index.stories.tsx similarity index 99% rename from web/app/components/base/ui/dropdown-menu/index.stories.tsx rename to packages/dify-ui/src/dropdown-menu/index.stories.tsx index ae0ad61c68..f73b33ac8b 100644 --- a/web/app/components/base/ui/dropdown-menu/index.stories.tsx +++ b/packages/dify-ui/src/dropdown-menu/index.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import { useState } from 'react' import { DropdownMenu, diff --git a/web/app/components/base/ui/dropdown-menu/index.tsx b/packages/dify-ui/src/dropdown-menu/index.tsx similarity index 95% rename from web/app/components/base/ui/dropdown-menu/index.tsx rename to packages/dify-ui/src/dropdown-menu/index.tsx index b0c034f3cb..f742625964 100644 --- a/web/app/components/base/ui/dropdown-menu/index.tsx +++ b/packages/dify-ui/src/dropdown-menu/index.tsx @@ -1,10 +1,10 @@ 'use client' import type { ReactNode } from 'react' -import type { OverlayItemVariant } from '@/app/components/base/ui/overlay-shared' -import type { Placement } from '@/app/components/base/ui/placement' +import type { OverlayItemVariant } from '../overlay-shared' +import type { Placement } from '../placement' import { Menu } from '@base-ui/react/menu' -import { cn } from '@langgenius/dify-ui/cn' +import { cn } from '../cn' import { overlayDestructiveClassName, overlayIndicatorClassName, @@ -13,8 +13,10 @@ import { overlayPopupBaseClassName, overlayRowClassName, overlaySeparatorClassName, -} from '@/app/components/base/ui/overlay-shared' -import { parsePlacement } from '@/app/components/base/ui/placement' +} from '../overlay-shared' +import { parsePlacement } from '../placement' + +export type { Placement } export const DropdownMenu = Menu.Root export const DropdownMenuTrigger = Menu.Trigger diff --git a/web/app/components/base/ui/number-field/__tests__/index.spec.tsx b/packages/dify-ui/src/number-field/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/number-field/__tests__/index.spec.tsx rename to packages/dify-ui/src/number-field/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/number-field/index.stories.tsx b/packages/dify-ui/src/number-field/index.stories.tsx similarity index 98% rename from web/app/components/base/ui/number-field/index.stories.tsx rename to packages/dify-ui/src/number-field/index.stories.tsx index 6abb93bf11..a436d997e6 100644 --- a/web/app/components/base/ui/number-field/index.stories.tsx +++ b/packages/dify-ui/src/number-field/index.stories.tsx @@ -1,5 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' -import { cn } from '@langgenius/dify-ui/cn' +import type { Meta, StoryObj } from '@storybook/react-vite' import { useId, useState } from 'react' import { NumberField, @@ -10,6 +9,7 @@ import { NumberFieldInput, NumberFieldUnit, } from '.' +import { cn } from '../cn' type DemoFieldProps = { label: string diff --git a/web/app/components/base/ui/number-field/index.tsx b/packages/dify-ui/src/number-field/index.tsx similarity index 99% rename from web/app/components/base/ui/number-field/index.tsx rename to packages/dify-ui/src/number-field/index.tsx index 944aa52470..70e66dd91b 100644 --- a/web/app/components/base/ui/number-field/index.tsx +++ b/packages/dify-ui/src/number-field/index.tsx @@ -3,8 +3,8 @@ import type { VariantProps } from 'class-variance-authority' import type { HTMLAttributes } from 'react' import { NumberField as BaseNumberField } from '@base-ui/react/number-field' -import { cn } from '@langgenius/dify-ui/cn' import { cva } from 'class-variance-authority' +import { cn } from '../cn' export const NumberField = BaseNumberField.Root export type NumberFieldRootProps = BaseNumberField.Root.Props diff --git a/web/app/components/base/ui/overlay-shared.ts b/packages/dify-ui/src/overlay-shared.ts similarity index 100% rename from web/app/components/base/ui/overlay-shared.ts rename to packages/dify-ui/src/overlay-shared.ts diff --git a/web/app/components/base/ui/placement.ts b/packages/dify-ui/src/placement.ts similarity index 100% rename from web/app/components/base/ui/placement.ts rename to packages/dify-ui/src/placement.ts diff --git a/web/app/components/base/ui/popover/__tests__/index.spec.tsx b/packages/dify-ui/src/popover/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/popover/__tests__/index.spec.tsx rename to packages/dify-ui/src/popover/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/popover/index.stories.tsx b/packages/dify-ui/src/popover/index.stories.tsx similarity index 97% rename from web/app/components/base/ui/popover/index.stories.tsx rename to packages/dify-ui/src/popover/index.stories.tsx index 8dbae184de..dcea5018ab 100644 --- a/web/app/components/base/ui/popover/index.stories.tsx +++ b/packages/dify-ui/src/popover/index.stories.tsx @@ -1,5 +1,6 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' -import type { Placement } from '../placement' +import type { Meta, StoryObj } from '@storybook/react-vite' +import type { Placement } from '.' +import { Button } from '@langgenius/dify-ui/button' import { useState } from 'react' import { Popover, @@ -9,7 +10,6 @@ import { PopoverTitle, PopoverTrigger, } from '.' -import { Button } from '../button' const triggerButtonClassName = 'rounded-lg border border-divider-subtle bg-components-button-secondary-bg px-3 py-1.5 text-sm text-text-secondary shadow-xs hover:bg-state-base-hover' diff --git a/web/app/components/base/ui/popover/index.tsx b/packages/dify-ui/src/popover/index.tsx similarity index 91% rename from web/app/components/base/ui/popover/index.tsx rename to packages/dify-ui/src/popover/index.tsx index dbde17ae21..32d111a1b8 100644 --- a/web/app/components/base/ui/popover/index.tsx +++ b/packages/dify-ui/src/popover/index.tsx @@ -1,10 +1,12 @@ 'use client' import type { ReactNode } from 'react' -import type { Placement } from '@/app/components/base/ui/placement' +import type { Placement } from '../placement' import { Popover as BasePopover } from '@base-ui/react/popover' -import { cn } from '@langgenius/dify-ui/cn' -import { parsePlacement } from '@/app/components/base/ui/placement' +import { cn } from '../cn' +import { parsePlacement } from '../placement' + +export type { Placement } export const Popover = BasePopover.Root export const PopoverTrigger = BasePopover.Trigger diff --git a/web/app/components/base/ui/scroll-area/__tests__/index.spec.tsx b/packages/dify-ui/src/scroll-area/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/scroll-area/__tests__/index.spec.tsx rename to packages/dify-ui/src/scroll-area/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/scroll-area/index.stories.tsx b/packages/dify-ui/src/scroll-area/index.stories.tsx similarity index 98% rename from web/app/components/base/ui/scroll-area/index.stories.tsx rename to packages/dify-ui/src/scroll-area/index.stories.tsx index dbe8161f8f..e1f8f9cfb5 100644 --- a/web/app/components/base/ui/scroll-area/index.stories.tsx +++ b/packages/dify-ui/src/scroll-area/index.stories.tsx @@ -1,8 +1,6 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import type { ReactNode } from 'react' -import { cn } from '@langgenius/dify-ui/cn' import * as React from 'react' -import AppIcon from '@/app/components/base/app-icon' import { ScrollAreaContent, ScrollAreaCorner, @@ -11,6 +9,7 @@ import { ScrollAreaThumb, ScrollAreaViewport, } from '.' +import { cn } from '../cn' const meta = { title: 'Base/UI/ScrollArea', @@ -490,12 +489,13 @@ const ExploreSidebarWebAppsPane = () => { )} >
- +
+ {item.icon} +
{item.name} diff --git a/web/app/components/base/ui/scroll-area/index.tsx b/packages/dify-ui/src/scroll-area/index.tsx similarity index 98% rename from web/app/components/base/ui/scroll-area/index.tsx rename to packages/dify-ui/src/scroll-area/index.tsx index 300946b1bf..4e1832e661 100644 --- a/web/app/components/base/ui/scroll-area/index.tsx +++ b/packages/dify-ui/src/scroll-area/index.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from 'react' import { ScrollArea as BaseScrollArea } from '@base-ui/react/scroll-area' -import { cn } from '@langgenius/dify-ui/cn' +import { cn } from '../cn' export const ScrollAreaRoot = BaseScrollArea.Root type ScrollAreaRootProps = BaseScrollArea.Root.Props diff --git a/web/app/components/base/ui/select/__tests__/index.spec.tsx b/packages/dify-ui/src/select/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/select/__tests__/index.spec.tsx rename to packages/dify-ui/src/select/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/select/index.stories.tsx b/packages/dify-ui/src/select/index.stories.tsx similarity index 99% rename from web/app/components/base/ui/select/index.stories.tsx rename to packages/dify-ui/src/select/index.stories.tsx index 027d0f74df..6dc832a291 100644 --- a/web/app/components/base/ui/select/index.stories.tsx +++ b/packages/dify-ui/src/select/index.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import { useState } from 'react' import { Select, diff --git a/web/app/components/base/ui/select/index.tsx b/packages/dify-ui/src/select/index.tsx similarity index 96% rename from web/app/components/base/ui/select/index.tsx rename to packages/dify-ui/src/select/index.tsx index 7de0088af4..62478fad21 100644 --- a/web/app/components/base/ui/select/index.tsx +++ b/packages/dify-ui/src/select/index.tsx @@ -2,15 +2,18 @@ import type { VariantProps } from 'class-variance-authority' import type { ReactNode } from 'react' -import type { Placement } from '@/app/components/base/ui/placement' +import type { Placement } from '../placement' import { Select as BaseSelect } from '@base-ui/react/select' -import { cn } from '@langgenius/dify-ui/cn' import { cva } from 'class-variance-authority' +import { cn } from '../cn' import { overlayLabelClassName, overlaySeparatorClassName, -} from '@/app/components/base/ui/overlay-shared' -import { parsePlacement } from '@/app/components/base/ui/placement' +} from '../overlay-shared' +import { parsePlacement } from '../placement' + +/** @public */ +export type { Placement } export const Select = BaseSelect.Root export const SelectValue = BaseSelect.Value diff --git a/web/app/components/base/ui/slider/__tests__/index.spec.tsx b/packages/dify-ui/src/slider/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/slider/__tests__/index.spec.tsx rename to packages/dify-ui/src/slider/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/slider/index.stories.tsx b/packages/dify-ui/src/slider/index.stories.tsx similarity index 96% rename from web/app/components/base/ui/slider/index.stories.tsx rename to packages/dify-ui/src/slider/index.stories.tsx index 91bc0d3ecb..a48e202142 100644 --- a/web/app/components/base/ui/slider/index.stories.tsx +++ b/packages/dify-ui/src/slider/index.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import type * as React from 'react' import { useState } from 'react' import { Slider } from '.' diff --git a/web/app/components/base/ui/slider/index.tsx b/packages/dify-ui/src/slider/index.tsx similarity index 98% rename from web/app/components/base/ui/slider/index.tsx rename to packages/dify-ui/src/slider/index.tsx index ad1bc0ba8f..cfe1361598 100644 --- a/web/app/components/base/ui/slider/index.tsx +++ b/packages/dify-ui/src/slider/index.tsx @@ -1,7 +1,7 @@ 'use client' import { Slider as BaseSlider } from '@base-ui/react/slider' -import { cn } from '@langgenius/dify-ui/cn' +import { cn } from '../cn' /** @public */ export const SliderRoot = BaseSlider.Root diff --git a/web/app/components/base/switch/__tests__/index.spec.tsx b/packages/dify-ui/src/switch/__tests__/index.spec.tsx similarity index 99% rename from web/app/components/base/switch/__tests__/index.spec.tsx rename to packages/dify-ui/src/switch/__tests__/index.spec.tsx index 0d46095ebd..055b6e0791 100644 --- a/web/app/components/base/switch/__tests__/index.spec.tsx +++ b/packages/dify-ui/src/switch/__tests__/index.spec.tsx @@ -1,8 +1,7 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { describe, expect, it, vi } from 'vitest' -import Switch from '../index' -import { SwitchSkeleton } from '../skeleton' +import { Switch, SwitchSkeleton } from '../index' const getThumb = (switchElement: HTMLElement) => switchElement.querySelector('span') diff --git a/web/app/components/base/switch/index.stories.tsx b/packages/dify-ui/src/switch/index.stories.tsx similarity index 96% rename from web/app/components/base/switch/index.stories.tsx rename to packages/dify-ui/src/switch/index.stories.tsx index 1b3a52dcc4..f43b9ae154 100644 --- a/web/app/components/base/switch/index.stories.tsx +++ b/packages/dify-ui/src/switch/index.stories.tsx @@ -1,16 +1,16 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' +import type { ComponentProps } from 'react' import { useState, useTransition } from 'react' -import Switch from '.' -import { SwitchSkeleton } from './skeleton' +import { Switch, SwitchSkeleton } from '.' const meta = { - title: 'Base/Data Entry/Switch', + title: 'Base/UI/Switch', component: Switch, parameters: { layout: 'centered', docs: { description: { - component: 'Toggle switch built on Base UI with CVA variants, Figma-aligned design tokens, loading spinner, and skeleton placeholder. Import `Switch` for the toggle and `SwitchSkeleton` from `./skeleton` for loading placeholders.', + component: 'Toggle switch built on Base UI with CVA variants, Figma-aligned design tokens, loading spinner, and skeleton placeholder. Import `Switch` and `SwitchSkeleton` from `@langgenius/dify-ui/switch`.', }, }, }, @@ -42,7 +42,7 @@ const meta = { export default meta type Story = StoryObj -const SwitchDemo = (args: any) => { +const SwitchDemo = (args: Partial>) => { const [enabled, setEnabled] = useState(args.checked ?? false) return ( @@ -338,7 +338,7 @@ export const Skeleton: Story = { parameters: { docs: { description: { - story: '`SwitchSkeleton` renders a non-interactive placeholder with `bg-text-quaternary opacity-20`. Imported separately from `./skeleton`.', + story: '`SwitchSkeleton` renders a non-interactive placeholder with `bg-text-quaternary opacity-20`. Exported from `@langgenius/dify-ui/switch` alongside `Switch`.', }, }, }, diff --git a/web/app/components/base/switch/index.tsx b/packages/dify-ui/src/switch/index.tsx similarity index 72% rename from web/app/components/base/switch/index.tsx rename to packages/dify-ui/src/switch/index.tsx index 942a2291d0..dd15ef6f79 100644 --- a/web/app/components/base/switch/index.tsx +++ b/packages/dify-ui/src/switch/index.tsx @@ -1,10 +1,11 @@ 'use client' +import type { Switch as BaseSwitchNS } from '@base-ui/react/switch' import type { VariantProps } from 'class-variance-authority' +import type { HTMLAttributes } from 'react' import { Switch as BaseSwitch } from '@base-ui/react/switch' -import { cn } from '@langgenius/dify-ui/cn' import { cva } from 'class-variance-authority' -import * as React from 'react' +import { cn } from '../cn' const switchRootStateClassName = 'bg-components-toggle-bg-unchecked hover:bg-components-toggle-bg-unchecked-hover data-checked:bg-components-toggle-bg data-checked:hover:bg-components-toggle-bg-hover data-disabled:cursor-not-allowed data-disabled:bg-components-toggle-bg-unchecked-disabled data-disabled:hover:bg-components-toggle-bg-unchecked-disabled data-disabled:data-checked:bg-components-toggle-bg-disabled data-disabled:data-checked:hover:bg-components-toggle-bg-disabled' @@ -61,46 +62,35 @@ const spinnerSizeConfig: Partial void - 'size'?: SwitchSize - 'disabled'?: boolean - 'loading'?: boolean - 'className'?: string - 'aria-label'?: string - 'aria-labelledby'?: string - 'data-testid'?: string -} +export type SwitchProps + = Omit + & VariantProps + & { + onCheckedChange?: (checked: boolean) => void + loading?: boolean + className?: string + } -const Switch = ({ - ref, +export function Switch({ checked, - onCheckedChange, size = 'md', - disabled = false, + disabled, loading = false, className, - 'aria-label': ariaLabel, - 'aria-labelledby': ariaLabelledBy, - 'data-testid': dataTestid, -}: SwitchProps & { - ref?: React.Ref -}) => { + onCheckedChange, + ...props +}: SwitchProps) { const isDisabled = disabled || loading - const spinner = loading ? spinnerSizeConfig[size] : undefined + const spinner = loading && size ? spinnerSizeConfig[size] : undefined return ( onCheckedChange?.(value)} disabled={isDisabled} aria-busy={loading || undefined} - aria-label={ariaLabel} - aria-labelledby={ariaLabelledBy} className={cn(switchRootVariants({ size }), className)} - data-testid={dataTestid} + onCheckedChange={value => onCheckedChange?.(value)} + {...props} > , 'className'> + & VariantProps + & { + className?: string + } + +export function SwitchSkeleton({ + size = 'md', + className, + ...props +}: SwitchSkeletonProps) { + return ( +
+ ) +} diff --git a/web/app/components/base/ui/toast/__tests__/index.spec.tsx b/packages/dify-ui/src/toast/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/toast/__tests__/index.spec.tsx rename to packages/dify-ui/src/toast/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/toast/index.stories.tsx b/packages/dify-ui/src/toast/index.stories.tsx similarity index 99% rename from web/app/components/base/ui/toast/index.stories.tsx rename to packages/dify-ui/src/toast/index.stories.tsx index d292e3434d..cbfb944f19 100644 --- a/web/app/components/base/ui/toast/index.stories.tsx +++ b/packages/dify-ui/src/toast/index.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import type { Meta, StoryObj } from '@storybook/react-vite' import type { ReactNode } from 'react' import { toast } from '.' diff --git a/web/app/components/base/ui/toast/index.tsx b/packages/dify-ui/src/toast/index.tsx similarity index 99% rename from web/app/components/base/ui/toast/index.tsx rename to packages/dify-ui/src/toast/index.tsx index 1f9fea5173..a479621563 100644 --- a/web/app/components/base/ui/toast/index.tsx +++ b/packages/dify-ui/src/toast/index.tsx @@ -7,7 +7,7 @@ import type { } from '@base-ui/react/toast' import type { ReactNode } from 'react' import { Toast as BaseToast } from '@base-ui/react/toast' -import { cn } from '@langgenius/dify-ui/cn' +import { cn } from '../cn' type ToastData = Record type ToastToneStyle = { diff --git a/web/app/components/base/ui/tooltip/__tests__/index.spec.tsx b/packages/dify-ui/src/tooltip/__tests__/index.spec.tsx similarity index 100% rename from web/app/components/base/ui/tooltip/__tests__/index.spec.tsx rename to packages/dify-ui/src/tooltip/__tests__/index.spec.tsx diff --git a/web/app/components/base/ui/tooltip/index.stories.tsx b/packages/dify-ui/src/tooltip/index.stories.tsx similarity index 98% rename from web/app/components/base/ui/tooltip/index.stories.tsx rename to packages/dify-ui/src/tooltip/index.stories.tsx index 16d0675c44..dca3be32f3 100644 --- a/web/app/components/base/ui/tooltip/index.stories.tsx +++ b/packages/dify-ui/src/tooltip/index.stories.tsx @@ -1,5 +1,5 @@ -import type { Meta, StoryObj } from '@storybook/nextjs-vite' -import type { Placement } from '../placement' +import type { Meta, StoryObj } from '@storybook/react-vite' +import type { Placement } from '.' import { useState } from 'react' import { Tooltip, diff --git a/web/app/components/base/ui/tooltip/index.tsx b/packages/dify-ui/src/tooltip/index.tsx similarity index 90% rename from web/app/components/base/ui/tooltip/index.tsx rename to packages/dify-ui/src/tooltip/index.tsx index b84921e351..e0fcd7c5c3 100644 --- a/web/app/components/base/ui/tooltip/index.tsx +++ b/packages/dify-ui/src/tooltip/index.tsx @@ -1,10 +1,12 @@ 'use client' import type { ReactNode } from 'react' -import type { Placement } from '@/app/components/base/ui/placement' +import type { Placement } from '../placement' import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip' -import { cn } from '@langgenius/dify-ui/cn' -import { parsePlacement } from '@/app/components/base/ui/placement' +import { cn } from '../cn' +import { parsePlacement } from '../placement' + +export type { Placement } type TooltipContentVariant = 'default' | 'plain' diff --git a/packages/dify-ui/tailwind.config.ts b/packages/dify-ui/tailwind.config.ts new file mode 100644 index 0000000000..bcf1731775 --- /dev/null +++ b/packages/dify-ui/tailwind.config.ts @@ -0,0 +1,23 @@ +import type { Config } from 'tailwindcss' +import { getIconCollections, iconsPlugin } from '@egoist/tailwindcss-icons' +import difyUIPreset from './src/tailwind-preset' + +const config: Config = { + content: [ + './src/**/*.{js,ts,jsx,tsx,mdx}', + './.storybook/**/*.{js,ts,jsx,tsx,mdx}', + ], + presets: [difyUIPreset], + plugins: [ + iconsPlugin({ + collections: getIconCollections(['ri']), + extraProperties: { + width: '1rem', + height: '1rem', + display: 'block', + }, + }), + ], +} + +export default config diff --git a/packages/dify-ui/tests/setup.ts b/packages/dify-ui/tests/setup.ts new file mode 100644 index 0000000000..e1ea15af2b --- /dev/null +++ b/packages/dify-ui/tests/setup.ts @@ -0,0 +1,44 @@ +import { act, cleanup } from '@testing-library/react' +import '@testing-library/jest-dom/vitest' + +if (typeof Element !== 'undefined' && !Element.prototype.getAnimations) + Element.prototype.getAnimations = () => [] + +if (typeof document !== 'undefined' && !document.getAnimations) + document.getAnimations = () => [] + +if (typeof globalThis.ResizeObserver === 'undefined') { + globalThis.ResizeObserver = class { + observe() { + return undefined + } + + unobserve() { + return undefined + } + + disconnect() { + return undefined + } + } +} + +if (typeof globalThis.IntersectionObserver === 'undefined') { + globalThis.IntersectionObserver = class { + readonly root: Element | Document | null = null + readonly rootMargin: string = '' + readonly scrollMargin: string = '' + readonly thresholds: ReadonlyArray = [] + constructor(_callback: IntersectionObserverCallback, _options?: IntersectionObserverInit) { /* noop */ } + observe(_target: Element) { /* noop */ } + unobserve(_target: Element) { /* noop */ } + disconnect() { /* noop */ } + takeRecords(): IntersectionObserverEntry[] { return [] } + } +} + +afterEach(async () => { + await act(async () => { + cleanup() + }) +}) diff --git a/packages/dify-ui/tsconfig.json b/packages/dify-ui/tsconfig.json index b31c48ead6..678e1de897 100644 --- a/packages/dify-ui/tsconfig.json +++ b/packages/dify-ui/tsconfig.json @@ -1,14 +1,10 @@ { - "extends": "@dify/tsconfig/base.json", + "extends": "@dify/tsconfig/react.json", "compilerOptions": { - "rootDir": "src", - "declaration": true, - "declarationMap": true, - "noEmit": false, - "outDir": "dist", - "sourceMap": true, + "rootDir": ".", + "types": ["vitest/globals", "@testing-library/jest-dom"], "isolatedModules": true, "verbatimModuleSyntax": true }, - "include": ["src"] + "include": ["src", "tests", ".storybook", "tailwind.config.ts", "vite.config.ts"] } diff --git a/packages/dify-ui/vite.config.ts b/packages/dify-ui/vite.config.ts new file mode 100644 index 0000000000..a20b7fb35c --- /dev/null +++ b/packages/dify-ui/vite.config.ts @@ -0,0 +1,27 @@ +import react from '@vitejs/plugin-react' +import { defineConfig } from 'vite-plus' + +const isCI = !!process.env.CI + +export default defineConfig({ + plugins: [react()], + resolve: { + tsconfigPaths: true, + }, + test: { + environment: 'happy-dom', + globals: true, + setupFiles: ['./tests/setup.ts'], + coverage: { + provider: 'v8', + include: ['src/**/*.{ts,tsx}'], + exclude: [ + 'src/**/*.stories.{ts,tsx}', + 'src/**/__tests__/**', + 'src/themes/**', + 'src/styles/**', + ], + reporter: isCI ? ['json', 'json-summary'] : ['text', 'json', 'json-summary'], + }, + }, +}) diff --git a/packages/tsconfig/nextjs.json b/packages/tsconfig/nextjs.json index 81c6436a97..5beddd55ed 100644 --- a/packages/tsconfig/nextjs.json +++ b/packages/tsconfig/nextjs.json @@ -1,5 +1,5 @@ { - "extends": "./web.json", + "extends": "./react.json", "compilerOptions": { "plugins": [ { diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json index 52cafc5bb3..7a5b20c1db 100644 --- a/packages/tsconfig/package.json +++ b/packages/tsconfig/package.json @@ -6,6 +6,6 @@ "./base.json": "./base.json", "./nextjs.json": "./nextjs.json", "./node.json": "./node.json", - "./web.json": "./web.json" + "./react.json": "./react.json" } } diff --git a/packages/tsconfig/web.json b/packages/tsconfig/react.json similarity index 100% rename from packages/tsconfig/web.json rename to packages/tsconfig/react.json diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 914bc342e2..1e0994d0a2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -135,6 +135,9 @@ catalogs: '@storybook/react': specifier: 10.3.5 version: 10.3.5 + '@storybook/react-vite': + specifier: 10.3.5 + version: 10.3.5 '@streamdown/math': specifier: 1.0.2 version: 1.0.2 @@ -632,15 +635,87 @@ importers: specifier: 'catalog:' version: 3.5.0 devDependencies: + '@base-ui/react': + specifier: 'catalog:' + version: 1.4.0(@date-fns/tz@1.4.1)(@types/react@19.2.14)(date-fns@4.1.0)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + '@chromatic-com/storybook': + specifier: 'catalog:' + version: 5.1.2(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)) '@dify/tsconfig': specifier: workspace:* version: link:../tsconfig + '@egoist/tailwindcss-icons': + specifier: 'catalog:' + version: 1.9.2(tailwindcss@4.2.2) + '@iconify-json/ri': + specifier: 'catalog:' + version: 1.2.10 + '@storybook/addon-docs': + specifier: 'catalog:' + version: 10.3.5(@types/react@19.2.14)(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(webpack@5.105.4(esbuild@0.27.2)) + '@storybook/addon-links': + specifier: 'catalog:' + version: 10.3.5(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)) + '@storybook/addon-themes': + specifier: 'catalog:' + version: 10.3.5(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)) + '@storybook/react-vite': + specifier: 'catalog:' + version: 10.3.5(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@6.0.2)(webpack@5.105.4(esbuild@0.27.2)) + '@tailwindcss/vite': + specifier: 'catalog:' + version: 4.2.2(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3)) + '@testing-library/jest-dom': + specifier: 'catalog:' + version: 6.9.1 + '@testing-library/react': + specifier: 'catalog:' + version: 16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + '@testing-library/user-event': + specifier: 'catalog:' + version: 14.6.1(@testing-library/dom@10.4.1) + '@types/react': + specifier: 'catalog:' + version: 19.2.14 + '@types/react-dom': + specifier: 'catalog:' + version: 19.2.3(@types/react@19.2.14) + '@vitejs/plugin-react': + specifier: 'catalog:' + version: 6.0.1(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3)) + '@vitest/coverage-v8': + specifier: 'catalog:' + version: 4.1.4(@voidzero-dev/vite-plus-test@0.1.18) + class-variance-authority: + specifier: 'catalog:' + version: 0.7.1 + happy-dom: + specifier: 'catalog:' + version: 20.9.0 + react: + specifier: 'catalog:' + version: 19.2.5 + react-dom: + specifier: 'catalog:' + version: 19.2.5(react@19.2.5) + storybook: + specifier: 'catalog:' + version: 10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) tailwindcss: specifier: 'catalog:' version: 4.2.2 typescript: specifier: 'catalog:' version: 6.0.2 + vite: + specifier: npm:@voidzero-dev/vite-plus-core@0.1.18 + version: '@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3)' + vite-plus: + specifier: 'catalog:' + version: 0.1.18(@types/node@25.6.0)(@vitest/coverage-v8@4.1.4)(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(happy-dom@20.9.0)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3) + vitest: + specifier: npm:@voidzero-dev/vite-plus-test@0.1.18 + version: '@voidzero-dev/vite-plus-test@0.1.18(@types/node@25.6.0)(@vitest/coverage-v8@4.1.4)(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(happy-dom@20.9.0)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3)' packages/iconify-collections: devDependencies: @@ -11202,6 +11277,23 @@ snapshots: - vite - webpack + '@storybook/addon-docs@10.3.5(@types/react@19.2.14)(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(webpack@5.105.4(esbuild@0.27.2))': + dependencies: + '@mdx-js/react': 3.1.1(@types/react@19.2.14)(react@19.2.5) + '@storybook/csf-plugin': 10.3.5(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(webpack@5.105.4(esbuild@0.27.2)) + '@storybook/icons': 2.0.1(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + '@storybook/react-dom-shim': 10.3.5(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)) + react: 19.2.5 + react-dom: 19.2.5(react@19.2.5) + storybook: 10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + ts-dedent: 2.2.0 + transitivePeerDependencies: + - '@types/react' + - esbuild + - rollup + - vite + - webpack + '@storybook/addon-links@10.3.5(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))': dependencies: '@storybook/global': 5.0.0 @@ -11229,6 +11321,17 @@ snapshots: - rollup - webpack + '@storybook/builder-vite@10.3.5(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(webpack@5.105.4(esbuild@0.27.2))': + dependencies: + '@storybook/csf-plugin': 10.3.5(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(webpack@5.105.4(esbuild@0.27.2)) + storybook: 10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + ts-dedent: 2.2.0 + vite: '@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3)' + transitivePeerDependencies: + - esbuild + - rollup + - webpack + '@storybook/csf-plugin@10.3.5(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(webpack@5.105.4(esbuild@0.27.2)(uglify-js@3.19.3))': dependencies: storybook: 10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) @@ -11239,6 +11342,16 @@ snapshots: vite: '@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3)' webpack: 5.105.4(esbuild@0.27.2)(uglify-js@3.19.3) + '@storybook/csf-plugin@10.3.5(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(webpack@5.105.4(esbuild@0.27.2))': + dependencies: + storybook: 10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + unplugin: 2.3.11 + optionalDependencies: + esbuild: 0.27.2 + rollup: 4.59.0 + vite: '@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3)' + webpack: 5.105.4(esbuild@0.27.2) + '@storybook/global@5.0.0': {} '@storybook/icons@2.0.1(react-dom@19.2.5(react@19.2.5))(react@19.2.5)': @@ -11296,6 +11409,28 @@ snapshots: - typescript - webpack + '@storybook/react-vite@10.3.5(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@6.0.2)(webpack@5.105.4(esbuild@0.27.2))': + dependencies: + '@joshwooding/vite-plugin-react-docgen-typescript': 0.7.0(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(typescript@6.0.2) + '@rollup/pluginutils': 5.3.0(rollup@4.59.0) + '@storybook/builder-vite': 10.3.5(@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3))(esbuild@0.27.2)(rollup@4.59.0)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(webpack@5.105.4(esbuild@0.27.2)) + '@storybook/react': 10.3.5(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@6.0.2) + empathic: 2.0.0 + magic-string: 0.30.21 + react: 19.2.5 + react-docgen: 8.0.3 + react-dom: 19.2.5(react@19.2.5) + resolve: 1.22.11 + storybook: 10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + tsconfig-paths: 4.2.0 + vite: '@voidzero-dev/vite-plus-core@0.1.18(@types/node@25.6.0)(esbuild@0.27.2)(jiti@2.6.1)(sass@1.98.0)(terser@5.46.1)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3)' + transitivePeerDependencies: + - esbuild + - rollup + - supports-color + - typescript + - webpack + '@storybook/react@10.3.5(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@6.0.2)': dependencies: '@storybook/global': 5.0.0 @@ -16589,6 +16724,17 @@ snapshots: esbuild: 0.27.2 uglify-js: 3.19.3 + terser-webpack-plugin@5.4.0(esbuild@0.27.2)(webpack@5.105.4(esbuild@0.27.2)): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.3.3 + terser: 5.46.1 + webpack: 5.105.4(esbuild@0.27.2) + optionalDependencies: + esbuild: 0.27.2 + optional: true + terser@5.46.1: dependencies: '@jridgewell/source-map': 0.3.11 @@ -17118,6 +17264,39 @@ snapshots: webpack-virtual-modules@0.6.2: {} + webpack@5.105.4(esbuild@0.27.2): + dependencies: + '@types/eslint-scope': 3.7.7 + '@types/estree': 1.0.8 + '@types/json-schema': 7.0.15 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + acorn: 8.16.0 + acorn-import-phases: 1.0.4(acorn@8.16.0) + browserslist: 4.28.1 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.20.1 + es-module-lexer: 2.0.0 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.1 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 4.3.3 + tapable: 2.3.2 + terser-webpack-plugin: 5.4.0(esbuild@0.27.2)(webpack@5.105.4(esbuild@0.27.2)) + watchpack: 2.5.1 + webpack-sources: 3.3.4 + transitivePeerDependencies: + - '@swc/core' + - esbuild + - uglify-js + optional: true + webpack@5.105.4(esbuild@0.27.2)(uglify-js@3.19.3): dependencies: '@types/eslint-scope': 3.7.7 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 0bd1303fb3..12fea26d68 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -55,6 +55,7 @@ catalog: '@storybook/addon-themes': 10.3.5 '@storybook/nextjs-vite': 10.3.5 '@storybook/react': 10.3.5 + '@storybook/react-vite': 10.3.5 '@streamdown/math': 1.0.2 '@svgdotjs/svg.js': 3.2.5 '@t3-oss/env-nextjs': 0.13.11 diff --git a/web/.storybook/preview.tsx b/web/.storybook/preview.tsx index a9144e7128..92b5baab0d 100644 --- a/web/.storybook/preview.tsx +++ b/web/.storybook/preview.tsx @@ -1,8 +1,8 @@ import type { Preview } from '@storybook/react' import type { Resource } from 'i18next' +import { ToastHost } from '@langgenius/dify-ui/toast' import { withThemeByDataAttribute } from '@storybook/addon-themes' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { ToastHost } from '../app/components/base/ui/toast' import { I18nClientProvider as I18N } from '../app/components/provider/i18n' import commonEnUS from '../i18n/en-US/common.json' diff --git a/web/__tests__/app/app-publisher-flow.test.tsx b/web/__tests__/app/app-publisher-flow.test.tsx index 4f24fc310c..9c09acf6a1 100644 --- a/web/__tests__/app/app-publisher-flow.test.tsx +++ b/web/__tests__/app/app-publisher-flow.test.tsx @@ -106,7 +106,7 @@ vi.mock('@/service/apps', () => ({ fetchAppDetailDirect: (...args: unknown[]) => mockFetchAppDetailDirect(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => mockToastError(...args), }, diff --git a/web/__tests__/apps/app-card-operations-flow.test.tsx b/web/__tests__/apps/app-card-operations-flow.test.tsx index 4b1c05e7ae..8c3219794d 100644 --- a/web/__tests__/apps/app-card-operations-flow.test.tsx +++ b/web/__tests__/apps/app-card-operations-flow.test.tsx @@ -31,7 +31,7 @@ const toastMocks = vi.hoisted(() => ({ })) const mockRouterPush = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: (message: string, options?: Record) => toastMocks.mockNotify({ type: 'success', message, ...options }), error: (message: string, options?: Record) => toastMocks.mockNotify({ type: 'error', message, ...options }), diff --git a/web/__tests__/billing/cloud-plan-payment-flow.test.tsx b/web/__tests__/billing/cloud-plan-payment-flow.test.tsx index 0c1efbe1af..de145a73e6 100644 --- a/web/__tests__/billing/cloud-plan-payment-flow.test.tsx +++ b/web/__tests__/billing/cloud-plan-payment-flow.test.tsx @@ -8,10 +8,10 @@ * and workspace manager permission enforcement. */ import type { BasicPlan } from '@/app/components/billing/type' +import { toast, ToastHost } from '@langgenius/dify-ui/toast' import { cleanup, render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import * as React from 'react' -import { toast, ToastHost } from '@/app/components/base/ui/toast' import { ALL_PLANS } from '@/app/components/billing/config' import { PlanRange } from '@/app/components/billing/pricing/plan-switcher/plan-range-switcher' import CloudPlanItem from '@/app/components/billing/pricing/plans/cloud-plan-item' diff --git a/web/__tests__/billing/self-hosted-plan-flow.test.tsx b/web/__tests__/billing/self-hosted-plan-flow.test.tsx index a3386d0092..f2b5cd3531 100644 --- a/web/__tests__/billing/self-hosted-plan-flow.test.tsx +++ b/web/__tests__/billing/self-hosted-plan-flow.test.tsx @@ -1,3 +1,4 @@ +import { toast, ToastHost } from '@langgenius/dify-ui/toast' /** * Integration test: Self-Hosted Plan Flow * @@ -10,7 +11,6 @@ import { cleanup, render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import * as React from 'react' -import { toast, ToastHost } from '@/app/components/base/ui/toast' import { contactSalesUrl, getStartedWithCommunityUrl, getWithPremiumUrl } from '@/app/components/billing/config' import SelfHostedPlanItem from '@/app/components/billing/pricing/plans/self-hosted-plan-item' import { SelfHostedPlan } from '@/app/components/billing/type' diff --git a/web/__tests__/datasets/create-dataset-flow.test.tsx b/web/__tests__/datasets/create-dataset-flow.test.tsx index 34d64d8c43..c8504a10c7 100644 --- a/web/__tests__/datasets/create-dataset-flow.test.tsx +++ b/web/__tests__/datasets/create-dataset-flow.test.tsx @@ -33,7 +33,7 @@ vi.mock('@/service/knowledge/use-dataset', () => ({ useInvalidDatasetList: () => vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ default: { notify: vi.fn() }, toast: { success: vi.fn(), diff --git a/web/__tests__/datasets/dataset-settings-flow.test.tsx b/web/__tests__/datasets/dataset-settings-flow.test.tsx index 7c53401b15..eaafcafe62 100644 --- a/web/__tests__/datasets/dataset-settings-flow.test.tsx +++ b/web/__tests__/datasets/dataset-settings-flow.test.tsx @@ -59,7 +59,7 @@ vi.mock('@/app/components/datasets/common/check-rerank-model', () => ({ isReRankModelSelected: () => true, })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: mockToastError, success: vi.fn(), @@ -318,7 +318,7 @@ describe('Dataset Settings Flow - Cross-Module Configuration Cascade', () => { describe('Form Submission Validation → All Fields Together', () => { it('should reject empty name on save', async () => { - const { toast } = await import('@/app/components/base/ui/toast') + const { toast } = await import('@langgenius/dify-ui/toast') const { result } = renderHook(() => useFormState()) act(() => { diff --git a/web/__tests__/explore/sidebar-lifecycle-flow.test.tsx b/web/__tests__/explore/sidebar-lifecycle-flow.test.tsx index 64dd5321ac..35c8175a36 100644 --- a/web/__tests__/explore/sidebar-lifecycle-flow.test.tsx +++ b/web/__tests__/explore/sidebar-lifecycle-flow.test.tsx @@ -53,8 +53,8 @@ vi.mock('@/service/use-explore', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, toast: { diff --git a/web/__tests__/plugins/plugin-install-flow.test.ts b/web/__tests__/plugins/plugin-install-flow.test.ts index dd5a18b724..d975eb7167 100644 --- a/web/__tests__/plugins/plugin-install-flow.test.ts +++ b/web/__tests__/plugins/plugin-install-flow.test.ts @@ -10,7 +10,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import { checkForUpdates, fetchReleases, handleUpload } from '@/app/components/plugins/install-plugin/hooks' const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign((message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { success: (message: string) => mockToastNotify({ type: 'success', message }), error: (message: string) => mockToastNotify({ type: 'error', message }), diff --git a/web/__tests__/rag-pipeline/dsl-export-import-flow.test.ts b/web/__tests__/rag-pipeline/dsl-export-import-flow.test.ts index cdf7aba4f6..cc97065d8f 100644 --- a/web/__tests__/rag-pipeline/dsl-export-import-flow.test.ts +++ b/web/__tests__/rag-pipeline/dsl-export-import-flow.test.ts @@ -20,7 +20,7 @@ const mockToast = { promise: vi.fn(), } -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: mockToast, })) const mockEventEmitter = { emit: vi.fn() } diff --git a/web/__tests__/tools/tool-provider-detail-flow.test.tsx b/web/__tests__/tools/tool-provider-detail-flow.test.tsx index c52871c946..9cf4772152 100644 --- a/web/__tests__/tools/tool-provider-detail-flow.test.tsx +++ b/web/__tests__/tools/tool-provider-detail-flow.test.tsx @@ -133,7 +133,7 @@ vi.mock('@/app/components/base/drawer', () => ({ ), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ default: { notify: vi.fn() }, toast: { success: vi.fn(), diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/card-view.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/card-view.tsx index 289e50c257..8ef0b65e0f 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/card-view.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/card-view.tsx @@ -5,6 +5,7 @@ import type { BlockEnum } from '@/app/components/workflow/types' import type { UpdateAppSiteCodeResponse } from '@/models/app' import type { App } from '@/types/app' import type { I18nKeysByPrefix } from '@/types/i18n' +import { toast } from '@langgenius/dify-ui/toast' import * as React from 'react' import { useCallback, useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' @@ -12,7 +13,6 @@ import AppCard from '@/app/components/app/overview/app-card' import TriggerCard from '@/app/components/app/overview/trigger-card' import { useStore as useAppStore } from '@/app/components/app/store' import Loading from '@/app/components/base/loading' -import { toast } from '@/app/components/base/ui/toast' import MCPServiceCard from '@/app/components/tools/mcp/mcp-service-card' import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager' import { webSocketClient } from '@/app/components/workflow/collaboration/core/websocket-manager' 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 3efd58ac40..471ab86e12 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 @@ -2,12 +2,12 @@ import type { FC, JSX } from 'react' import type { AliyunConfig, ArizeConfig, DatabricksConfig, LangFuseConfig, LangSmithConfig, MLflowConfig, OpikConfig, PhoenixConfig, TencentConfig, WeaveConfig } from './type' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { useBoolean } from 'ahooks' import * as React from 'react' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Divider from '@/app/components/base/divider' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import Indicator from '@/app/components/header/indicator' import ProviderConfigModal from './provider-config-modal' diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx index 9c42f85825..35fafb2a79 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx @@ -3,6 +3,7 @@ import type { FC } from 'react' import type { AliyunConfig, ArizeConfig, DatabricksConfig, LangFuseConfig, LangSmithConfig, MLflowConfig, OpikConfig, PhoenixConfig, TencentConfig, WeaveConfig } from './type' import type { TracingStatus } from '@/models/app' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowDownDoubleLine, RiEqualizer2Line, @@ -14,7 +15,6 @@ import { useTranslation } from 'react-i18next' import Divider from '@/app/components/base/divider' import { AliyunIcon, ArizeIcon, DatabricksIcon, LangfuseIcon, LangsmithIcon, MlflowIcon, OpikIcon, PhoenixIcon, TencentIcon, WeaveIcon } from '@/app/components/base/icons/src/public/tracing' import Loading from '@/app/components/base/loading' -import { toast } from '@/app/components/base/ui/toast' import Indicator from '@/app/components/header/indicator' import { useAppContext } from '@/context/app-context' import { usePathname } from '@/next/navigation' 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 6ff8725f63..4f2497ad71 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 @@ -1,6 +1,17 @@ 'use client' import type { FC } from 'react' import type { AliyunConfig, ArizeConfig, DatabricksConfig, LangFuseConfig, LangSmithConfig, MLflowConfig, OpikConfig, PhoenixConfig, TencentConfig, WeaveConfig } from './type' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogDescription, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useBoolean } from 'ahooks' import * as React from 'react' import { useCallback, useState } from 'react' @@ -12,17 +23,6 @@ import { PortalToFollowElem, PortalToFollowElemContent, } from '@/app/components/base/portal-to-follow-elem' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogDescription, - AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { addTracingConfig, removeTracingConfig, updateTracingConfig } from '@/service/apps' import { docURL } from './config' import Field from './field' diff --git a/web/app/(humanInputLayout)/form/[token]/form.tsx b/web/app/(humanInputLayout)/form/[token]/form.tsx index be30585101..76dcd24293 100644 --- a/web/app/(humanInputLayout)/form/[token]/form.tsx +++ b/web/app/(humanInputLayout)/form/[token]/form.tsx @@ -1,8 +1,9 @@ 'use client' -import type { ButtonProps } from '@/app/components/base/ui/button' +import type { ButtonProps } from '@langgenius/dify-ui/button' import type { FormInputItem, UserAction } from '@/app/components/workflow/nodes/human-input/types' import type { SiteInfo } from '@/models/share' import type { HumanInputFormError } from '@/service/use-share' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiCheckboxCircleFill, @@ -19,7 +20,6 @@ import ExpirationTime from '@/app/components/base/chat/chat/answer/human-input-c import { getButtonStyle } from '@/app/components/base/chat/chat/answer/human-input-content/utils' import Loading from '@/app/components/base/loading' import DifyLogo from '@/app/components/base/logo/dify-logo' -import { Button } from '@/app/components/base/ui/button' import useDocumentTitle from '@/hooks/use-document-title' import { useParams } from '@/next/navigation' import { useGetHumanInputForm, useSubmitHumanInputForm } from '@/service/use-share' diff --git a/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx b/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx index d19e5a7d2d..d5b3237b12 100644 --- a/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx +++ b/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx @@ -1,10 +1,10 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowLeftLine, RiMailSendFill } from '@remixicon/react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' diff --git a/web/app/(shareLayout)/webapp-reset-password/page.tsx b/web/app/(shareLayout)/webapp-reset-password/page.tsx index cb6ece219c..2174ac0e8e 100644 --- a/web/app/(shareLayout)/webapp-reset-password/page.tsx +++ b/web/app/(shareLayout)/webapp-reset-password/page.tsx @@ -1,11 +1,11 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowLeftLine, RiLockPasswordLine } from '@remixicon/react' import { noop } from 'es-toolkit/function' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { COUNT_DOWN_KEY, COUNT_DOWN_TIME_MS } from '@/app/components/signin/countdown' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' diff --git a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx index df102e609a..9a290f8789 100644 --- a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx +++ b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx @@ -1,12 +1,12 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiCheckboxCircleFill } from '@remixicon/react' import { useCountDown } from 'ahooks' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { validPassword } from '@/config' import { useRouter, useSearchParams } from '@/next/navigation' import { changeWebAppPasswordWithToken } from '@/service/common' diff --git a/web/app/(shareLayout)/webapp-signin/check-code/page.tsx b/web/app/(shareLayout)/webapp-signin/check-code/page.tsx index b17fff4e52..c8d3351ded 100644 --- a/web/app/(shareLayout)/webapp-signin/check-code/page.tsx +++ b/web/app/(shareLayout)/webapp-signin/check-code/page.tsx @@ -1,11 +1,11 @@ 'use client' import type { FormEvent } from 'react' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowLeftLine, RiMailSendFill } from '@remixicon/react' import { useCallback, useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' import { useWebAppStore } from '@/context/web-app-context' diff --git a/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx index 9b4a369908..fe6b157c1e 100644 --- a/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx +++ b/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx @@ -1,9 +1,9 @@ 'use client' +import { toast } from '@langgenius/dify-ui/toast' import * as React from 'react' import { useCallback, useEffect } from 'react' import AppUnavailable from '@/app/components/base/app-unavailable' import Loading from '@/app/components/base/loading' -import { toast } from '@/app/components/base/ui/toast' import { useGlobalPublicStore } from '@/context/global-public-context' import { useRouter, useSearchParams } from '@/next/navigation' import { fetchWebOAuth2SSOUrl, fetchWebOIDCSSOUrl, fetchWebSAMLSSOUrl } from '@/service/share' diff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx index f600dba8b2..2d2fde1808 100644 --- a/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx +++ b/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx @@ -1,9 +1,9 @@ +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { noop } from 'es-toolkit/function' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { COUNT_DOWN_KEY, COUNT_DOWN_TIME_MS } from '@/app/components/signin/countdown' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' diff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx index 7fe5363927..79607a77df 100644 --- a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx +++ b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx @@ -1,10 +1,10 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { noop } from 'es-toolkit/function' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' import { useWebAppStore } from '@/context/web-app-context' diff --git a/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx index d8759cc1d6..53ff80ced5 100644 --- a/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx +++ b/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx @@ -1,10 +1,10 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { useRouter, useSearchParams } from '@/next/navigation' import { fetchMembersOAuth2SSOUrl, fetchMembersOIDCSSOUrl, fetchMembersSAMLSSOUrl } from '@/service/share' import { SSOProtocol } from '@/types/feature' diff --git a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx index 05048008b4..429eece383 100644 --- a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx +++ b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx @@ -1,9 +1,13 @@ 'use client' +import type { AvatarProps } from '@langgenius/dify-ui/avatar' import type { Area } from 'react-easy-crop' import type { OnImageInput } from '@/app/components/base/app-icon-picker/ImageInput' -import type { AvatarProps } from '@/app/components/base/ui/avatar' import type { ImageFile } from '@/types/app' +import { Avatar } from '@langgenius/dify-ui/avatar' +import { Button } from '@langgenius/dify-ui/button' +import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog' +import { toast } from '@langgenius/dify-ui/toast' import { RiDeleteBin5Line, RiPencilLine } from '@remixicon/react' import * as React from 'react' import { useCallback, useState } from 'react' @@ -12,10 +16,6 @@ import ImageInput from '@/app/components/base/app-icon-picker/ImageInput' import getCroppedImg from '@/app/components/base/app-icon-picker/utils' import Divider from '@/app/components/base/divider' import { useLocalFileUploader } from '@/app/components/base/image-uploader/hooks' -import { Avatar } from '@/app/components/base/ui/avatar' -import { Button } from '@/app/components/base/ui/button' -import { Dialog, DialogContent } from '@/app/components/base/ui/dialog' -import { toast } from '@/app/components/base/ui/toast' import { DISABLE_UPLOAD_IMAGE_AS_ICON } from '@/config' import { updateUserProfile } from '@/service/common' 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 1b91c801bd..f3bb71c2d2 100644 --- a/web/app/account/(commonLayout)/account-page/email-change-modal.tsx +++ b/web/app/account/(commonLayout)/account-page/email-change-modal.tsx @@ -1,12 +1,12 @@ import type { ResponseError } from '@/service/fetch' +import { Button } from '@langgenius/dify-ui/button' +import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog' +import { toast } from '@langgenius/dify-ui/toast' import { RiCloseLine } from '@remixicon/react' import * as React from 'react' import { useState } from 'react' import { Trans, useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { Dialog, DialogContent } from '@/app/components/base/ui/dialog' -import { toast } from '@/app/components/base/ui/toast' import { useRouter } from '@/next/navigation' import { checkEmailExisted, diff --git a/web/app/account/(commonLayout)/account-page/index.tsx b/web/app/account/(commonLayout)/account-page/index.tsx index 8ad1b45467..a26fa942db 100644 --- a/web/app/account/(commonLayout)/account-page/index.tsx +++ b/web/app/account/(commonLayout)/account-page/index.tsx @@ -1,6 +1,9 @@ 'use client' import type { IItem } from '@/app/components/header/account-setting/collapse' import type { App } from '@/types/app' +import { Button } from '@langgenius/dify-ui/button' +import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog' +import { toast } from '@langgenius/dify-ui/toast' import { RiGraduationCapFill, } from '@remixicon/react' @@ -10,9 +13,6 @@ import { useTranslation } from 'react-i18next' import AppIcon from '@/app/components/base/app-icon' import Input from '@/app/components/base/input' import PremiumBadge from '@/app/components/base/premium-badge' -import { Button } from '@/app/components/base/ui/button' -import { Dialog, DialogContent } from '@/app/components/base/ui/dialog' -import { toast } from '@/app/components/base/ui/toast' import Collapse from '@/app/components/header/account-setting/collapse' import { IS_CE_EDITION, validPassword } from '@/config' import { useGlobalPublicStore } from '@/context/global-public-context' diff --git a/web/app/account/(commonLayout)/avatar.tsx b/web/app/account/(commonLayout)/avatar.tsx index 538e09b0fd..0893b130c4 100644 --- a/web/app/account/(commonLayout)/avatar.tsx +++ b/web/app/account/(commonLayout)/avatar.tsx @@ -1,5 +1,6 @@ 'use client' import { Menu, MenuButton, MenuItem, MenuItems, Transition } from '@headlessui/react' +import { Avatar } from '@langgenius/dify-ui/avatar' import { RiGraduationCapFill, } from '@remixicon/react' @@ -8,7 +9,6 @@ import { useTranslation } from 'react-i18next' import { resetUser } from '@/app/components/base/amplitude/utils' import { LogOut01 } from '@/app/components/base/icons/src/vender/line/general' import PremiumBadge from '@/app/components/base/premium-badge' -import { Avatar } from '@/app/components/base/ui/avatar' import { useProviderContext } from '@/context/provider-context' import { useRouter } from '@/next/navigation' import { useLogout, useUserProfile } from '@/service/use-common' diff --git a/web/app/account/(commonLayout)/delete-account/components/check-email.tsx b/web/app/account/(commonLayout)/delete-account/components/check-email.tsx index 3c7b7112f3..7e3351a10a 100644 --- a/web/app/account/(commonLayout)/delete-account/components/check-email.tsx +++ b/web/app/account/(commonLayout)/delete-account/components/check-email.tsx @@ -1,8 +1,8 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' import { useAppContext } from '@/context/app-context' import Link from '@/next/link' import { useSendDeleteAccountEmail } from '../state' 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 9690bf8ed1..ee1e72e6e7 100644 --- a/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx +++ b/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx @@ -1,10 +1,10 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import CustomDialog from '@/app/components/base/dialog' import Textarea from '@/app/components/base/textarea' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { useAppContext } from '@/context/app-context' import { useRouter } from '@/next/navigation' import { useLogout } from '@/service/use-common' diff --git a/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx b/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx index 01e19e51b1..91c0d7737d 100644 --- a/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx +++ b/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx @@ -1,8 +1,8 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' import Countdown from '@/app/components/signin/countdown' import Link from '@/next/link' import { useAccountDeleteStore, useConfirmDeleteAccount, useSendDeleteAccountEmail } from '../state' diff --git a/web/app/account/(commonLayout)/header.tsx b/web/app/account/(commonLayout)/header.tsx index 688a1d7729..f0912d45d5 100644 --- a/web/app/account/(commonLayout)/header.tsx +++ b/web/app/account/(commonLayout)/header.tsx @@ -1,9 +1,9 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { RiArrowRightUpLine, RiRobot2Line } from '@remixicon/react' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import DifyLogo from '@/app/components/base/logo/dify-logo' -import { Button } from '@/app/components/base/ui/button' import { useGlobalPublicStore } from '@/context/global-public-context' import { useRouter } from '@/next/navigation' import Avatar from './avatar' diff --git a/web/app/account/oauth/authorize/page.tsx b/web/app/account/oauth/authorize/page.tsx index f370efcd3e..cd035ce16f 100644 --- a/web/app/account/oauth/authorize/page.tsx +++ b/web/app/account/oauth/authorize/page.tsx @@ -1,5 +1,8 @@ 'use client' +import { Avatar } from '@langgenius/dify-ui/avatar' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiAccountCircleLine, RiGlobalLine, @@ -11,9 +14,6 @@ import * as React from 'react' import { useEffect, useRef } from 'react' import { useTranslation } from 'react-i18next' import Loading from '@/app/components/base/loading' -import { Avatar } from '@/app/components/base/ui/avatar' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks' import { setPostLoginRedirect } from '@/app/signin/utils/post-login-redirect' import { useRouter, useSearchParams } from '@/next/navigation' diff --git a/web/app/activate/activateForm.tsx b/web/app/activate/activateForm.tsx index 9b0a5f5b21..5fafa8eca1 100644 --- a/web/app/activate/activateForm.tsx +++ b/web/app/activate/activateForm.tsx @@ -1,9 +1,9 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { useEffect } from 'react' import { useTranslation } from 'react-i18next' import Loading from '@/app/components/base/loading' -import { Button } from '@/app/components/base/ui/button' import useDocumentTitle from '@/hooks/use-document-title' import { useRouter, useSearchParams } from '@/next/navigation' diff --git a/web/app/components/app-sidebar/__tests__/app-sidebar-dropdown.spec.tsx b/web/app/components/app-sidebar/__tests__/app-sidebar-dropdown.spec.tsx index 5e18bbc343..5557118c78 100644 --- a/web/app/components/app-sidebar/__tests__/app-sidebar-dropdown.spec.tsx +++ b/web/app/components/app-sidebar/__tests__/app-sidebar-dropdown.spec.tsx @@ -19,7 +19,7 @@ vi.mock('@/context/app-context', () => ({ }), })) -vi.mock('@/app/components/base/ui/dropdown-menu', () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', () => { const DropdownMenuContext = React.createContext<{ isOpen: boolean, setOpen: (open: boolean) => void } | null>(null) const useDropdownMenuContext = () => { diff --git a/web/app/components/app-sidebar/__tests__/dataset-sidebar-dropdown.spec.tsx b/web/app/components/app-sidebar/__tests__/dataset-sidebar-dropdown.spec.tsx index 5060987cda..5c45df470a 100644 --- a/web/app/components/app-sidebar/__tests__/dataset-sidebar-dropdown.spec.tsx +++ b/web/app/components/app-sidebar/__tests__/dataset-sidebar-dropdown.spec.tsx @@ -21,7 +21,7 @@ vi.mock('@/hooks/use-knowledge', () => ({ }), })) -vi.mock('@/app/components/base/ui/dropdown-menu', () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', () => { const DropdownMenuContext = React.createContext<{ isOpen: boolean, setOpen: (open: boolean) => void } | null>(null) const useDropdownMenuContext = () => { diff --git a/web/app/components/app-sidebar/app-info/__tests__/app-info-detail-panel.spec.tsx b/web/app/components/app-sidebar/app-info/__tests__/app-info-detail-panel.spec.tsx index 2171974253..9af90359f0 100644 --- a/web/app/components/app-sidebar/app-info/__tests__/app-info-detail-panel.spec.tsx +++ b/web/app/components/app-sidebar/app-info/__tests__/app-info-detail-panel.spec.tsx @@ -35,7 +35,7 @@ vi.mock('@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/card-view', ), })) -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, onClick, className, size, variant }: { children: React.ReactNode onClick?: () => void diff --git a/web/app/components/app-sidebar/app-info/__tests__/app-operations.spec.tsx b/web/app/components/app-sidebar/app-info/__tests__/app-operations.spec.tsx index 461cedc20c..ff6aed2c71 100644 --- a/web/app/components/app-sidebar/app-info/__tests__/app-operations.spec.tsx +++ b/web/app/components/app-sidebar/app-info/__tests__/app-operations.spec.tsx @@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event' import * as React from 'react' import AppOperations from '../app-operations' -vi.mock('../../../base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, onClick, className, size, variant, id, tabIndex, ...rest }: { 'children': React.ReactNode 'onClick'?: () => void @@ -30,7 +30,7 @@ vi.mock('../../../base/ui/button', () => ({ ), })) -vi.mock('../../../base/ui/dropdown-menu', () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', () => { const DropdownMenuContext = React.createContext<{ isOpen: boolean, setOpen: (open: boolean) => void } | null>(null) const useDropdownMenuContext = () => { diff --git a/web/app/components/app-sidebar/app-info/__tests__/use-app-info-actions.spec.ts b/web/app/components/app-sidebar/app-info/__tests__/use-app-info-actions.spec.ts index 5b10b4c32b..23e5e51949 100644 --- a/web/app/components/app-sidebar/app-info/__tests__/use-app-info-actions.spec.ts +++ b/web/app/components/app-sidebar/app-info/__tests__/use-app-info-actions.spec.ts @@ -50,7 +50,7 @@ vi.mock('@/app/components/app/store', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(toastMocks.api, { success: vi.fn((message, options) => toastMocks.call({ type: 'success', message, ...options })), error: vi.fn((message, options) => toastMocks.call({ type: 'error', message, ...options })), diff --git a/web/app/components/app-sidebar/app-info/app-info-detail-panel.tsx b/web/app/components/app-sidebar/app-info/app-info-detail-panel.tsx index 624630b179..9afa0063dc 100644 --- a/web/app/components/app-sidebar/app-info/app-info-detail-panel.tsx +++ b/web/app/components/app-sidebar/app-info/app-info-detail-panel.tsx @@ -1,6 +1,7 @@ import type { Operation } from './app-operations' import type { AppInfoModalType } from './use-app-info-actions' import type { App, AppSSO } from '@/types/app' +import { Button } from '@langgenius/dify-ui/button' import { RiDeleteBinLine, RiEditLine, @@ -14,7 +15,6 @@ import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import CardView from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/card-view' import ContentDialog from '@/app/components/base/content-dialog' -import { Button } from '@/app/components/base/ui/button' import { AppModeEnum } from '@/types/app' import AppIcon from '../../base/app-icon' import { getAppModeLabel } from './app-mode-labels' diff --git a/web/app/components/app-sidebar/app-info/app-info-modals.tsx b/web/app/components/app-sidebar/app-info/app-info-modals.tsx index fa84ecc0b6..7d142e0cc6 100644 --- a/web/app/components/app-sidebar/app-info/app-info-modals.tsx +++ b/web/app/components/app-sidebar/app-info/app-info-modals.tsx @@ -3,10 +3,6 @@ import type { DuplicateAppModalProps } from '@/app/components/app/duplicate-moda import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal' import type { EnvironmentVariable } from '@/app/components/workflow/types' import type { App, AppSSO } from '@/types/app' -import * as React from 'react' -import { useState } from 'react' -import { useTranslation } from 'react-i18next' -import Input from '@/app/components/base/input' import { AlertDialog, AlertDialogActions, @@ -15,7 +11,11 @@ import { AlertDialogContent, AlertDialogDescription, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' +} from '@langgenius/dify-ui/alert-dialog' +import * as React from 'react' +import { useState } from 'react' +import { useTranslation } from 'react-i18next' +import Input from '@/app/components/base/input' import dynamic from '@/next/dynamic' const SwitchAppModal = dynamic(() => import('@/app/components/app/switch-app-modal'), { ssr: false }) diff --git a/web/app/components/app-sidebar/app-info/app-operations.tsx b/web/app/components/app-sidebar/app-info/app-operations.tsx index 095fb31206..cc6afd739c 100644 --- a/web/app/components/app-sidebar/app-info/app-operations.tsx +++ b/web/app/components/app-sidebar/app-info/app-operations.tsx @@ -1,15 +1,15 @@ import type { JSX } from 'react' -import { RiMoreLine } from '@remixicon/react' -import { cloneElement, useEffect, useMemo, useRef, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, -} from '../../base/ui/dropdown-menu' +} from '@langgenius/dify-ui/dropdown-menu' +import { RiMoreLine } from '@remixicon/react' +import { cloneElement, useEffect, useMemo, useRef, useState } from 'react' +import { useTranslation } from 'react-i18next' export type Operation = { id: string diff --git a/web/app/components/app-sidebar/app-info/use-app-info-actions.ts b/web/app/components/app-sidebar/app-info/use-app-info-actions.ts index 3192d48f81..5ca0e85c18 100644 --- a/web/app/components/app-sidebar/app-info/use-app-info-actions.ts +++ b/web/app/components/app-sidebar/app-info/use-app-info-actions.ts @@ -1,10 +1,10 @@ import type { DuplicateAppModalProps } from '@/app/components/app/duplicate-modal' import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal' import type { EnvironmentVariable } from '@/app/components/workflow/types' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { useStore as useAppStore } from '@/app/components/app/store' -import { toast } from '@/app/components/base/ui/toast' import { NEED_REFRESH_APP_LIST_KEY } from '@/config' import { useProviderContext } from '@/context/provider-context' import { useRouter } from '@/next/navigation' diff --git a/web/app/components/app-sidebar/app-sidebar-dropdown.tsx b/web/app/components/app-sidebar/app-sidebar-dropdown.tsx index 617d14f426..0b5f13d918 100644 --- a/web/app/components/app-sidebar/app-sidebar-dropdown.tsx +++ b/web/app/components/app-sidebar/app-sidebar-dropdown.tsx @@ -1,5 +1,10 @@ import type { NavIcon } from './nav-link' import { cn } from '@langgenius/dify-ui/cn' +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuTrigger, +} from '@langgenius/dify-ui/dropdown-menu' import { RiEqualizer2Line, RiMenuLine, @@ -8,11 +13,6 @@ import * as React from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import { useStore as useAppStore } from '@/app/components/app/store' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' import { useAppContext } from '@/context/app-context' import AppIcon from '../base/app-icon' import Divider from '../base/divider' diff --git a/web/app/components/app-sidebar/dataset-info/__tests__/dropdown-callbacks.spec.tsx b/web/app/components/app-sidebar/dataset-info/__tests__/dropdown-callbacks.spec.tsx index b514b6e095..ceb8302ee6 100644 --- a/web/app/components/app-sidebar/dataset-info/__tests__/dropdown-callbacks.spec.tsx +++ b/web/app/components/app-sidebar/dataset-info/__tests__/dropdown-callbacks.spec.tsx @@ -112,7 +112,7 @@ vi.mock('@/service/datasets', () => ({ deleteDataset: (...args: unknown[]) => mockDeleteDataset(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: (...args: unknown[]) => mockToast(...args), })) diff --git a/web/app/components/app-sidebar/dataset-info/dropdown.tsx b/web/app/components/app-sidebar/dataset-info/dropdown.tsx index e69b3d7e32..8f3a25738a 100644 --- a/web/app/components/app-sidebar/dataset-info/dropdown.tsx +++ b/web/app/components/app-sidebar/dataset-info/dropdown.tsx @@ -1,9 +1,23 @@ import type { DataSet } from '@/models/datasets' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogDescription, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' import { cn } from '@langgenius/dify-ui/cn' +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuTrigger, +} from '@langgenius/dify-ui/dropdown-menu' +import { toast } from '@langgenius/dify-ui/toast' import * as React from 'react' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { useSelector as useAppContextWithSelector } from '@/context/app-context' import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail' import { useRouter } from '@/next/navigation' @@ -13,20 +27,6 @@ import { useInvalid } from '@/service/use-base' import { useExportPipelineDSL } from '@/service/use-pipeline' import { downloadBlob } from '@/utils/download' import ActionButton from '../../base/action-button' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogDescription, - AlertDialogTitle, -} from '../../base/ui/alert-dialog' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuTrigger, -} from '../../base/ui/dropdown-menu' import RenameDatasetModal from '../../datasets/rename-modal' import Menu from './menu' diff --git a/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx b/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx index 3968a0df6f..805636fb55 100644 --- a/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx +++ b/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx @@ -1,17 +1,17 @@ import type { NavIcon } from './nav-link' import type { DataSet } from '@/models/datasets' import { cn } from '@langgenius/dify-ui/cn' +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuTrigger, +} from '@langgenius/dify-ui/dropdown-menu' import { RiMenuLine, } from '@remixicon/react' import * as React from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail' import { useKnowledge } from '@/hooks/use-knowledge' import { DOC_FORM_TEXT } from '@/models/datasets' diff --git a/web/app/components/app-sidebar/toggle-button.tsx b/web/app/components/app-sidebar/toggle-button.tsx index 5800ff2263..6aca77fb4f 100644 --- a/web/app/components/app-sidebar/toggle-button.tsx +++ b/web/app/components/app-sidebar/toggle-button.tsx @@ -1,8 +1,8 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowLeftSLine, RiArrowRightSLine } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import Tooltip from '../base/tooltip' import ShortcutsName from '../workflow/shortcuts-name' diff --git a/web/app/components/app/annotation/__tests__/index.spec.tsx b/web/app/components/app/annotation/__tests__/index.spec.tsx index cd9b127c7f..2bd94d03b0 100644 --- a/web/app/components/app/annotation/__tests__/index.spec.tsx +++ b/web/app/components/app/annotation/__tests__/index.spec.tsx @@ -2,9 +2,9 @@ import type { Mock } from 'vitest' import type { AnnotationItem } from '../type' import type { App } from '@/types/app' +import { toast } from '@langgenius/dify-ui/toast' import { act, fireEvent, render, screen, waitFor } from '@testing-library/react' import * as React from 'react' -import { toast } from '@/app/components/base/ui/toast' import { useProviderContext } from '@/context/provider-context' import { addAnnotation, diff --git a/web/app/components/app/annotation/add-annotation-modal/__tests__/index.spec.tsx b/web/app/components/app/annotation/add-annotation-modal/__tests__/index.spec.tsx index d7e46f9f92..497c623f3e 100644 --- a/web/app/components/app/annotation/add-annotation-modal/__tests__/index.spec.tsx +++ b/web/app/components/app/annotation/add-annotation-modal/__tests__/index.spec.tsx @@ -9,7 +9,7 @@ vi.mock('@/context/provider-context', () => ({ })) const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ default: { notify: vi.fn(args => mockToastNotify(args)), }, diff --git a/web/app/components/app/annotation/add-annotation-modal/index.tsx b/web/app/components/app/annotation/add-annotation-modal/index.tsx index dbdf909c0a..ba987a8a8a 100644 --- a/web/app/components/app/annotation/add-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/add-annotation-modal/index.tsx @@ -1,13 +1,13 @@ 'use client' import type { FC } from 'react' import type { AnnotationItemBasic } from '../type' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import * as React from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Checkbox from '@/app/components/base/checkbox' import Drawer from '@/app/components/base/drawer-plus' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import AnnotationFull from '@/app/components/billing/annotation-full' import { useProviderContext } from '@/context/provider-context' import EditItem, { EditItemType } from './edit-item' diff --git a/web/app/components/app/annotation/batch-action.tsx b/web/app/components/app/annotation/batch-action.tsx index da7d0c70dd..938dcb03bd 100644 --- a/web/app/components/app/annotation/batch-action.tsx +++ b/web/app/components/app/annotation/batch-action.tsx @@ -1,10 +1,4 @@ import type { FC } from 'react' -import { cn } from '@langgenius/dify-ui/cn' -import { RiDeleteBinLine } from '@remixicon/react' -import { useBoolean } from 'ahooks' -import * as React from 'react' -import { useTranslation } from 'react-i18next' -import Divider from '@/app/components/base/divider' import { AlertDialog, AlertDialogActions, @@ -12,7 +6,13 @@ import { AlertDialogConfirmButton, AlertDialogContent, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' +} from '@langgenius/dify-ui/alert-dialog' +import { cn } from '@langgenius/dify-ui/cn' +import { RiDeleteBinLine } from '@remixicon/react' +import { useBoolean } from 'ahooks' +import * as React from 'react' +import { useTranslation } from 'react-i18next' +import Divider from '@/app/components/base/divider' const i18nPrefix = 'batchAction' diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/csv-uploader.spec.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/csv-uploader.spec.tsx index d26ab051ef..5fc1cd25e1 100644 --- a/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/csv-uploader.spec.tsx +++ b/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/csv-uploader.spec.tsx @@ -10,7 +10,7 @@ const toastMocks = vi.hoisted(() => ({ promise: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: (message: string, options?: Record) => toastMocks.notify({ type: 'success', message, ...options }), error: (message: string, options?: Record) => toastMocks.notify({ type: 'error', message, ...options }), diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/index.spec.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/index.spec.tsx index 3176b1addb..c5d7232e12 100644 --- a/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/index.spec.tsx +++ b/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/index.spec.tsx @@ -43,7 +43,7 @@ vi.mock('@/app/components/billing/annotation-full', () => ({ })) const mockNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ default: { notify: (args: unknown) => mockNotify(args), }, diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx index 02dcf27aea..dc63b5c9be 100644 --- a/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx +++ b/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx @@ -1,13 +1,13 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiDeleteBinLine } from '@remixicon/react' import * as React from 'react' import { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { Csv as CSVIcon } from '@/app/components/base/icons/src/public/files' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' export type Props = { file: File | undefined 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 20a35714e8..550794cce7 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,13 +1,13 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiCloseLine } from '@remixicon/react' import { noop } from 'es-toolkit/function' import * as React from 'react' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import AnnotationFull from '@/app/components/billing/annotation-full' import { useProviderContext } from '@/context/provider-context' import { annotationBatchImport, checkAnnotationBatchImportProgress } from '@/service/annotation' diff --git a/web/app/components/app/annotation/clear-all-annotations-confirm-modal/index.tsx b/web/app/components/app/annotation/clear-all-annotations-confirm-modal/index.tsx index b960e1d59c..6b0ef19e7b 100644 --- a/web/app/components/app/annotation/clear-all-annotations-confirm-modal/index.tsx +++ b/web/app/components/app/annotation/clear-all-annotations-confirm-modal/index.tsx @@ -1,8 +1,6 @@ 'use client' import type { FC } from 'react' -import * as React from 'react' -import { useTranslation } from 'react-i18next' import { AlertDialog, AlertDialogActions, @@ -10,7 +8,9 @@ import { AlertDialogConfirmButton, AlertDialogContent, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' +} from '@langgenius/dify-ui/alert-dialog' +import * as React from 'react' +import { useTranslation } from 'react-i18next' type Props = { isShow: boolean diff --git a/web/app/components/app/annotation/edit-annotation-modal/__tests__/index.spec.tsx b/web/app/components/app/annotation/edit-annotation-modal/__tests__/index.spec.tsx index 4844017dde..733529dff8 100644 --- a/web/app/components/app/annotation/edit-annotation-modal/__tests__/index.spec.tsx +++ b/web/app/components/app/annotation/edit-annotation-modal/__tests__/index.spec.tsx @@ -1,6 +1,6 @@ +import { toast } from '@langgenius/dify-ui/toast' import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { toast } from '@/app/components/base/ui/toast' import EditAnnotationModal from '../index' const { mockAddAnnotation, mockEditAnnotation } = vi.hoisted(() => ({ diff --git a/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx index 4a62569816..609d7847bc 100644 --- a/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx +++ b/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx @@ -1,5 +1,6 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiDeleteBinLine, RiEditFill, RiEditLine } from '@remixicon/react' import * as React from 'react' @@ -7,7 +8,6 @@ import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { Robot, User } from '@/app/components/base/icons/src/public/avatar' import Textarea from '@/app/components/base/textarea' -import { Button } from '@/app/components/base/ui/button' export enum EditItemType { Query = 'query', diff --git a/web/app/components/app/annotation/edit-annotation-modal/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/index.tsx index c3d5b140eb..8e690eca9b 100644 --- a/web/app/components/app/annotation/edit-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/edit-annotation-modal/index.tsx @@ -1,10 +1,5 @@ 'use client' import type { FC } from 'react' -import * as React from 'react' -import { useState } from 'react' -import { useTranslation } from 'react-i18next' -import Drawer from '@/app/components/base/drawer-plus' -import { MessageCheckRemove } from '@/app/components/base/icons/src/vender/line/communication' import { AlertDialog, AlertDialogActions, @@ -12,8 +7,13 @@ import { AlertDialogConfirmButton, AlertDialogContent, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { toast } from '@/app/components/base/ui/toast' +} from '@langgenius/dify-ui/alert-dialog' +import { toast } from '@langgenius/dify-ui/toast' +import * as React from 'react' +import { useState } from 'react' +import { useTranslation } from 'react-i18next' +import Drawer from '@/app/components/base/drawer-plus' +import { MessageCheckRemove } from '@/app/components/base/icons/src/vender/line/communication' import AnnotationFull from '@/app/components/billing/annotation-full' import { useProviderContext } from '@/context/provider-context' import useTimestamp from '@/hooks/use-timestamp' diff --git a/web/app/components/app/annotation/header-opts/index.tsx b/web/app/components/app/annotation/header-opts/index.tsx index 0871a722f8..fc27524c71 100644 --- a/web/app/components/app/annotation/header-opts/index.tsx +++ b/web/app/components/app/annotation/header-opts/index.tsx @@ -2,19 +2,19 @@ import type { FC } from 'react' import type { AnnotationItemBasic } from '../type' import { Menu, MenuButton, MenuItems, Transition } from '@headlessui/react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuTrigger, +} from '@langgenius/dify-ui/dropdown-menu' import * as React from 'react' import { Fragment, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { useCSVDownloader, } from 'react-papaparse' -import { Button } from '@/app/components/base/ui/button' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' import { useLocale } from '@/context/i18n' import { LanguagesSupported } from '@/i18n-config/language' diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index 419aaba25d..cbad5b40ea 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -5,6 +5,8 @@ import type { AnnotationItem, AnnotationItemBasic } from './type' import type { AnnotationReplyConfig } from '@/models/debug' import type { App } from '@/types/app' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' +import { toast } from '@langgenius/dify-ui/toast' import { RiEqualizer2Line } from '@remixicon/react' import { useDebounce } from 'ahooks' import * as React from 'react' @@ -15,8 +17,6 @@ import ConfigParamModal from '@/app/components/base/features/new-feature-panel/a import { MessageFast } from '@/app/components/base/icons/src/vender/solid/communication' import Loading from '@/app/components/base/loading' import Pagination from '@/app/components/base/pagination' -import Switch from '@/app/components/base/switch' -import { toast } from '@/app/components/base/ui/toast' import AnnotationFullModal from '@/app/components/billing/annotation-full/modal' import { APP_PAGE_LIMIT } from '@/config' import { useProviderContext } from '@/context/provider-context' diff --git a/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx b/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx index 70e28b048c..864e098ca5 100644 --- a/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx +++ b/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx @@ -1,7 +1,5 @@ 'use client' import type { FC } from 'react' -import * as React from 'react' -import { useTranslation } from 'react-i18next' import { AlertDialog, AlertDialogActions, @@ -9,7 +7,9 @@ import { AlertDialogConfirmButton, AlertDialogContent, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' +} from '@langgenius/dify-ui/alert-dialog' +import * as React from 'react' +import { useTranslation } from 'react-i18next' type Props = { isShow: boolean diff --git a/web/app/components/app/annotation/view-annotation-modal/index.tsx b/web/app/components/app/annotation/view-annotation-modal/index.tsx index 8a5b53aa87..c9f7e8a78f 100644 --- a/web/app/components/app/annotation/view-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/view-annotation-modal/index.tsx @@ -1,6 +1,14 @@ 'use client' import type { FC } from 'react' import type { AnnotationItem, HitHistoryItem } from '../type' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' import { cn } from '@langgenius/dify-ui/cn' import * as React from 'react' import { useEffect, useState } from 'react' @@ -10,14 +18,6 @@ import Drawer from '@/app/components/base/drawer-plus' import { MessageCheckRemove } from '@/app/components/base/icons/src/vender/line/communication' import Pagination from '@/app/components/base/pagination' import TabSlider from '@/app/components/base/tab-slider-plain' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' import { APP_PAGE_LIMIT } from '@/config' import useTimestamp from '@/hooks/use-timestamp' import { fetchHitHistoryList } from '@/service/annotation' diff --git a/web/app/components/app/app-access-control/__tests__/access-control.spec.tsx b/web/app/components/app/app-access-control/__tests__/access-control.spec.tsx index 86ed6ac435..bbac21942e 100644 --- a/web/app/components/app/app-access-control/__tests__/access-control.spec.tsx +++ b/web/app/components/app/app-access-control/__tests__/access-control.spec.tsx @@ -1,9 +1,9 @@ /* eslint-disable ts/no-explicit-any */ import type { AccessControlAccount, AccessControlGroup, Subject } from '@/models/access-control' import type { App } from '@/types/app' +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { toast } from '@/app/components/base/ui/toast' import useAccessControlStore from '@/context/access-control-store' import { AccessMode, SubjectType } from '@/models/access-control' import AccessControlDialog from '../access-control-dialog' diff --git a/web/app/components/app/app-access-control/__tests__/index.spec.tsx b/web/app/components/app/app-access-control/__tests__/index.spec.tsx index 612d17d88a..05b86f0290 100644 --- a/web/app/components/app/app-access-control/__tests__/index.spec.tsx +++ b/web/app/components/app/app-access-control/__tests__/index.spec.tsx @@ -1,6 +1,6 @@ import type { App } from '@/types/app' +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen, waitFor } from '@testing-library/react' -import { toast } from '@/app/components/base/ui/toast' import useAccessControlStore from '@/context/access-control-store' import { AccessMode } from '@/models/access-control' import AccessControl from '../index' diff --git a/web/app/components/app/app-access-control/add-member-or-group-pop.tsx b/web/app/components/app/app-access-control/add-member-or-group-pop.tsx index 8c8087cf17..38f9c2ab50 100644 --- a/web/app/components/app/app-access-control/add-member-or-group-pop.tsx +++ b/web/app/components/app/app-access-control/add-member-or-group-pop.tsx @@ -1,14 +1,14 @@ 'use client' import type { AccessControlAccount, AccessControlGroup, Subject, SubjectAccount, SubjectGroup } from '@/models/access-control' import { FloatingOverlay } from '@floating-ui/react' +import { Avatar } from '@langgenius/dify-ui/avatar' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover' import { RiAddCircleFill, RiArrowRightSLine, RiOrganizationChart } from '@remixicon/react' import { useDebounce } from 'ahooks' import { useCallback, useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' -import { Avatar } from '@/app/components/base/ui/avatar' -import { Button } from '@/app/components/base/ui/button' -import { Popover, PopoverContent, PopoverTrigger } from '@/app/components/base/ui/popover' import { useSelector } from '@/context/app-context' import { SubjectType } from '@/models/access-control' import { useSearchForWhiteListCandidates } from '@/service/access-control' diff --git a/web/app/components/app/app-access-control/index.tsx b/web/app/components/app/app-access-control/index.tsx index aeaae3d46d..2997d4b4cf 100644 --- a/web/app/components/app/app-access-control/index.tsx +++ b/web/app/components/app/app-access-control/index.tsx @@ -2,11 +2,11 @@ import type { Subject } from '@/models/access-control' import type { App } from '@/types/app' import { Description as DialogDescription, DialogTitle } from '@headlessui/react' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiBuildingLine, RiGlobalLine, RiVerifiedBadgeLine } from '@remixicon/react' import { useCallback, useEffect } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { useGlobalPublicStore } from '@/context/global-public-context' import { AccessMode, SubjectType } from '@/models/access-control' import { useUpdateAccessMode } from '@/service/access-control' diff --git a/web/app/components/app/app-access-control/specific-groups-or-members.tsx b/web/app/components/app/app-access-control/specific-groups-or-members.tsx index 5b5c8342fc..1caabb3ff9 100644 --- a/web/app/components/app/app-access-control/specific-groups-or-members.tsx +++ b/web/app/components/app/app-access-control/specific-groups-or-members.tsx @@ -1,9 +1,9 @@ 'use client' import type { AccessControlAccount, AccessControlGroup } from '@/models/access-control' +import { Avatar } from '@langgenius/dify-ui/avatar' import { RiAlertFill, RiCloseCircleFill, RiLockLine, RiOrganizationChart } from '@remixicon/react' import { useCallback, useEffect } from 'react' import { useTranslation } from 'react-i18next' -import { Avatar } from '@/app/components/base/ui/avatar' import { AccessMode } from '@/models/access-control' import { useAppWhiteListSubjects } from '@/service/access-control' import useAccessControlStore from '../../../../context/access-control-store' diff --git a/web/app/components/app/app-publisher/__tests__/index.spec.tsx b/web/app/components/app/app-publisher/__tests__/index.spec.tsx index bba2f53afc..06d91e9400 100644 --- a/web/app/components/app/app-publisher/__tests__/index.spec.tsx +++ b/web/app/components/app/app-publisher/__tests__/index.spec.tsx @@ -93,7 +93,7 @@ vi.mock('@/service/use-workflow', () => ({ useInvalidateAppWorkflow: () => mockInvalidateAppWorkflow, })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => mockToastError(...args), }, diff --git a/web/app/components/app/app-publisher/__tests__/publish-with-multiple-model.spec.tsx b/web/app/components/app/app-publisher/__tests__/publish-with-multiple-model.spec.tsx index 465252c6c4..16628d742a 100644 --- a/web/app/components/app/app-publisher/__tests__/publish-with-multiple-model.spec.tsx +++ b/web/app/components/app/app-publisher/__tests__/publish-with-multiple-model.spec.tsx @@ -22,7 +22,7 @@ vi.mock('../../header/account-setting/model-provider-page/model-icon', () => ({ default: ({ modelName }: { modelName: string }) => {modelName}, })) -vi.mock('@/app/components/base/ui/dropdown-menu', async () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', async () => { const ReactModule = await vi.importActual('react') const OpenContext = ReactModule.createContext<{ open: boolean, setOpen: (nextOpen: boolean) => void } | null>(null) diff --git a/web/app/components/app/app-publisher/__tests__/version-info-modal.spec.tsx b/web/app/components/app/app-publisher/__tests__/version-info-modal.spec.tsx index ed86bb8571..4a461bd942 100644 --- a/web/app/components/app/app-publisher/__tests__/version-info-modal.spec.tsx +++ b/web/app/components/app/app-publisher/__tests__/version-info-modal.spec.tsx @@ -1,6 +1,6 @@ /* eslint-disable ts/no-explicit-any */ +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen } from '@testing-library/react' -import { toast } from '@/app/components/base/ui/toast' import VersionInfoModal from '../version-info-modal' vi.mock('react-i18next', () => ({ @@ -9,7 +9,7 @@ vi.mock('react-i18next', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: vi.fn(), }, diff --git a/web/app/components/app/app-publisher/features-wrapper.tsx b/web/app/components/app/app-publisher/features-wrapper.tsx index 7c39535701..8679b2830d 100644 --- a/web/app/components/app/app-publisher/features-wrapper.tsx +++ b/web/app/components/app/app-publisher/features-wrapper.tsx @@ -2,13 +2,6 @@ import type { AppPublisherProps } from '@/app/components/app/app-publisher' import type { ModelAndParameter } from '@/app/components/app/configuration/debug/types' import type { FileUpload } from '@/app/components/base/features/types' import type { PublishWorkflowParams } from '@/types/workflow' -import { produce } from 'immer' -import * as React from 'react' -import { useCallback, useState } from 'react' -import { useTranslation } from 'react-i18next' -import AppPublisher from '@/app/components/app/app-publisher' -import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' -import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants' import { AlertDialog, AlertDialogActions, @@ -17,7 +10,14 @@ import { AlertDialogContent, AlertDialogDescription, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' +} from '@langgenius/dify-ui/alert-dialog' +import { produce } from 'immer' +import * as React from 'react' +import { useCallback, useState } from 'react' +import { useTranslation } from 'react-i18next' +import AppPublisher from '@/app/components/app/app-publisher' +import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' +import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants' import { SupportUploadFileTypes } from '@/app/components/workflow/types' import { Resolution } from '@/types/app' diff --git a/web/app/components/app/app-publisher/index.tsx b/web/app/components/app/app-publisher/index.tsx index ce3698dbb7..562f2d7759 100644 --- a/web/app/components/app/app-publisher/index.tsx +++ b/web/app/components/app/app-publisher/index.tsx @@ -2,6 +2,9 @@ import type { ModelAndParameter } from '../configuration/debug/types' import type { CollaborationUpdate } from '@/app/components/workflow/collaboration/types/collaboration' import type { InputVar, Variable } from '@/app/components/workflow/types' import type { PublishWorkflowParams } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' +import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover' +import { toast } from '@langgenius/dify-ui/toast' import { useKeyPress } from 'ahooks' import { memo, @@ -15,8 +18,6 @@ import { useTranslation } from 'react-i18next' import EmbeddedModal from '@/app/components/app/overview/embedded' import { useStore as useAppStore } from '@/app/components/app/store' import { trackEvent } from '@/app/components/base/amplitude' -import { Button } from '@/app/components/base/ui/button' -import { Popover, PopoverContent, PopoverTrigger } from '@/app/components/base/ui/popover' import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager' import { webSocketClient } from '@/app/components/workflow/collaboration/core/websocket-manager' import { WorkflowContext } from '@/app/components/workflow/context' @@ -31,7 +32,6 @@ import { useInvalidateAppWorkflow } from '@/service/use-workflow' import { fetchPublishedWorkflow } from '@/service/workflow' import { AppModeEnum } from '@/types/app' import { basePath } from '@/utils/var' -import { toast } from '../../base/ui/toast' import { getKeyboardKeyCodeBySystem } from '../../workflow/utils' import AccessControl from '../app-access-control' import { diff --git a/web/app/components/app/app-publisher/publish-with-multiple-model.tsx b/web/app/components/app/app-publisher/publish-with-multiple-model.tsx index fbff371577..038b9328bb 100644 --- a/web/app/components/app/app-publisher/publish-with-multiple-model.tsx +++ b/web/app/components/app/app-publisher/publish-with-multiple-model.tsx @@ -1,16 +1,16 @@ import type { FC } from 'react' import type { ModelAndParameter } from '../configuration/debug/types' import type { Model, ModelItem } from '@/app/components/header/account-setting/model-provider-page/declarations' -import { RiArrowDownSLine } from '@remixicon/react' -import { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' +} from '@langgenius/dify-ui/dropdown-menu' +import { RiArrowDownSLine } from '@remixicon/react' +import { useState } from 'react' +import { useTranslation } from 'react-i18next' import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks' import { useProviderContext } from '@/context/provider-context' import ModelIcon from '../../header/account-setting/model-provider-page/model-icon' diff --git a/web/app/components/app/app-publisher/sections.tsx b/web/app/components/app/app-publisher/sections.tsx index d4864a3763..57522095ae 100644 --- a/web/app/components/app/app-publisher/sections.tsx +++ b/web/app/components/app/app-publisher/sections.tsx @@ -2,16 +2,16 @@ import type { CSSProperties, ReactNode } from 'react' import type { ModelAndParameter } from '../configuration/debug/types' import type { AppPublisherProps } from './index' import type { PublishWorkflowParams } from '@/types/workflow' -import { useTranslation } from 'react-i18next' -import Divider from '@/app/components/base/divider' -import { CodeBrowser } from '@/app/components/base/icons/src/vender/line/development' -import Loading from '@/app/components/base/loading' -import { Button } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { Tooltip, TooltipContent, TooltipTrigger, -} from '@/app/components/base/ui/tooltip' +} from '@langgenius/dify-ui/tooltip' +import { useTranslation } from 'react-i18next' +import Divider from '@/app/components/base/divider' +import { CodeBrowser } from '@/app/components/base/icons/src/vender/line/development' +import Loading from '@/app/components/base/loading' import UpgradeBtn from '@/app/components/billing/upgrade-btn' import WorkflowToolConfigureButton from '@/app/components/tools/workflow-tool/configure-button' import { appDefaultIconBackground } from '@/config' 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 d5f4c9c189..3fe4c61fb7 100644 --- a/web/app/components/app/app-publisher/version-info-modal.tsx +++ b/web/app/components/app/app-publisher/version-info-modal.tsx @@ -1,12 +1,12 @@ import type { FC } from 'react' import type { VersionHistory } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiCloseLine } from '@remixicon/react' import * as React from 'react' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Input from '../../base/input' import Textarea from '../../base/textarea' diff --git a/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx b/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx index 029743dfb6..51b365f446 100644 --- a/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx +++ b/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx @@ -1,8 +1,8 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import WarningMask from '.' type IFormattingChangedProps = { diff --git a/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx b/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx index 4b25b023b2..07467a5ab1 100644 --- a/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx +++ b/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx @@ -1,8 +1,8 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import WarningMask from '.' type IFormattingChangedProps = { diff --git a/web/app/components/app/configuration/config-prompt/__tests__/advanced-prompt-input.spec.tsx b/web/app/components/app/configuration/config-prompt/__tests__/advanced-prompt-input.spec.tsx index f7cfff94fb..ced1ddcfe3 100644 --- a/web/app/components/app/configuration/config-prompt/__tests__/advanced-prompt-input.spec.tsx +++ b/web/app/components/app/configuration/config-prompt/__tests__/advanced-prompt-input.spec.tsx @@ -59,7 +59,7 @@ vi.mock('@/context/modal-context', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => mockToastError(...args), }, diff --git a/web/app/components/app/configuration/config-prompt/__tests__/simple-prompt-input.spec.tsx b/web/app/components/app/configuration/config-prompt/__tests__/simple-prompt-input.spec.tsx index 0f8b9b032f..b4e6e0be2f 100644 --- a/web/app/components/app/configuration/config-prompt/__tests__/simple-prompt-input.spec.tsx +++ b/web/app/components/app/configuration/config-prompt/__tests__/simple-prompt-input.spec.tsx @@ -57,7 +57,7 @@ vi.mock('@/context/modal-context', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => mockToastError(...args), }, diff --git a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx index 1de6e6ce0c..5fd394ad45 100644 --- a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx @@ -2,7 +2,14 @@ import type { FC } from 'react' import type { ExternalDataTool } from '@/models/common' import type { PromptRole, PromptVariable } from '@/models/debug' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@langgenius/dify-ui/tooltip' import { RiDeleteBinLine, RiErrorWarningFill, @@ -20,13 +27,6 @@ import { } from '@/app/components/base/icons/src/vender/line/files' import PromptEditor from '@/app/components/base/prompt-editor' import { INSERT_VARIABLE_VALUE_BLOCK_COMMAND } from '@/app/components/base/prompt-editor/plugins/variable-block' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from '@/app/components/base/ui/tooltip' import ConfigContext from '@/context/debug-configuration' import { useEventEmitterContextContext } from '@/context/event-emitter' import { useModalContext } from '@/context/modal-context' diff --git a/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx b/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx index 03755df018..8846530af2 100644 --- a/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx +++ b/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx @@ -1,9 +1,9 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useRef } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import VarHighlight from '../../base/var-highlight' type IConfirmAddVarProps = { 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 477e1db4a0..7906a5f8da 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 @@ -1,11 +1,11 @@ 'use client' import type { FC } from 'react' import type { ConversationHistoriesRole } from '@/models/debug' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' type Props = { isShow: boolean diff --git a/web/app/components/app/configuration/config-prompt/index.tsx b/web/app/components/app/configuration/config-prompt/index.tsx index 8a77d4bb58..20463da174 100644 --- a/web/app/components/app/configuration/config-prompt/index.tsx +++ b/web/app/components/app/configuration/config-prompt/index.tsx @@ -2,6 +2,7 @@ import type { FC } from 'react' import type { PromptItem, PromptVariable } from '@/models/debug' import type { AppModeEnum } from '@/types/app' +import { Button } from '@langgenius/dify-ui/button' import { RiAddLine, } from '@remixicon/react' @@ -10,7 +11,6 @@ import * as React from 'react' import { useTranslation } from 'react-i18next' import { useContext } from 'use-context-selector' import AdvancedMessageInput from '@/app/components/app/configuration/config-prompt/advanced-prompt-input' -import { Button } from '@/app/components/base/ui/button' import { MAX_PROMPT_MESSAGE_LENGTH } from '@/config' import ConfigContext from '@/context/debug-configuration' import { PromptRole } from '@/models/debug' diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx index 6b5c3acccb..2935504f15 100644 --- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx @@ -4,6 +4,12 @@ import type { ExternalDataTool } from '@/models/common' import type { PromptVariable } from '@/models/debug' import type { GenRes } from '@/service/debug' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@langgenius/dify-ui/tooltip' import { useBoolean } from 'ahooks' import { noop } from 'es-toolkit/function' import { produce } from 'immer' @@ -18,12 +24,6 @@ import { useFeaturesStore } from '@/app/components/base/features/hooks' import PromptEditor from '@/app/components/base/prompt-editor' import { PROMPT_EDITOR_UPDATE_VALUE_BY_EVENT_EMITTER } from '@/app/components/base/prompt-editor/plugins/update-block' import { INSERT_VARIABLE_VALUE_BLOCK_COMMAND } from '@/app/components/base/prompt-editor/plugins/variable-block' -import { toast } from '@/app/components/base/ui/toast' -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from '@/app/components/base/ui/tooltip' import ConfigContext from '@/context/debug-configuration' import { useEventEmitterContextContext } from '@/context/event-emitter' import { useModalContext } from '@/context/modal-context' diff --git a/web/app/components/app/configuration/config-var/__tests__/index.spec.tsx b/web/app/components/app/configuration/config-var/__tests__/index.spec.tsx index 4486489a20..51683ad948 100644 --- a/web/app/components/app/configuration/config-var/__tests__/index.spec.tsx +++ b/web/app/components/app/configuration/config-var/__tests__/index.spec.tsx @@ -2,10 +2,10 @@ import type { ReactNode } from 'react' import type { IConfigVarProps } from '../index' import type { ExternalDataTool } from '@/models/common' import type { PromptVariable } from '@/models/debug' +import { toast } from '@langgenius/dify-ui/toast' import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react' import * as React from 'react' import { vi } from 'vitest' -import { toast } from '@/app/components/base/ui/toast' import DebugConfigurationContext from '@/context/debug-configuration' import { AppModeEnum } from '@/types/app' diff --git a/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx b/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx index 8cc8775bf5..5f0f4129d6 100644 --- a/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx @@ -44,8 +44,8 @@ vi.mock('@/app/components/base/select', () => ({ ), })) -vi.mock('@/app/components/base/ui/select', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/select', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, diff --git a/web/app/components/app/configuration/config-var/config-modal/__tests__/index-logic.spec.tsx b/web/app/components/app/configuration/config-var/config-modal/__tests__/index-logic.spec.tsx index 4888d284d2..77f2b54533 100644 --- a/web/app/components/app/configuration/config-var/config-modal/__tests__/index-logic.spec.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/__tests__/index-logic.spec.tsx @@ -1,10 +1,10 @@ /* eslint-disable ts/no-explicit-any */ import type { InputVar } from '@/app/components/workflow/types' import type { App, AppSSO } from '@/types/app' +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen, waitFor } from '@testing-library/react' import * as React from 'react' import { useStore } from '@/app/components/app/store' -import { toast } from '@/app/components/base/ui/toast' import { InputVarType } from '@/app/components/workflow/types' import DebugConfigurationContext from '@/context/debug-configuration' import { AppModeEnum } from '@/types/app' 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 d15d6527c5..094a293943 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 @@ -1,9 +1,9 @@ import type { InputVar } from '@/app/components/workflow/types' import type { App, AppSSO } from '@/types/app' +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen } from '@testing-library/react' import * as React from 'react' import { useStore } from '@/app/components/app/store' -import { toast } from '@/app/components/base/ui/toast' import { InputVarType } from '@/app/components/workflow/types' import { AppModeEnum } from '@/types/app' import ConfigModal from '../index' diff --git a/web/app/components/app/configuration/config-var/config-modal/form-fields.tsx b/web/app/components/app/configuration/config-var/config-modal/form-fields.tsx index 279a9279cf..748108e19a 100644 --- a/web/app/components/app/configuration/config-var/config-modal/form-fields.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/form-fields.tsx @@ -3,11 +3,6 @@ import type { ChangeEvent, FC } from 'react' import type { Item as SelectOptionItem } from './type-select' import type { FileEntity } from '@/app/components/base/file-uploader/types' import type { InputVar, UploadFileSetting } from '@/app/components/workflow/types' -import * as React from 'react' -import Checkbox from '@/app/components/base/checkbox' -import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader' -import Input from '@/app/components/base/input' -import Textarea from '@/app/components/base/textarea' import { Select, SelectContent, @@ -16,7 +11,12 @@ import { SelectItemText, SelectTrigger, SelectValue, -} from '@/app/components/base/ui/select' +} from '@langgenius/dify-ui/select' +import * as React from 'react' +import Checkbox from '@/app/components/base/checkbox' +import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader' +import Input from '@/app/components/base/input' +import Textarea from '@/app/components/base/textarea' import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' import FileUploadSetting from '@/app/components/workflow/nodes/_base/components/file-upload-setting' import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' 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 18484683fa..824b8a8d82 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 @@ -2,13 +2,13 @@ import type { ChangeEvent, FC } from 'react' import type { Item as SelectItem } from './type-select' import type { InputVar, InputVarType, MoreInfo } from '@/app/components/workflow/types' +import { toast } from '@langgenius/dify-ui/toast' import * as React from 'react' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { useContext } from 'use-context-selector' import { useStore as useAppStore } from '@/app/components/app/store' import Modal from '@/app/components/base/modal' -import { toast } from '@/app/components/base/ui/toast' import ConfigContext from '@/context/debug-configuration' import { AppModeEnum } from '@/types/app' import { checkKeys, getNewVarInWorkflow, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var' diff --git a/web/app/components/app/configuration/config-var/index.tsx b/web/app/components/app/configuration/config-var/index.tsx index aca2817249..34c6bf5786 100644 --- a/web/app/components/app/configuration/config-var/index.tsx +++ b/web/app/components/app/configuration/config-var/index.tsx @@ -4,15 +4,6 @@ import type { InputVar } from '@/app/components/workflow/types' import type { ExternalDataTool } from '@/models/common' import type { PromptVariable } from '@/models/debug' import type { I18nKeysByPrefix } from '@/types/i18n' -import { cn } from '@langgenius/dify-ui/cn' -import { useBoolean } from 'ahooks' -import { produce } from 'immer' -import * as React from 'react' -import { useCallback, useMemo, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { ReactSortable } from 'react-sortablejs' -import { useContext } from 'use-context-selector' -import Tooltip from '@/app/components/base/tooltip' import { AlertDialog, AlertDialogActions, @@ -21,8 +12,17 @@ import { AlertDialogContent, AlertDialogDescription, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { toast } from '@/app/components/base/ui/toast' +} from '@langgenius/dify-ui/alert-dialog' +import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' +import { useBoolean } from 'ahooks' +import { produce } from 'immer' +import * as React from 'react' +import { useCallback, useMemo, useState } from 'react' +import { useTranslation } from 'react-i18next' +import { ReactSortable } from 'react-sortablejs' +import { useContext } from 'use-context-selector' +import Tooltip from '@/app/components/base/tooltip' import { InputVarType } from '@/app/components/workflow/types' import ConfigContext from '@/context/debug-configuration' import { useEventEmitterContextContext } from '@/context/event-emitter' diff --git a/web/app/components/app/configuration/config-var/modal-foot.tsx b/web/app/components/app/configuration/config-var/modal-foot.tsx index 3168d2a273..d8a869610f 100644 --- a/web/app/components/app/configuration/config-var/modal-foot.tsx +++ b/web/app/components/app/configuration/config-var/modal-foot.tsx @@ -1,8 +1,8 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' type IModalFootProps = { onConfirm: () => void diff --git a/web/app/components/app/configuration/config-vision/index.tsx b/web/app/components/app/configuration/config-vision/index.tsx index e1fd88eb3f..b9cb54cc34 100644 --- a/web/app/components/app/configuration/config-vision/index.tsx +++ b/web/app/components/app/configuration/config-vision/index.tsx @@ -1,6 +1,7 @@ 'use client' import type { FC } from 'react' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { noop } from 'es-toolkit/function' import { produce } from 'immer' import * as React from 'react' @@ -10,7 +11,6 @@ import { useContext } from 'use-context-selector' // import { Resolution } from '@/types/app' import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' import { Vision } from '@/app/components/base/icons/src/vender/features' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import OptionCard from '@/app/components/workflow/nodes/_base/components/option-card' import { SupportUploadFileTypes } from '@/app/components/workflow/types' diff --git a/web/app/components/app/configuration/config-vision/param-config.tsx b/web/app/components/app/configuration/config-vision/param-config.tsx index 3be4c60aa9..51092f8ae7 100644 --- a/web/app/components/app/configuration/config-vision/param-config.tsx +++ b/web/app/components/app/configuration/config-vision/param-config.tsx @@ -1,11 +1,11 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover' import { RiSettings2Line } from '@remixicon/react' import { memo, useState } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' -import { Popover, PopoverContent, PopoverTrigger } from '@/app/components/base/ui/popover' import ParamConfigContent from './param-config-content' const ParamsConfig: FC = () => { diff --git a/web/app/components/app/configuration/config/agent-setting-button.tsx b/web/app/components/app/configuration/config/agent-setting-button.tsx index 0f1021e7ce..9831660571 100644 --- a/web/app/components/app/configuration/config/agent-setting-button.tsx +++ b/web/app/components/app/configuration/config/agent-setting-button.tsx @@ -1,11 +1,11 @@ 'use client' import type { FC } from 'react' import type { AgentConfig } from '@/models/debug' +import { Button } from '@langgenius/dify-ui/button' import { RiSettings2Line } from '@remixicon/react' import * as React from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import AgentSetting from './agent/agent-setting' type Props = { diff --git a/web/app/components/app/configuration/config/agent/agent-setting/__tests__/index.spec.tsx b/web/app/components/app/configuration/config/agent/agent-setting/__tests__/index.spec.tsx index cdab20df16..08a6e0f62b 100644 --- a/web/app/components/app/configuration/config/agent/agent-setting/__tests__/index.spec.tsx +++ b/web/app/components/app/configuration/config/agent/agent-setting/__tests__/index.spec.tsx @@ -12,7 +12,7 @@ vi.mock('ahooks', async (importOriginal) => { } }) -vi.mock('@/app/components/base/ui/slider', () => ({ +vi.mock('@langgenius/dify-ui/slider', () => ({ Slider: (props: { className?: string, min?: number, max?: number, value: number, onValueChange: (value: number) => void }) => ( ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => mockToastError(...args), }, diff --git a/web/app/components/app/configuration/config/automatic/__tests__/result.spec.tsx b/web/app/components/app/configuration/config/automatic/__tests__/result.spec.tsx index 30f41b7828..54efa4a92c 100644 --- a/web/app/components/app/configuration/config/automatic/__tests__/result.spec.tsx +++ b/web/app/components/app/configuration/config/automatic/__tests__/result.spec.tsx @@ -1,5 +1,5 @@ +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen } from '@testing-library/react' -import { toast } from '@/app/components/base/ui/toast' import Result from '../result' import { GeneratorType } from '../types' @@ -19,7 +19,7 @@ vi.mock('copy-to-clipboard', () => ({ default: (...args: unknown[]) => mockCopy(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), }, diff --git a/web/app/components/app/configuration/config/automatic/automatic-btn.tsx b/web/app/components/app/configuration/config/automatic/automatic-btn.tsx index af14fb037d..f9e9fa362a 100644 --- a/web/app/components/app/configuration/config/automatic/automatic-btn.tsx +++ b/web/app/components/app/configuration/config/automatic/automatic-btn.tsx @@ -1,11 +1,11 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { RiSparklingFill, } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' type IAutomaticBtnProps = { onClick: () => void 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 d9200af773..aff540cecf 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 @@ -4,6 +4,17 @@ import type { FormValue } from '@/app/components/header/account-setting/model-pr // type import type { GenRes } from '@/service/debug' import type { AppModeEnum, CompletionParams, Model, ModelModeType } from '@/types/app' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogDescription, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiDatabase2Line, RiFileExcel2Line, @@ -22,17 +33,6 @@ import { useTranslation } from 'react-i18next' import { Generator } from '@/app/components/base/icons/src/vender/other' import Loading from '@/app/components/base/loading' import Modal from '@/app/components/base/modal' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogDescription, - AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks' diff --git a/web/app/components/app/configuration/config/automatic/result.tsx b/web/app/components/app/configuration/config/automatic/result.tsx index 4beefe8386..057fd48aeb 100644 --- a/web/app/components/app/configuration/config/automatic/result.tsx +++ b/web/app/components/app/configuration/config/automatic/result.tsx @@ -1,12 +1,12 @@ 'use client' import type { FC } from 'react' import type { GenRes } from '@/service/debug' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiClipboardLine } from '@remixicon/react' import copy from 'copy-to-clipboard' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import CodeEditor from '@/app/components/workflow/nodes/llm/components/json-schema-config-modal/code-editor' import PromptRes from './prompt-res' import PromptResInWorkflow from './prompt-res-in-workflow' diff --git a/web/app/components/app/configuration/config/code-generator/__tests__/get-code-generator-res.spec.tsx b/web/app/components/app/configuration/config/code-generator/__tests__/get-code-generator-res.spec.tsx index 25039bae96..fa7e9b6bd0 100644 --- a/web/app/components/app/configuration/config/code-generator/__tests__/get-code-generator-res.spec.tsx +++ b/web/app/components/app/configuration/config/code-generator/__tests__/get-code-generator-res.spec.tsx @@ -21,7 +21,7 @@ vi.mock('react-i18next', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => mockToastError(...args), }, 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 eb1ee7e10c..c69c0f5dae 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 @@ -3,6 +3,17 @@ import type { FormValue } from '@/app/components/header/account-setting/model-pr import type { CodeLanguage } from '@/app/components/workflow/nodes/code/types' import type { GenRes } from '@/service/debug' import type { AppModeEnum, CompletionParams, Model, ModelModeType } from '@/types/app' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogDescription, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useBoolean, useSessionStorageState, @@ -13,17 +24,6 @@ import { useTranslation } from 'react-i18next' import { Generator } from '@/app/components/base/icons/src/vender/other' import Loading from '@/app/components/base/loading' import Modal from '@/app/components/base/modal' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogDescription, - AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks' import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' diff --git a/web/app/components/app/configuration/config/config-audio.tsx b/web/app/components/app/configuration/config/config-audio.tsx index 15a52610e6..25b6d64eec 100644 --- a/web/app/components/app/configuration/config/config-audio.tsx +++ b/web/app/components/app/configuration/config/config-audio.tsx @@ -1,14 +1,14 @@ 'use client' import type { FC } from 'react' +import { Switch } from '@langgenius/dify-ui/switch' import { produce } from 'immer' import * as React from 'react' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' +import { useContext } from 'use-context-selector' import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' import { Microphone01 } from '@/app/components/base/icons/src/vender/features' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import { SupportUploadFileTypes } from '@/app/components/workflow/types' import ConfigContext from '@/context/debug-configuration' diff --git a/web/app/components/app/configuration/config/config-document.tsx b/web/app/components/app/configuration/config/config-document.tsx index 859fd39426..156c605267 100644 --- a/web/app/components/app/configuration/config/config-document.tsx +++ b/web/app/components/app/configuration/config/config-document.tsx @@ -1,14 +1,14 @@ 'use client' import type { FC } from 'react' +import { Switch } from '@langgenius/dify-ui/switch' import { produce } from 'immer' import * as React from 'react' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' +import { useContext } from 'use-context-selector' import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' import { Document } from '@/app/components/base/icons/src/vender/features' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import { SupportUploadFileTypes } from '@/app/components/workflow/types' import ConfigContext from '@/context/debug-configuration' diff --git a/web/app/components/app/configuration/configuration-view.tsx b/web/app/components/app/configuration/configuration-view.tsx index 35ab462ad1..3a9882db18 100644 --- a/web/app/components/app/configuration/configuration-view.tsx +++ b/web/app/components/app/configuration/configuration-view.tsx @@ -2,6 +2,16 @@ import type { FC } from 'react' import type { ConfigurationViewModel } from './hooks/use-configuration' import { CodeBracketIcon } from '@heroicons/react/20/solid' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogDescription, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' import AppPublisher from '@/app/components/app/app-publisher/features-wrapper' @@ -15,16 +25,6 @@ import Drawer from '@/app/components/base/drawer' import { FeaturesProvider } from '@/app/components/base/features' import NewFeaturePanel from '@/app/components/base/features/new-feature-panel' import Loading from '@/app/components/base/loading' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogDescription, - AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { Button } from '@/app/components/base/ui/button' import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' import PluginDependency from '@/app/components/workflow/plugin-dependency' import ConfigContext from '@/context/debug-configuration' diff --git a/web/app/components/app/configuration/ctrl-btn-group/index.tsx b/web/app/components/app/configuration/ctrl-btn-group/index.tsx index fa8a8bdab3..6ac485c097 100644 --- a/web/app/components/app/configuration/ctrl-btn-group/index.tsx +++ b/web/app/components/app/configuration/ctrl-btn-group/index.tsx @@ -1,8 +1,8 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import s from './style.module.css' type IContrlBtnGroupProps = { diff --git a/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx b/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx index a17b39e4b4..80b9239524 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx @@ -3,9 +3,9 @@ import type { IndexingType } from '@/app/components/datasets/create/step-two' import type { DataSet } from '@/models/datasets' import type { DatasetConfigs } from '@/models/debug' import type { RetrievalConfig } from '@/types/app' +import { toast } from '@langgenius/dify-ui/toast' import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { toast } from '@/app/components/base/ui/toast' import { useCurrentProviderAndModel, useModelListAndDefaultModelAndCurrentProviderAndModel, diff --git a/web/app/components/app/configuration/dataset-config/params-config/__tests__/index.spec.tsx b/web/app/components/app/configuration/dataset-config/params-config/__tests__/index.spec.tsx index a892de7fee..b5924a5f23 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/__tests__/index.spec.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/__tests__/index.spec.tsx @@ -1,9 +1,9 @@ import type { MockedFunction, MockInstance } from 'vitest' import type { DatasetConfigs } from '@/models/debug' +import { toast } from '@langgenius/dify-ui/toast' import { render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import * as React from 'react' -import { toast } from '@/app/components/base/ui/toast' import { useCurrentProviderAndModel, useModelListAndDefaultModelAndCurrentProviderAndModel, diff --git a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx index bb260fb499..d0e6b2fe9f 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx @@ -10,14 +10,14 @@ import type { DatasetConfigs, } from '@/models/debug' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' +import { toast } from '@langgenius/dify-ui/toast' import { memo, useCallback, useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' import Divider from '@/app/components/base/divider' import ScoreThresholdItem from '@/app/components/base/param-item/score-threshold-item' import TopKItem from '@/app/components/base/param-item/top-k-item' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' -import { toast } from '@/app/components/base/ui/toast' import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useCurrentProviderAndModel, useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks' import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' 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 ce78ad6e99..d4578af1d7 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 @@ -1,14 +1,14 @@ 'use client' import type { DataSet } from '@/models/datasets' import type { DatasetConfigs } from '@/models/debug' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiEqualizer2Line } from '@remixicon/react' import { memo, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { useContext } from 'use-context-selector' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useCurrentProviderAndModel, useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks' import { diff --git a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx index e5080f26e4..5c2cca05d3 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx @@ -1,7 +1,7 @@ +import { Slider } from '@langgenius/dify-ui/slider' import { noop } from 'es-toolkit/function' import { memo } from 'react' import { useTranslation } from 'react-i18next' -import { Slider } from '@/app/components/base/ui/slider' const weightedScoreSliderSlotClassNames = { track: 'bg-util-colors-teal-teal-500', 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 ff371fc2df..13d11574d5 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 @@ -1,6 +1,7 @@ 'use client' import type { FC } from 'react' import type { DataSet } from '@/models/datasets' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { useInfiniteScroll } from 'ahooks' import * as React from 'react' @@ -10,7 +11,6 @@ import AppIcon from '@/app/components/base/app-icon' import Badge from '@/app/components/base/badge' import Loading from '@/app/components/base/loading' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import FeatureIcon from '@/app/components/header/account-setting/model-provider-page/model-selector/feature-icon' import { useKnowledge } from '@/hooks/use-knowledge' diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/index.spec.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/index.spec.tsx index d699a4baec..cf1df79d1e 100644 --- a/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/index.spec.tsx +++ b/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/index.spec.tsx @@ -19,7 +19,7 @@ const toastMocks = vi.hoisted(() => ({ promise: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(toastMocks.call, { success: vi.fn((message: string, options?: Record) => toastMocks.call({ type: 'success', message, ...options })), error: vi.fn((message: string, options?: Record) => toastMocks.call({ type: 'error', message, ...options })), diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx index 872d081307..74e4ca5fe5 100644 --- a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx +++ b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx @@ -2,15 +2,15 @@ import type { FC } from 'react' import type { Member } from '@/models/common' import type { DataSet } from '@/models/datasets' import type { RetrievalConfig } from '@/types/app' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiCloseLine } from '@remixicon/react' import { isEqual } from 'es-toolkit/predicate' import { useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' import Textarea from '@/app/components/base/textarea' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { isReRankModelSelected } from '@/app/components/datasets/common/check-rerank-model' import { IndexingType } from '@/app/components/datasets/create/step-two' import IndexMethod from '@/app/components/datasets/settings/index-method' diff --git a/web/app/components/app/configuration/debug/__tests__/index.spec.tsx b/web/app/components/app/configuration/debug/__tests__/index.spec.tsx index 4a50ecc626..c17a74e24c 100644 --- a/web/app/components/app/configuration/debug/__tests__/index.spec.tsx +++ b/web/app/components/app/configuration/debug/__tests__/index.spec.tsx @@ -46,7 +46,7 @@ const mockState = vi.hoisted(() => ({ }, })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(mockState.mockToastCall, { success: vi.fn((message: string, options?: Record) => mockState.mockToastCall({ type: 'success', message, ...options })), diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/chat-item.spec.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/chat-item.spec.tsx index 61eb8f2ae8..719479498a 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/chat-item.spec.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/chat-item.spec.tsx @@ -90,7 +90,7 @@ vi.mock('@/app/components/base/chat/chat', () => ({ }, })) -vi.mock('@/app/components/base/ui/avatar', () => ({ +vi.mock('@langgenius/dify-ui/avatar', () => ({ Avatar: ({ name }: { name: string }) =>
{name}
, })) diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx index 56345890ff..d5b353c899 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx @@ -2,6 +2,7 @@ import type { FC } from 'react' import type { ModelAndParameter } from '../types' import type { InputForm } from '@/app/components/base/chat/chat/type' import type { ChatConfig, OnSend } from '@/app/components/base/chat/types' +import { Avatar } from '@langgenius/dify-ui/avatar' import { memo, useCallback, @@ -11,7 +12,6 @@ import Chat from '@/app/components/base/chat/chat' import { useChat } from '@/app/components/base/chat/chat/hooks' import { getLastAnswer } from '@/app/components/base/chat/utils' import { useFeatures } from '@/app/components/base/features/hooks' -import { Avatar } from '@/app/components/base/ui/avatar' import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useAppContext } from '@/context/app-context' import { useDebugConfigurationContext } from '@/context/debug-configuration' diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx index 2e535baeac..e76bbb0728 100644 --- a/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx +++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx @@ -1,15 +1,15 @@ import type { CSSProperties, FC } from 'react' import type { ModelAndParameter } from '../types' -import { memo, useState } from 'react' -import { useTranslation } from 'react-i18next' -import ActionButton from '@/app/components/base/action-button' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' +} from '@langgenius/dify-ui/dropdown-menu' +import { memo, useState } from 'react' +import { useTranslation } from 'react-i18next' +import ActionButton from '@/app/components/base/action-button' import { ModelStatusEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useDebugConfigurationContext } from '@/context/debug-configuration' import { useProviderContext } from '@/context/provider-context' diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx index a9f9f1116b..aef3d5ef9c 100644 --- a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx +++ b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx @@ -1,13 +1,13 @@ import type { InputForm } from '@/app/components/base/chat/chat/type' import type { ChatConfig, ChatItem, OnSend } from '@/app/components/base/chat/types' import type { FileEntity } from '@/app/components/base/file-uploader/types' +import { Avatar } from '@langgenius/dify-ui/avatar' import { memo, useCallback, useImperativeHandle, useMemo } from 'react' import { useStore as useAppStore } from '@/app/components/app/store' import Chat from '@/app/components/base/chat/chat' import { useChat } from '@/app/components/base/chat/chat/hooks' import { getLastAnswer, isValidGeneratedAnswer } from '@/app/components/base/chat/utils' import { useFeatures } from '@/app/components/base/features/hooks' -import { Avatar } from '@/app/components/base/ui/avatar' import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useAppContext } from '@/context/app-context' import { useDebugConfigurationContext } from '@/context/debug-configuration' diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx index 88bca7111c..87beccae24 100644 --- a/web/app/components/app/configuration/debug/index.tsx +++ b/web/app/components/app/configuration/debug/index.tsx @@ -5,6 +5,13 @@ import type { ModelAndParameter } from './types' import type { ModelParameterModalProps } from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' import type { Inputs } from '@/models/debug' import type { ModelConfig as BackendModelConfig, VisionFile, VisionSettings } from '@/types/app' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@langgenius/dify-ui/tooltip' import { RiAddLine, RiEqualizer2Line, @@ -28,13 +35,6 @@ import AgentLogModal from '@/app/components/base/agent-log-modal' import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' import { RefreshCcw01 } from '@/app/components/base/icons/src/vender/line/arrows' import PromptLogModal from '@/app/components/base/prompt-log-modal' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from '@/app/components/base/ui/tooltip' import { ModelFeatureEnum, ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks' import { DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config' diff --git a/web/app/components/app/configuration/hooks/__tests__/use-configuration-utils.spec.ts b/web/app/components/app/configuration/hooks/__tests__/use-configuration-utils.spec.ts index c0353c233d..4c72e4690c 100644 --- a/web/app/components/app/configuration/hooks/__tests__/use-configuration-utils.spec.ts +++ b/web/app/components/app/configuration/hooks/__tests__/use-configuration-utils.spec.ts @@ -52,7 +52,7 @@ vi.mock('@/app/components/workflow/nodes/knowledge-retrieval/utils', async () => } }) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => mockToastError(...args), success: (...args: unknown[]) => mockToastSuccess(...args), diff --git a/web/app/components/app/configuration/hooks/use-configuration-utils.ts b/web/app/components/app/configuration/hooks/use-configuration-utils.ts index 6911fdcd01..8a7b1c811e 100644 --- a/web/app/components/app/configuration/hooks/use-configuration-utils.ts +++ b/web/app/components/app/configuration/hooks/use-configuration-utils.ts @@ -4,9 +4,9 @@ import type { Collection } from '@/app/components/tools/types' import type { DataSet } from '@/models/datasets' import type { AnnotationReplyConfig, DatasetConfigs, ModelConfig, PromptVariable } from '@/models/debug' import type { ModelConfig as BackendModelConfig, UserInputFormItem, VisionSettings } from '@/types/app' +import { toast } from '@langgenius/dify-ui/toast' import { clone } from 'es-toolkit/object' import { produce } from 'immer' -import { toast } from '@/app/components/base/ui/toast' import { getMultipleRetrievalConfig, getSelectedDatasetsMode } from '@/app/components/workflow/nodes/knowledge-retrieval/utils' import { DEFAULT_AGENT_SETTING, DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config' import { PromptMode } from '@/models/debug' diff --git a/web/app/components/app/configuration/prompt-value-panel/index.tsx b/web/app/components/app/configuration/prompt-value-panel/index.tsx index a9df145ca1..94bc48da29 100644 --- a/web/app/components/app/configuration/prompt-value-panel/index.tsx +++ b/web/app/components/app/configuration/prompt-value-panel/index.tsx @@ -2,6 +2,7 @@ import type { FC } from 'react' import type { Inputs } from '@/models/debug' import type { VisionFile, VisionSettings } from '@/types/app' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowDownSLine, @@ -19,7 +20,6 @@ import Input from '@/app/components/base/input' import Select from '@/app/components/base/select' import Textarea from '@/app/components/base/textarea' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' import BoolInput from '@/app/components/workflow/nodes/_base/components/before-run-form/bool-input' import ConfigContext from '@/context/debug-configuration' import { AppModeEnum, ModelModeType } from '@/types/app' diff --git a/web/app/components/app/configuration/tools/__tests__/external-data-tool-modal.spec.tsx b/web/app/components/app/configuration/tools/__tests__/external-data-tool-modal.spec.tsx index ceca00a9ae..2a725d88ca 100644 --- a/web/app/components/app/configuration/tools/__tests__/external-data-tool-modal.spec.tsx +++ b/web/app/components/app/configuration/tools/__tests__/external-data-tool-modal.spec.tsx @@ -11,7 +11,7 @@ vi.mock('react-i18next', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => mockToastError(...args), }, 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 68a1ee875d..b09b7b1c70 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 @@ -2,6 +2,10 @@ 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 { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, SelectValue } from '@langgenius/dify-ui/select' +import { toast } from '@langgenius/dify-ui/toast' import { noop } from 'es-toolkit/function' import { useState } from 'react' import { useTranslation } from 'react-i18next' @@ -9,10 +13,6 @@ import AppIcon from '@/app/components/base/app-icon' import EmojiPicker from '@/app/components/base/emoji-picker' import FormGeneration from '@/app/components/base/features/new-feature-panel/moderation/form-generation' import { BookOpen01 } from '@/app/components/base/icons/src/vender/line/education' -import { Button } from '@/app/components/base/ui/button' -import { Dialog, DialogContent } from '@/app/components/base/ui/dialog' -import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, SelectValue } from '@/app/components/base/ui/select' -import { toast } from '@/app/components/base/ui/toast' import ApiBasedExtensionSelector from '@/app/components/header/account-setting/api-based-extension-page/selector' import { useDocLink, useLocale } from '@/context/i18n' import { useCodeBasedExtensions } from '@/service/use-common' diff --git a/web/app/components/app/create-app-dialog/app-card/index.tsx b/web/app/components/app/create-app-dialog/app-card/index.tsx index fef7199ca2..65bd74344a 100644 --- a/web/app/components/app/create-app-dialog/app-card/index.tsx +++ b/web/app/components/app/create-app-dialog/app-card/index.tsx @@ -1,6 +1,7 @@ 'use client' import type { App } from '@/models/explore' import { PlusIcon } from '@heroicons/react/20/solid' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiInformation2Line } from '@remixicon/react' import { useCallback } from 'react' @@ -8,7 +9,6 @@ import { useTranslation } from 'react-i18next' import { useContextSelector } from 'use-context-selector' import { trackEvent } from '@/app/components/base/amplitude' import AppIcon from '@/app/components/base/app-icon' -import { Button } from '@/app/components/base/ui/button' import AppListContext from '@/context/app-list-context' import { useGlobalPublicStore } from '@/context/global-public-context' import { AppTypeIcon, AppTypeLabel } from '../../type-selector' diff --git a/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx b/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx index 34024da54c..0c6462c2f9 100644 --- a/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx +++ b/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx @@ -86,7 +86,7 @@ vi.mock('@/app/components/explore/create-app-modal', () => ({ ) : null, })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: (...args: unknown[]) => mockToastSuccess(...args), error: (...args: unknown[]) => mockToastError(...args), diff --git a/web/app/components/app/create-app-dialog/app-list/index.tsx b/web/app/components/app/create-app-dialog/app-list/index.tsx index 19089d6364..1924de3893 100644 --- a/web/app/components/app/create-app-dialog/app-list/index.tsx +++ b/web/app/components/app/create-app-dialog/app-list/index.tsx @@ -3,6 +3,7 @@ import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal' import type { App } from '@/models/explore' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiRobot2Line } from '@remixicon/react' import { useDebounceFn } from 'ahooks' import * as React from 'react' @@ -12,7 +13,6 @@ import AppTypeSelector from '@/app/components/app/type-selector' import Divider from '@/app/components/base/divider' import Input from '@/app/components/base/input' import Loading from '@/app/components/base/loading' -import { toast } from '@/app/components/base/ui/toast' import CreateAppModal from '@/app/components/explore/create-app-modal' import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks' import { NEED_REFRESH_APP_LIST_KEY } from '@/config' diff --git a/web/app/components/app/create-app-modal/__tests__/index.spec.tsx b/web/app/components/app/create-app-modal/__tests__/index.spec.tsx index 305b90981b..24fb21747f 100644 --- a/web/app/components/app/create-app-modal/__tests__/index.spec.tsx +++ b/web/app/components/app/create-app-modal/__tests__/index.spec.tsx @@ -41,7 +41,7 @@ const toastMocks = vi.hoisted(() => ({ mockToastSuccess: vi.fn(), mockToastError: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: toastMocks.mockToastSuccess, error: toastMocks.mockToastError, diff --git a/web/app/components/app/create-app-modal/index.tsx b/web/app/components/app/create-app-modal/index.tsx index 073107755f..2ff8a0aacd 100644 --- a/web/app/components/app/create-app-modal/index.tsx +++ b/web/app/components/app/create-app-modal/index.tsx @@ -1,8 +1,10 @@ 'use client' import type { AppIconSelection } from '../../base/app-icon-picker' -import { cn } from '@langgenius/dify-ui/cn' +import { Button } from '@langgenius/dify-ui/button' +import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowRightLine, RiArrowRightSLine, RiExchange2Fill } from '@remixicon/react' import { useDebounceFn, useKeyPress } from 'ahooks' import { useCallback, useEffect, useRef, useState } from 'react' @@ -13,8 +15,6 @@ import FullScreenModal from '@/app/components/base/fullscreen-modal' import { BubbleTextMod, ChatBot, ListSparkle, Logic } from '@/app/components/base/icons/src/vender/solid/communication' import Input from '@/app/components/base/input' import Textarea from '@/app/components/base/textarea' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import AppsFull from '@/app/components/billing/apps-full-in-dialog' import { NEED_REFRESH_APP_LIST_KEY } from '@/config' import { useAppContext } from '@/context/app-context' diff --git a/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx b/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx index ae555a872b..f56b815399 100644 --- a/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx +++ b/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx @@ -83,7 +83,7 @@ vi.mock('@/utils/app-redirection', () => ({ getRedirection: (...args: unknown[]) => mockGetRedirection(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign( (...args: unknown[]) => toastMocks.call(...args), { diff --git a/web/app/components/app/create-from-dsl-modal/__tests__/uploader.spec.tsx b/web/app/components/app/create-from-dsl-modal/__tests__/uploader.spec.tsx index 8b935db118..ba097b355c 100644 --- a/web/app/components/app/create-from-dsl-modal/__tests__/uploader.spec.tsx +++ b/web/app/components/app/create-from-dsl-modal/__tests__/uploader.spec.tsx @@ -1,5 +1,5 @@ +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen } from '@testing-library/react' -import { toast } from '@/app/components/base/ui/toast' import Uploader from '../uploader' vi.mock('react-i18next', () => ({ @@ -8,7 +8,7 @@ vi.mock('react-i18next', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: vi.fn(), }, diff --git a/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx b/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx index 59ba840a07..d0c97e185c 100644 --- a/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx +++ b/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx @@ -1,6 +1,6 @@ +import { Button } from '@langgenius/dify-ui/button' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' type DSLConfirmModalProps = { versions?: { 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 d4b857ee6b..4f99fe9027 100644 --- a/web/app/components/app/create-from-dsl-modal/index.tsx +++ b/web/app/components/app/create-from-dsl-modal/index.tsx @@ -1,7 +1,9 @@ 'use client' import type { MouseEventHandler } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiCloseLine } from '@remixicon/react' import { useDebounceFn, useKeyPress } from 'ahooks' import { noop } from 'es-toolkit/function' @@ -9,8 +11,6 @@ import { useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import AppsFull from '@/app/components/billing/apps-full-in-dialog' import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks' import { NEED_REFRESH_APP_LIST_KEY } from '@/config' diff --git a/web/app/components/app/create-from-dsl-modal/uploader.tsx b/web/app/components/app/create-from-dsl-modal/uploader.tsx index 1daa7e9f7b..aeecb280d0 100644 --- a/web/app/components/app/create-from-dsl-modal/uploader.tsx +++ b/web/app/components/app/create-from-dsl-modal/uploader.tsx @@ -1,6 +1,7 @@ 'use client' import type { FC } from 'react' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiDeleteBinLine, RiUploadCloud2Line, @@ -10,7 +11,6 @@ import { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' import { Yaml as YamlIcon } from '@/app/components/base/icons/src/public/files' -import { toast } from '@/app/components/base/ui/toast' import { formatFileSize } from '@/utils/format' type Props = { diff --git a/web/app/components/app/duplicate-modal/__tests__/index.spec.tsx b/web/app/components/app/duplicate-modal/__tests__/index.spec.tsx index a2ff6bc2fd..ceec1aa3c0 100644 --- a/web/app/components/app/duplicate-modal/__tests__/index.spec.tsx +++ b/web/app/components/app/duplicate-modal/__tests__/index.spec.tsx @@ -20,7 +20,7 @@ vi.mock('@/context/provider-context', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => toastErrorMock(...args), }, diff --git a/web/app/components/app/duplicate-modal/index.tsx b/web/app/components/app/duplicate-modal/index.tsx index c28ead7821..e55ac6cf66 100644 --- a/web/app/components/app/duplicate-modal/index.tsx +++ b/web/app/components/app/duplicate-modal/index.tsx @@ -1,6 +1,8 @@ 'use client' import type { AppIconType } from '@/types/app' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiCloseLine } from '@remixicon/react' import { noop } from 'es-toolkit/function' import * as React from 'react' @@ -9,8 +11,6 @@ import { useTranslation } from 'react-i18next' import AppIcon from '@/app/components/base/app-icon' import Input from '@/app/components/base/input' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import AppsFull from '@/app/components/billing/apps-full-in-dialog' import { useProviderContext } from '@/context/provider-context' import AppIconPicker from '../../base/app-icon-picker' diff --git a/web/app/components/app/in-site-message/index.tsx b/web/app/components/app/in-site-message/index.tsx index 5482086483..4038fb375d 100644 --- a/web/app/components/app/in-site-message/index.tsx +++ b/web/app/components/app/in-site-message/index.tsx @@ -1,10 +1,10 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { useEffect, useMemo, useState } from 'react' import { trackEvent } from '@/app/components/base/amplitude' import { MarkdownWithDirective } from '@/app/components/base/markdown-with-directive' -import { Button } from '@/app/components/base/ui/button' type InSiteMessageAction = 'link' | 'close' type InSiteMessageButtonType = 'primary' | 'default' diff --git a/web/app/components/app/log/__tests__/model-info.spec.tsx b/web/app/components/app/log/__tests__/model-info.spec.tsx index f41aaf4c00..44dcffe7bf 100644 --- a/web/app/components/app/log/__tests__/model-info.spec.tsx +++ b/web/app/components/app/log/__tests__/model-info.spec.tsx @@ -34,7 +34,7 @@ vi.mock('@/app/components/header/account-setting/model-provider-page/model-name' ), })) -vi.mock('@/app/components/base/ui/popover', async () => { +vi.mock('@langgenius/dify-ui/popover', async () => { const React = await import('react') const PopoverContext = React.createContext<{ open: boolean, onOpenChange?: (open: boolean) => void } | null>(null) diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx index 551bae0212..da96d41804 100644 --- a/web/app/components/app/log/list.tsx +++ b/web/app/components/app/log/list.tsx @@ -9,6 +9,7 @@ import { HandThumbUpIcon, } from '@heroicons/react/24/outline' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiCloseLine, RiEditFill } from '@remixicon/react' import dayjs from 'dayjs' import timezone from 'dayjs/plugin/timezone' @@ -30,7 +31,6 @@ import Drawer from '@/app/components/base/drawer' import Loading from '@/app/components/base/loading' import MessageLogModal from '@/app/components/base/message-log-modal' import Tooltip from '@/app/components/base/tooltip' -import { toast } from '@/app/components/base/ui/toast' import { WorkflowContextProvider } from '@/app/components/workflow/context' import { useAppContext } from '@/context/app-context' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' diff --git a/web/app/components/app/log/model-info.tsx b/web/app/components/app/log/model-info.tsx index e768f30a50..314627d855 100644 --- a/web/app/components/app/log/model-info.tsx +++ b/web/app/components/app/log/model-info.tsx @@ -1,12 +1,12 @@ 'use client' import type { FC } from 'react' import { cn } from '@langgenius/dify-ui/cn' +import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover' import { RiInformation2Line, } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Popover, PopoverContent, PopoverTrigger } from '@/app/components/base/ui/popover' import { useTextGenerationCurrentProviderAndModelAndModelList } from '@/app/components/header/account-setting/model-provider-page/hooks' import ModelIcon from '@/app/components/header/account-setting/model-provider-page/model-icon' import ModelName from '@/app/components/header/account-setting/model-provider-page/model-name' diff --git a/web/app/components/app/overview/__tests__/trigger-card.spec.tsx b/web/app/components/app/overview/__tests__/trigger-card.spec.tsx index d51a23bb05..7e183a3b15 100644 --- a/web/app/components/app/overview/__tests__/trigger-card.spec.tsx +++ b/web/app/components/app/overview/__tests__/trigger-card.spec.tsx @@ -73,8 +73,8 @@ vi.mock('@/app/components/workflow/block-icon', () => ({ ), })) -vi.mock('@/app/components/base/switch', () => ({ - default: ({ checked, onCheckedChange, disabled }: { checked: boolean, onCheckedChange: (v: boolean) => void, disabled: boolean }) => ( +vi.mock('@langgenius/dify-ui/switch', () => ({ + Switch: ({ checked, onCheckedChange, disabled }: { checked: boolean, onCheckedChange: (v: boolean) => void, disabled: boolean }) => ( , })) diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/base/header.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/base/header.tsx index 034556d96f..a285946272 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/base/header.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/base/header.tsx @@ -1,10 +1,10 @@ import type { CredentialSelectorProps } from './credential-selector' +import { Button } from '@langgenius/dify-ui/button' import { RiBookOpenLine, RiEqualizer2Line } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' import Divider from '@/app/components/base/divider' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' import CredentialSelector from './credential-selector' type HeaderProps = { diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx index 80a8fc854d..dc20688e9e 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx @@ -18,7 +18,7 @@ const { mockNotify, mockToast } = vi.hoisted(() => { return { mockNotify, mockToast } }) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: mockToast, })) diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx index 6be0e28d31..c193638a6a 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx @@ -37,8 +37,8 @@ const { mockToastError } = vi.hoisted(() => ({ mockToastError: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, toast: { diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx index 5321986cd7..22bc8a65e0 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx @@ -1,11 +1,11 @@ import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types' import type { DataSourceNotionPageMap, DataSourceNotionWorkspace } from '@/models/common' import type { DataSourceNodeCompletedResponse, DataSourceNodeErrorResponse } from '@/types/pipeline' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useEffect, useMemo } from 'react' import { useShallow } from 'zustand/react/shallow' import Loading from '@/app/components/base/loading' import SearchInput from '@/app/components/base/notion-page-selector/search-input' -import { toast } from '@/app/components/base/ui/toast' import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants' import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail' import { useDocLink } from '@/context/i18n' diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx index 6eed119ede..c8fdf49fd1 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx @@ -49,8 +49,8 @@ const { mockToastError } = vi.hoisted(() => ({ mockToastError: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, toast: { diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/connect/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/connect/index.tsx index 5b1b0a6b1a..6a7190161d 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/connect/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/connect/index.tsx @@ -1,7 +1,7 @@ import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types' +import { Button } from '@langgenius/dify-ui/button' import { useTranslation } from 'react-i18next' import { Icon3Dots } from '@/app/components/base/icons/src/vender/line/others' -import { Button } from '@/app/components/base/ui/button' import BlockIcon from '@/app/components/workflow/block-icon' import { useToolIcon } from '@/app/components/workflow/hooks' import { BlockEnum } from '@/app/components/workflow/types' diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/index.tsx index c6a90824ab..43b5fcc71a 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/index.tsx @@ -1,11 +1,11 @@ import { cn } from '@langgenius/dify-ui/cn' -import * as React from 'react' -import { useCallback, useState } from 'react' import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' +} from '@langgenius/dify-ui/dropdown-menu' +import * as React from 'react' +import { useCallback, useState } from 'react' import Menu from './menu' type DropdownProps = { diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-search-result.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-search-result.tsx index ca110d3694..1691bf90b2 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-search-result.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-search-result.tsx @@ -1,7 +1,7 @@ +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' import { SearchMenu } from '@/app/components/base/icons/src/vender/knowledge' -import { Button } from '@/app/components/base/ui/button' type EmptySearchResultProps = { onResetKeywords: () => void diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/header.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/header.tsx index 5c12aaa68c..bc51751aef 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/header.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/header.tsx @@ -1,7 +1,7 @@ +import { Button } from '@langgenius/dify-ui/button' import { RiBookOpenLine, RiEqualizer2Line } from '@remixicon/react' import * as React from 'react' import Divider from '@/app/components/base/divider' -import { Button } from '@/app/components/base/ui/button' type HeaderProps = { onClickConfiguration?: () => void diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx index 2113e8841c..76614e3865 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx @@ -1,10 +1,10 @@ import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types' import type { OnlineDriveFile } from '@/models/pipeline' import type { DataSourceNodeCompletedResponse, DataSourceNodeErrorResponse } from '@/types/pipeline' +import { toast } from '@langgenius/dify-ui/toast' import { produce } from 'immer' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useShallow } from 'zustand/react/shallow' -import { toast } from '@/app/components/base/ui/toast' import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants' import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail' import { useDocLink } from '@/context/i18n' diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/crawled-result-item.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/crawled-result-item.spec.tsx index 62dba84e30..cded02b431 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/crawled-result-item.spec.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/crawled-result-item.spec.tsx @@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' import CrawledResultItem from '../crawled-result-item' -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, onClick }: { children: React.ReactNode, onClick: () => void }) => ( ), diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result-item.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result-item.tsx index 664a251e25..19019b4dd7 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result-item.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result-item.tsx @@ -1,12 +1,12 @@ 'use client' import type { CrawlResultItem as CrawlResultItemType } from '@/models/datasets' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import * as React from 'react' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import Checkbox from '@/app/components/base/checkbox' import Radio from '@/app/components/base/radio/ui' -import { Button } from '@/app/components/base/ui/button' type CrawledResultItemProps = { payload: CrawlResultItemType diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/__tests__/index.spec.tsx index cea569fa5f..2ab8ad6d4b 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/__tests__/index.spec.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/__tests__/index.spec.tsx @@ -10,8 +10,8 @@ const { mockToastError } = vi.hoisted(() => ({ mockToastError: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, toast: { diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx index c8a06ea807..46c6c6f462 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx @@ -1,5 +1,7 @@ import type { RAGPipelineVariables } from '@/models/pipeline' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiPlayLargeLine } from '@remixicon/react' import { useBoolean } from 'ahooks' import { useEffect, useMemo } from 'react' @@ -8,8 +10,6 @@ import { useAppForm } from '@/app/components/base/form' import BaseField from '@/app/components/base/form/form-scenarios/base/field' import { generateZodSchema } from '@/app/components/base/form/form-scenarios/base/utils' import { ArrowDownRoundFill } from '@/app/components/base/icons/src/vender/solid/general' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { useConfigurations, useInitialData } from '@/app/components/rag-pipeline/hooks/use-input-fields' import { CrawlStep } from '@/models/datasets' diff --git a/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx b/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx index 925da57197..ab432d6962 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx @@ -1,8 +1,8 @@ import type { Step } from './step-indicator' +import { Button } from '@langgenius/dify-ui/button' import { RiArrowLeftLine } from '@remixicon/react' import * as React from 'react' import Effect from '@/app/components/base/effect' -import { Button } from '@/app/components/base/ui/button' import Link from '@/next/link' import { useParams } from '@/next/navigation' import StepIndicator from './step-indicator' diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/online-document-preview.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/online-document-preview.spec.tsx index 1e094fedb0..96033a6f60 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/online-document-preview.spec.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/online-document-preview.spec.tsx @@ -9,8 +9,8 @@ const { mockToastError } = vi.hoisted(() => ({ mockToastError: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, toast: { diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx index 2d729ee079..9b56c6c8a3 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx @@ -1,13 +1,13 @@ import type { NotionPage } from '@/models/common' import type { CrawlResultItem, CustomFile, DocumentItem, FileIndexingEstimateResponse } from '@/models/datasets' import type { OnlineDriveFile } from '@/models/pipeline' +import { Button } from '@langgenius/dify-ui/button' import { RiSearchEyeLine } from '@remixicon/react' import * as React from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Badge from '@/app/components/base/badge' import { SkeletonContainer, SkeletonPoint, SkeletonRectangle, SkeletonRow } from '@/app/components/base/skeleton' -import { Button } from '@/app/components/base/ui/button' import SummaryLabel from '@/app/components/datasets/documents/detail/completed/common/summary-label' import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail' import { ChunkingMode } from '@/models/datasets' diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx index 3e9b409a70..793ba1f22b 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx @@ -1,12 +1,12 @@ 'use client' import type { NotionPage } from '@/models/common' +import { toast } from '@langgenius/dify-ui/toast' import { RiCloseLine } from '@remixicon/react' import * as React from 'react' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { Notion } from '@/app/components/base/icons/src/public/common' import { Markdown } from '@/app/components/base/markdown' -import { toast } from '@/app/components/base/ui/toast' import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail' import { usePreviewOnlineDocument } from '@/service/use-pipeline' import { formatNumberAbbreviated } from '@/utils/format' diff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/components.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/components.spec.tsx index ff5f8afa66..16b6ef1373 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/components.spec.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/components.spec.tsx @@ -11,8 +11,8 @@ const { mockToastError } = vi.hoisted(() => ({ mockToastError: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, toast: { diff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/form.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/form.spec.tsx index 09f28fc5da..dc54ba2757 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/form.spec.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/form.spec.tsx @@ -8,8 +8,8 @@ const { mockToastError } = vi.hoisted(() => ({ mockToastError: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, toast: { diff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/header.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/header.spec.tsx index 7e9eabaeda..431fa76f2c 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/header.spec.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/header.spec.tsx @@ -2,7 +2,7 @@ import { fireEvent, render, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' import Header from '../header' -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, onClick, disabled, variant }: { children: React.ReactNode, onClick: () => void, disabled?: boolean, variant: string }) => ( , })) -vi.mock('@/app/components/base/ui/alert-dialog', () => ({ +vi.mock('@langgenius/dify-ui/alert-dialog', () => ({ AlertDialog: ({ children, onOpenChange }: AlertDialogProps) => { latestAlertDialogOnOpenChange = onOpenChange return
{children}
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 995da8bb98..a8f004f3a2 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 @@ -9,6 +9,20 @@ import type { FormRefObject, FormSchema, } from '@/app/components/base/form/types' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' +import { Button } from '@langgenius/dify-ui/button' +import { + Dialog, + DialogCloseButton, + DialogContent, +} from '@langgenius/dify-ui/dialog' import { memo, useCallback, @@ -22,20 +36,6 @@ import AuthForm from '@/app/components/base/form/form-scenarios/auth' import { LinkExternal02 } from '@/app/components/base/icons/src/vender/line/general' import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security' import Loading from '@/app/components/base/loading' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { Button } from '@/app/components/base/ui/button' -import { - Dialog, - DialogCloseButton, - DialogContent, -} from '@/app/components/base/ui/dialog' import { useAuth, useCredentialData, diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.select.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.select.spec.tsx index ae4a68bad7..c221071b82 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.select.spec.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.select.spec.tsx @@ -6,8 +6,8 @@ vi.mock('../../hooks', () => ({ useLanguage: () => 'en_US', })) -vi.mock('@/app/components/base/ui/select', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/select', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.spec.tsx index 2e928c36cc..a57884df1d 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.spec.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.spec.tsx @@ -11,7 +11,7 @@ vi.mock('../../hooks', () => ({ useLanguage: () => 'en_US', })) -vi.mock('@/app/components/base/ui/slider', () => ({ +vi.mock('@langgenius/dify-ui/slider', () => ({ Slider: ({ onValueChange }: { onValueChange: (v: number) => void }) => ( ), diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/configuration-button.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/configuration-button.tsx index 7545cf6a22..598db04ee9 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/configuration-button.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/configuration-button.tsx @@ -1,5 +1,5 @@ +import { Button } from '@langgenius/dify-ui/button' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import { ConfigurationMethodEnum } from '../declarations' type ConfigurationButtonProps = { diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx index 38b343bc19..6f37775052 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx @@ -14,16 +14,16 @@ import type { NodeOutPutVar, } from '@/app/components/workflow/types' import { cn } from '@langgenius/dify-ui/cn' -import { useMemo, useRef, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows' -import Loading from '@/app/components/base/loading' import { Popover, PopoverClose, PopoverContent, PopoverTrigger, -} from '@/app/components/base/ui/popover' +} from '@langgenius/dify-ui/popover' +import { useMemo, useRef, useState } from 'react' +import { useTranslation } from 'react-i18next' +import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows' +import Loading from '@/app/components/base/loading' import { PROVIDER_WITH_PRESET_TONE, STOP_PARAMETER_RULE, TONE_LIST } from '@/config' import { useModelParameterRules } from '@/service/use-common' import { diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx index 4cda97031f..f7e1962fd7 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx @@ -4,15 +4,15 @@ import type { NodeOutPutVar, } from '@/app/components/workflow/types' import { cn } from '@langgenius/dify-ui/cn' +import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, SelectValue } from '@langgenius/dify-ui/select' +import { Slider } from '@langgenius/dify-ui/slider' +import { Switch } from '@langgenius/dify-ui/switch' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import { useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import PromptEditor from '@/app/components/base/prompt-editor' import Radio from '@/app/components/base/radio' -import Switch from '@/app/components/base/switch' import TagInput from '@/app/components/base/tag-input' -import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, SelectValue } from '@/app/components/base/ui/select' -import { Slider } from '@/app/components/base/ui/slider' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' import { BlockEnum } from '@/app/components/workflow/types' import { useLanguage } from '../hooks' import { isNullOrUndefined } from '../utils' diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter.tsx index c2138c1c6f..cb537ab18f 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter.tsx @@ -1,15 +1,15 @@ import type { ReactNode } from 'react' -import { useTranslation } from 'react-i18next' -import { Brush01 } from '@/app/components/base/icons/src/vender/solid/editor' -import { Scales02 } from '@/app/components/base/icons/src/vender/solid/FinanceAndECommerce' -import { Target04 } from '@/app/components/base/icons/src/vender/solid/general' -import { Button } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' +} from '@langgenius/dify-ui/dropdown-menu' +import { useTranslation } from 'react-i18next' +import { Brush01 } from '@/app/components/base/icons/src/vender/solid/editor' +import { Scales02 } from '@/app/components/base/icons/src/vender/solid/FinanceAndECommerce' +import { Target04 } from '@/app/components/base/icons/src/vender/solid/general' import { TONE_LIST } from '@/config' const toneI18nKeyMap = { diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/trigger.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/trigger.tsx index 06823d1a74..d9cb29abbf 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/trigger.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/trigger.tsx @@ -5,8 +5,8 @@ import type { ModelProvider, } from '../declarations' import { cn } from '@langgenius/dify-ui/cn' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import { useTranslation } from 'react-i18next' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' import { useProviderContext } from '@/context/provider-context' import ModelIcon from '../model-icon' import ModelName from '../model-name' diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popover.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popover.spec.tsx index e92bab1db5..d7501672f4 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popover.spec.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popover.spec.tsx @@ -16,7 +16,7 @@ vi.mock('../../hooks', () => ({ }), })) -vi.mock('@/app/components/base/ui/popover', () => ({ +vi.mock('@langgenius/dify-ui/popover', () => ({ Popover: ({ children, onOpenChange }: PopoverProps) => { latestOnOpenChange = onOpenChange return
{children}
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx index 6728791120..341a9c6abc 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx @@ -44,7 +44,7 @@ vi.mock('@/app/components/base/tooltip', () => ({ default: ({ children }: { children: React.ReactNode }) =>
{children}
, })) -vi.mock('@/app/components/base/ui/popover', () => ({ +vi.mock('@langgenius/dify-ui/popover', () => ({ Popover: ({ children }: { children: React.ReactNode }) =>
{children}
, PopoverTrigger: ({ render }: { render: React.ReactNode }) => <>{render}, PopoverContent: ({ children }: { children: React.ReactNode }) =>
{children}
, diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx index 44392a70a5..9241c592f5 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx @@ -5,12 +5,12 @@ import type { ModelFeatureEnum, ModelItem, } from '../declarations' -import { useState } from 'react' import { Popover, PopoverContent, PopoverTrigger, -} from '@/app/components/base/ui/popover' +} from '@langgenius/dify-ui/popover' +import { useState } from 'react' import { useCurrentProviderAndModel } from '../hooks' import ModelSelectorTrigger from './model-selector-trigger' import Popup from './popup' diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/model-selector-trigger.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/model-selector-trigger.tsx index d43324ca12..6b9bcae8dc 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/model-selector-trigger.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/model-selector-trigger.tsx @@ -5,8 +5,8 @@ import type { ModelItem, } from '../declarations' import { cn } from '@langgenius/dify-ui/cn' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import { useTranslation } from 'react-i18next' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' import { useProviderContext } from '@/context/provider-context' import { DERIVED_MODEL_STATUS_BADGE_I18N, diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx index e38cc07ca2..ed16cd7904 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx @@ -5,15 +5,15 @@ import type { ModelItem, } from '../declarations' import { cn } from '@langgenius/dify-ui/cn' -import { useCallback, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { CreditsCoin } from '@/app/components/base/icons/src/vender/line/financeAndECommerce' import { Popover, PopoverContent, PopoverTrigger, -} from '@/app/components/base/ui/popover' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' +} from '@langgenius/dify-ui/popover' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' +import { useCallback, useState } from 'react' +import { useTranslation } from 'react-i18next' +import { CreditsCoin } from '@/app/components/base/icons/src/vender/line/financeAndECommerce' import { useModalContext } from '@/context/modal-context' import { useProviderContext } from '@/context/provider-context' import { diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx index b40bc53a65..017194aaf5 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx @@ -5,11 +5,11 @@ import type { ModelItem, } from '../declarations' import type { ModelProviderQuotaGetPaid } from '@/types/model-provider' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { useTheme } from 'next-themes' import { useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants' import checkTaskStatus from '@/app/components/plugins/install-plugin/base/check-task-status' import useRefreshPluginList from '@/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list' diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/credential-panel.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/credential-panel.spec.tsx index 4f51de9b41..f07f9652f8 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/credential-panel.spec.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/credential-panel.spec.tsx @@ -32,7 +32,7 @@ vi.mock('@/context/global-public-context', () => ({ useSystemFeaturesQuery: () => ({ data: { trial_models: ['langgenius/openai/openai'] } }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ default: { notify: mockToastNotify }, toast: { success: (message: string) => mockToastNotify({ type: 'success', message }), diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx index eedc04115c..c4794c9775 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx @@ -52,8 +52,8 @@ let mockCredentialData: CredentialData | undefined = { current_credential_name: 'Default', } -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, default: { diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/use-change-provider-priority.spec.ts b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/use-change-provider-priority.spec.ts index 57c5121014..7f6e7d393a 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/use-change-provider-priority.spec.ts +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/use-change-provider-priority.spec.ts @@ -16,7 +16,7 @@ const mockMutationOptions = vi.fn((options: Record) => ({ ...options, })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ default: { notify: (...args: unknown[]) => mockNotify(...args), }, diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/dialog.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/dialog.spec.tsx index b4ec0e09d2..85ae2d7e52 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/dialog.spec.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/dialog.spec.tsx @@ -34,7 +34,7 @@ vi.mock('../use-activate-credential', () => ({ }), })) -vi.mock('@/app/components/base/ui/alert-dialog', () => ({ +vi.mock('@langgenius/dify-ui/alert-dialog', () => ({ AlertDialog: ({ children, onOpenChange }: AlertDialogProps) => { latestOnOpenChange = onOpenChange return
{children}
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/use-activate-credential.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/use-activate-credential.spec.tsx index 12acf479c0..aec9c9f691 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/use-activate-credential.spec.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/use-activate-credential.spec.tsx @@ -1,6 +1,6 @@ import type { Credential, ModelProvider } from '../../../declarations' +import { toast } from '@langgenius/dify-ui/toast' import { act, renderHook } from '@testing-library/react' -import { toast } from '@/app/components/base/ui/toast' import { useActivateCredential } from '../use-activate-credential' const mockMutate = vi.fn() diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/api-key-section.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/api-key-section.tsx index e6f5e51d61..41645677b6 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/api-key-section.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/api-key-section.tsx @@ -1,7 +1,7 @@ import type { Credential, CustomModel, ModelProvider } from '../../declarations' +import { Button } from '@langgenius/dify-ui/button' import { memo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import CredentialItem from '../../model-auth/authorized/credential-item' type ApiKeySectionProps = { diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/dropdown-content.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/dropdown-content.tsx index 415539383b..0e0f3a67b1 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/dropdown-content.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/dropdown-content.tsx @@ -1,7 +1,5 @@ import type { Credential, ModelProvider, PreferredProviderTypeEnum } from '../../declarations' import type { CredentialPanelState } from '../use-credential-panel-state' -import { memo, useCallback } from 'react' -import { useTranslation } from 'react-i18next' import { AlertDialog, AlertDialogActions, @@ -10,7 +8,9 @@ import { AlertDialogContent, AlertDialogDescription, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' +} from '@langgenius/dify-ui/alert-dialog' +import { memo, useCallback } from 'react' +import { useTranslation } from 'react-i18next' import { ConfigurationMethodEnum } from '../../declarations' import { useAuth } from '../../model-auth/hooks' import ApiKeySection from './api-key-section' diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/index.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/index.tsx index fc710ef73f..67f73f6941 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/index.tsx @@ -1,13 +1,13 @@ import type { ModelProvider, PreferredProviderTypeEnum } from '../../declarations' import type { CardVariant, CredentialPanelState } from '../use-credential-panel-state' -import { memo, useCallback, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { Popover, PopoverContent, PopoverTrigger, -} from '@/app/components/base/ui/popover' +} from '@langgenius/dify-ui/popover' +import { memo, useCallback, useState } from 'react' +import { useTranslation } from 'react-i18next' import DropdownContent from './dropdown-content' type ModelAuthDropdownProps = { diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/usage-priority-section.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/usage-priority-section.tsx index 638f9d605b..4ec7ce3cef 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/usage-priority-section.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/usage-priority-section.tsx @@ -1,7 +1,7 @@ import type { UsagePriority } from '../use-credential-panel-state' import { cn } from '@langgenius/dify-ui/cn' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import { useTranslation } from 'react-i18next' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' import { PreferredProviderTypeEnum } from '../../declarations' type UsagePrioritySectionProps = { diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/use-activate-credential.ts b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/use-activate-credential.ts index 6f99c32296..db9f735e3a 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/use-activate-credential.ts +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/use-activate-credential.ts @@ -1,7 +1,7 @@ import type { Credential, ModelProvider } from '../../declarations' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { useActiveProviderCredential } from '@/service/use-models' import { useUpdateModelList, useUpdateModelProviders } from '../../hooks' diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx index d8f0b5928c..305ef71c50 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx @@ -1,12 +1,12 @@ import type { ModelItem, ModelProvider } from '../declarations' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { useQueryClient } from '@tanstack/react-query' import { useDebounceFn } from 'ahooks' import { memo, useCallback } from 'react' import { useTranslation } from 'react-i18next' import Badge from '@/app/components/base/badge' import { Balance } from '@/app/components/base/icons/src/vender/line/financeAndECommerce' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import { Plan } from '@/app/components/billing/type' import { useAppContext } from '@/context/app-context' diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx index ea4edace30..9b7b858c13 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx @@ -9,11 +9,11 @@ import type { ModelProvider, } from '../declarations' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { useCallback, useMemo } from 'react' import { useTranslation } from 'react-i18next' import Badge from '@/app/components/base/badge/index' import GridMask from '@/app/components/base/grid-mask' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import UpgradeBtn from '@/app/components/billing/upgrade-btn' import s from '@/app/components/custom/style.module.css' 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 652630be67..34b9d1578f 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 @@ -1,9 +1,4 @@ import type { Credential, CustomConfigurationModelFixedFields, ModelItem, ModelLoadBalancingConfig, ModelLoadBalancingConfigEntry, ModelProvider } from '../declarations' -import { cn } from '@langgenius/dify-ui/cn' -import { memo, useCallback, useEffect, useMemo, useState } from 'react' -import { useTranslation } from 'react-i18next' -import Loading from '@/app/components/base/loading' -import Modal from '@/app/components/base/modal' import { AlertDialog, AlertDialogActions, @@ -11,9 +6,14 @@ import { AlertDialogConfirmButton, AlertDialogContent, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' +} from '@langgenius/dify-ui/alert-dialog' +import { Button } from '@langgenius/dify-ui/button' +import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' +import { memo, useCallback, useEffect, useMemo, useState } from 'react' +import { useTranslation } from 'react-i18next' +import Loading from '@/app/components/base/loading' +import Modal from '@/app/components/base/modal' import { SwitchCredentialInLoadBalancing } from '@/app/components/header/account-setting/model-provider-page/model-auth' import { useGetModelCredential, useUpdateModelLoadBalancingConfig } from '@/service/use-models' import { ConfigurationMethodEnum, FormTypeEnum } from '../declarations' diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/priority-selector.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/priority-selector.tsx index e71a219dcd..a74c400035 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/priority-selector.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/priority-selector.tsx @@ -1,5 +1,6 @@ import type { FC } from 'react' import { Popover, PopoverButton, PopoverPanel, Transition } from '@headlessui/react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiCheckLine, @@ -7,7 +8,6 @@ import { } from '@remixicon/react' import { Fragment } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import { PreferredProviderTypeEnum } from '../declarations' type SelectorProps = { diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/provider-card-actions.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/provider-card-actions.tsx index 2269354825..861c4afa7a 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/provider-card-actions.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/provider-card-actions.tsx @@ -1,11 +1,11 @@ import type { FC } from 'react' import type { PluginDetail } from '@/app/components/plugins/types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import Badge from '@/app/components/base/badge' -import { Button } from '@/app/components/base/ui/button' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' import { HeaderModals } from '@/app/components/plugins/plugin-detail-panel/detail-header/components' import { useDetailHeaderState, usePluginOperations } from '@/app/components/plugins/plugin-detail-panel/detail-header/hooks' import OperationDropdown from '@/app/components/plugins/plugin-detail-panel/operation-dropdown' diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx index 03d7c28a88..5d31db11f9 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx @@ -3,12 +3,12 @@ import type { ModelProvider } from '../declarations' import type { Plugin } from '@/app/components/plugins/types' import type { ModelProviderQuotaGetPaid } from '@/types/model-provider' import { cn } from '@langgenius/dify-ui/cn' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import { useBoolean } from 'ahooks' import * as React from 'react' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import Loading from '@/app/components/base/loading' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' import InstallFromMarketplace from '@/app/components/plugins/install-plugin/install-from-marketplace' import { useSystemFeaturesQuery } from '@/context/global-public-context' import useTimestamp from '@/hooks/use-timestamp' diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/use-change-provider-priority.ts b/web/app/components/header/account-setting/model-provider-page/provider-added-card/use-change-provider-priority.ts index 2a9e7e62ac..c339af4b2e 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/use-change-provider-priority.ts +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/use-change-provider-priority.ts @@ -1,7 +1,7 @@ import type { ModelProvider, PreferredProviderTypeEnum } from '../declarations' +import { toast } from '@langgenius/dify-ui/toast' import { useMutation, useQueryClient } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { consoleQuery } from '@/service/client' import { ConfigurationMethodEnum } from '../declarations' import { useUpdateModelList, useUpdateModelProviders } from '../hooks' diff --git a/web/app/components/header/account-setting/model-provider-page/system-model-selector/__tests__/index.spec.tsx b/web/app/components/header/account-setting/model-provider-page/system-model-selector/__tests__/index.spec.tsx index c1b27a2c04..8129ed721c 100644 --- a/web/app/components/header/account-setting/model-provider-page/system-model-selector/__tests__/index.spec.tsx +++ b/web/app/components/header/account-setting/model-provider-page/system-model-selector/__tests__/index.spec.tsx @@ -43,8 +43,8 @@ vi.mock('@/context/provider-context', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, toast: { 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 8b86923391..41bb3c3ab8 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 @@ -3,21 +3,21 @@ import type { DefaultModel, DefaultModelResponse, } from '../declarations' -import { useState } from 'react' -import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { Dialog, DialogCloseButton, DialogContent, DialogTitle, -} from '@/app/components/base/ui/dialog' -import { toast } from '@/app/components/base/ui/toast' +} from '@langgenius/dify-ui/dialog' +import { toast } from '@langgenius/dify-ui/toast' import { Tooltip, TooltipContent, TooltipTrigger, -} from '@/app/components/base/ui/tooltip' +} from '@langgenius/dify-ui/tooltip' +import { useState } from 'react' +import { useTranslation } from 'react-i18next' import { useAppContext } from '@/context/app-context' import { useProviderContext } from '@/context/provider-context' import { updateDefaultModel } from '@/service/common' diff --git a/web/app/components/header/account-setting/plugin-page/SerpapiPlugin.tsx b/web/app/components/header/account-setting/plugin-page/SerpapiPlugin.tsx index 7308691b54..31c4ce2c3a 100644 --- a/web/app/components/header/account-setting/plugin-page/SerpapiPlugin.tsx +++ b/web/app/components/header/account-setting/plugin-page/SerpapiPlugin.tsx @@ -1,7 +1,7 @@ import type { Form, ValidateValue } from '../key-validator/declarations' import type { PluginProvider } from '@/models/common' +import { toast } from '@langgenius/dify-ui/toast' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { useAppContext } from '@/context/app-context' import SerpapiLogo from '../../assets/serpapi.png' import KeyValidator from '../key-validator' diff --git a/web/app/components/header/account-setting/plugin-page/__tests__/SerpapiPlugin.spec.tsx b/web/app/components/header/account-setting/plugin-page/__tests__/SerpapiPlugin.spec.tsx index 85d205713b..2055c0725d 100644 --- a/web/app/components/header/account-setting/plugin-page/__tests__/SerpapiPlugin.spec.tsx +++ b/web/app/components/header/account-setting/plugin-page/__tests__/SerpapiPlugin.spec.tsx @@ -32,7 +32,7 @@ const { mockToast } = vi.hoisted(() => { return { mockToast } }) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: mockToast, })) diff --git a/web/app/components/header/account-setting/plugin-page/__tests__/index.spec.tsx b/web/app/components/header/account-setting/plugin-page/__tests__/index.spec.tsx index ff58fdd182..ca0c41a83b 100644 --- a/web/app/components/header/account-setting/plugin-page/__tests__/index.spec.tsx +++ b/web/app/components/header/account-setting/plugin-page/__tests__/index.spec.tsx @@ -14,8 +14,8 @@ vi.mock('@/context/app-context', () => ({ useAppContext: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, diff --git a/web/app/components/plugins/install-plugin/__tests__/hooks.spec.ts b/web/app/components/plugins/install-plugin/__tests__/hooks.spec.ts index b4171de7f0..385b9e01e1 100644 --- a/web/app/components/plugins/install-plugin/__tests__/hooks.spec.ts +++ b/web/app/components/plugins/install-plugin/__tests__/hooks.spec.ts @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import { checkForUpdates, fetchReleases, handleUpload } from '../hooks' const mockNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign((...args: unknown[]) => mockNotify(...args), { success: (...args: unknown[]) => mockNotify(...args), error: (...args: unknown[]) => mockNotify(...args), diff --git a/web/app/components/plugins/install-plugin/base/installed.tsx b/web/app/components/plugins/install-plugin/base/installed.tsx index 088d587378..7b76767e77 100644 --- a/web/app/components/plugins/install-plugin/base/installed.tsx +++ b/web/app/components/plugins/install-plugin/base/installed.tsx @@ -1,10 +1,10 @@ 'use client' import type { FC } from 'react' import type { Plugin, PluginDeclaration, PluginManifestInMarket } from '../../types' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' import Badge, { BadgeState } from '@/app/components/base/badge/index' -import { Button } from '@/app/components/base/ui/button' import Card from '../../card' import { pluginManifestInMarketToPluginProps, pluginManifestToCardPluginProps } from '../utils' diff --git a/web/app/components/plugins/install-plugin/hooks.ts b/web/app/components/plugins/install-plugin/hooks.ts index 4759953e30..e7086a7fba 100644 --- a/web/app/components/plugins/install-plugin/hooks.ts +++ b/web/app/components/plugins/install-plugin/hooks.ts @@ -1,5 +1,5 @@ import type { GitHubRepoReleaseResponse } from '../types' -import { toast } from '@/app/components/base/ui/toast' +import { toast } from '@langgenius/dify-ui/toast' import { uploadGitHub } from '@/service/plugins' import { compareVersion, getLatestVersion } from '@/utils/semver' diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx index df94331d58..a94cd8588d 100644 --- a/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx +++ b/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx @@ -2,12 +2,12 @@ import type { FC } from 'react' import type { Dependency, InstallStatus, InstallStatusResponse, Plugin, VersionInfo } from '../../../types' import type { ExposeRefs } from './install-multi' +import { Button } from '@langgenius/dify-ui/button' import { RiLoader2Line } from '@remixicon/react' import * as React from 'react' import { useCallback, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import Checkbox from '@/app/components/base/checkbox' -import { Button } from '@/app/components/base/ui/button' import { useCanInstallPluginFromMarketplace } from '@/app/components/plugins/plugin-page/use-reference-setting' import { useMittContextSelector } from '@/context/mitt-context' import { useInstallOrUpdate, usePluginTaskList } from '@/service/use-plugins' diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx index 1c64e73d62..3fbf0c13ec 100644 --- a/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx +++ b/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx @@ -1,10 +1,10 @@ 'use client' import type { FC } from 'react' import type { InstallStatus, Plugin } from '../../../types' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' import Badge, { BadgeState } from '@/app/components/base/badge/index' -import { Button } from '@/app/components/base/ui/button' import Card from '@/app/components/plugins/card' import { MARKETPLACE_API_PREFIX } from '@/config' import useGetIcon from '../../base/use-get-icon' diff --git a/web/app/components/plugins/install-plugin/install-from-github/__tests__/index.spec.tsx b/web/app/components/plugins/install-plugin/install-from-github/__tests__/index.spec.tsx index 2f35f484f0..e923de5e38 100644 --- a/web/app/components/plugins/install-plugin/install-from-github/__tests__/index.spec.tsx +++ b/web/app/components/plugins/install-plugin/install-from-github/__tests__/index.spec.tsx @@ -57,7 +57,7 @@ const createUpdatePayload = (overrides: Partial = {}): // Mock external dependencies const mockNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign((props: { type: string, message: string }) => mockNotify(props), { success: (message: string) => mockNotify({ type: 'success', message }), error: (message: string) => mockNotify({ type: 'error', message }), 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 f1e4d1b9bf..4ac0a3aa7f 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 @@ -4,11 +4,11 @@ import type { PluginDeclaration, UpdateFromGitHubPayload } from '../../types' import type { Item } from '@/app/components/base/select' import type { InstallState } from '@/app/components/plugins/types' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import * as React from 'react' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' -import { toast } from '@/app/components/base/ui/toast' import useGetIcon from '@/app/components/plugins/install-plugin/base/use-get-icon' import { InstallStepFromGitHub } from '../../types' import Installed from '../base/installed' diff --git a/web/app/components/plugins/install-plugin/install-from-github/steps/loaded.tsx b/web/app/components/plugins/install-plugin/install-from-github/steps/loaded.tsx index c044445f19..ff7630e3a2 100644 --- a/web/app/components/plugins/install-plugin/install-from-github/steps/loaded.tsx +++ b/web/app/components/plugins/install-plugin/install-from-github/steps/loaded.tsx @@ -1,11 +1,11 @@ 'use client' import type { Plugin, PluginDeclaration, UpdateFromGitHubPayload } from '../../../types' +import { Button } from '@langgenius/dify-ui/button' import { RiLoader2Line } from '@remixicon/react' import * as React from 'react' import { useEffect } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import useCheckInstalled from '@/app/components/plugins/install-plugin/hooks/use-check-installed' import { updateFromGitHub } from '@/service/plugins' import { useInstallPackageFromGitHub, usePluginTaskList } from '@/service/use-plugins' diff --git a/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx b/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx index a8236b4b93..18c33def82 100644 --- a/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx +++ b/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx @@ -2,10 +2,10 @@ import type { PluginDeclaration, UpdateFromGitHubPayload } from '../../../types' import type { Item } from '@/app/components/base/select' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' import { PortalSelect } from '@/app/components/base/select' -import { Button } from '@/app/components/base/ui/button' import { handleUpload } from '../../hooks' const i18nPrefix = 'installFromGitHub' diff --git a/web/app/components/plugins/install-plugin/install-from-github/steps/setURL.tsx b/web/app/components/plugins/install-plugin/install-from-github/steps/setURL.tsx index 2a7012d40c..f1b149a8bf 100644 --- a/web/app/components/plugins/install-plugin/install-from-github/steps/setURL.tsx +++ b/web/app/components/plugins/install-plugin/install-from-github/steps/setURL.tsx @@ -1,8 +1,8 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' type SetURLProps = { repoUrl: string diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx index 9ef52d7a5d..7c0a90f179 100644 --- a/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx +++ b/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx @@ -1,11 +1,11 @@ 'use client' import type { FC } from 'react' import type { PluginDeclaration } from '../../../types' +import { Button } from '@langgenius/dify-ui/button' import { RiLoader2Line } from '@remixicon/react' import * as React from 'react' import { useEffect, useMemo } from 'react' import { Trans, useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import useCheckInstalled from '@/app/components/plugins/install-plugin/hooks/use-check-installed' import { useAppContext } from '@/context/app-context' import { uninstallPlugin } from '@/service/plugins' diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx index f9f9969817..e7c3b4cd0f 100644 --- a/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx +++ b/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx @@ -1,10 +1,10 @@ 'use client' import type { FC } from 'react' import type { Dependency, PluginDeclaration } from '../../../types' +import { Button } from '@langgenius/dify-ui/button' import { RiLoader2Line } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import { uploadFile } from '@/service/plugins' import Card from '../../../card' diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx index ac8b458406..91397f3189 100644 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx +++ b/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx @@ -1,11 +1,11 @@ 'use client' import type { FC } from 'react' import type { Plugin, PluginManifestInMarket } from '../../../types' +import { Button } from '@langgenius/dify-ui/button' import { RiLoader2Line } from '@remixicon/react' import * as React from 'react' import { useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import useCheckInstalled from '@/app/components/plugins/install-plugin/hooks/use-check-installed' import { useAppContext } from '@/context/app-context' import { useInstallPackageFromMarketPlace, usePluginDeclarationFromMarketPlace, usePluginTaskList, useUpdatePackageFromMarketPlace } from '@/service/use-plugins' diff --git a/web/app/components/plugins/marketplace/list/card-wrapper.tsx b/web/app/components/plugins/marketplace/list/card-wrapper.tsx index 6cab636392..9dc5bc3d78 100644 --- a/web/app/components/plugins/marketplace/list/card-wrapper.tsx +++ b/web/app/components/plugins/marketplace/list/card-wrapper.tsx @@ -1,12 +1,12 @@ 'use client' import type { Plugin } from '@/app/components/plugins/types' import { useLocale, useTranslation } from '#i18n' +import { Button } from '@langgenius/dify-ui/button' import { RiArrowRightUpLine } from '@remixicon/react' import { useBoolean } from 'ahooks' import { useTheme } from 'next-themes' import * as React from 'react' import { useMemo } from 'react' -import { Button } from '@/app/components/base/ui/button' import Card from '@/app/components/plugins/card' import CardMoreInfo from '@/app/components/plugins/card/card-more-info' import { useTags } from '@/app/components/plugins/hooks' diff --git a/web/app/components/plugins/marketplace/sort-dropdown/__tests__/index.spec.tsx b/web/app/components/plugins/marketplace/sort-dropdown/__tests__/index.spec.tsx index 990bb321de..5bf5b6bb99 100644 --- a/web/app/components/plugins/marketplace/sort-dropdown/__tests__/index.spec.tsx +++ b/web/app/components/plugins/marketplace/sort-dropdown/__tests__/index.spec.tsx @@ -31,7 +31,7 @@ vi.mock('../../atoms', () => ({ useMarketplaceSort: () => [mockSort, mockHandleSortChange], })) -vi.mock('@/app/components/base/ui/dropdown-menu', async () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', async () => { const React = await import('react') const DropdownMenuContext = React.createContext<{ open: boolean, setOpen: (open: boolean) => void } | null>(null) diff --git a/web/app/components/plugins/marketplace/sort-dropdown/index.tsx b/web/app/components/plugins/marketplace/sort-dropdown/index.tsx index a47143de02..b8f5467fa1 100644 --- a/web/app/components/plugins/marketplace/sort-dropdown/index.tsx +++ b/web/app/components/plugins/marketplace/sort-dropdown/index.tsx @@ -1,12 +1,12 @@ 'use client' import { useTranslation } from '#i18n' -import { useState } from 'react' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' +} from '@langgenius/dify-ui/dropdown-menu' +import { useState } from 'react' import { useMarketplaceSort } from '../atoms' const SortDropdown = () => { 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 a4ddec8f51..2bfa94d2ed 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 @@ -15,7 +15,7 @@ const mockToast = { promise: vi.fn(), } -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: mockToast, })) const mockAddPluginCredential = vi.fn().mockResolvedValue({}) diff --git a/web/app/components/plugins/plugin-auth/authorize/__tests__/authorize-components.spec.tsx b/web/app/components/plugins/plugin-auth/authorize/__tests__/authorize-components.spec.tsx index c495d5501a..cba5c60654 100644 --- a/web/app/components/plugins/plugin-auth/authorize/__tests__/authorize-components.spec.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/__tests__/authorize-components.spec.tsx @@ -104,7 +104,7 @@ const mockToast = { promise: vi.fn(), } -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: mockToast, })) // Factory function for creating test PluginPayload diff --git a/web/app/components/plugins/plugin-auth/authorize/__tests__/oauth-client-settings.spec.tsx b/web/app/components/plugins/plugin-auth/authorize/__tests__/oauth-client-settings.spec.tsx index 5f9b6f5695..2c86820202 100644 --- a/web/app/components/plugins/plugin-auth/authorize/__tests__/oauth-client-settings.spec.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/__tests__/oauth-client-settings.spec.tsx @@ -14,7 +14,7 @@ const mockToast = { promise: vi.fn(), } -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: mockToast, })) const mockSetPluginOAuthCustomClient = vi.fn().mockResolvedValue({}) diff --git a/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx b/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx index 2db1751bdc..648a87dabc 100644 --- a/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx @@ -1,11 +1,11 @@ +import type { ButtonProps } from '@langgenius/dify-ui/button' import type { PluginPayload } from '../types' import type { FormSchema } from '@/app/components/base/form/types' -import type { ButtonProps } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { memo, useState, } from 'react' -import { Button } from '@/app/components/base/ui/button' import ApiKeyModal from './api-key-modal' export type AddApiKeyButtonProps = { diff --git a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx index 31e87564e7..44b48db7a2 100644 --- a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx @@ -1,6 +1,7 @@ +import type { ButtonProps } from '@langgenius/dify-ui/button' import type { PluginPayload } from '../types' import type { FormSchema } from '@/app/components/base/form/types' -import type { ButtonProps } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiClipboardLine, @@ -17,7 +18,6 @@ import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' import Badge from '@/app/components/base/badge' import { FormTypeEnum } from '@/app/components/base/form/types' -import { Button } from '@/app/components/base/ui/button' import { useRenderI18nObject } from '@/hooks/use-i18n' import { openOAuthPopup } from '@/hooks/use-oauth' import { 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 5d8eafbe67..db513ecb6f 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 @@ -3,6 +3,7 @@ import type { FormRefObject, FormSchema, } from '@/app/components/base/form/types' +import { toast } from '@langgenius/dify-ui/toast' import { memo, useCallback, @@ -16,7 +17,6 @@ import AuthForm from '@/app/components/base/form/form-scenarios/auth' import { FormTypeEnum } from '@/app/components/base/form/types' import Loading from '@/app/components/base/loading' import Modal from '@/app/components/base/modal/modal' -import { toast } from '@/app/components/base/ui/toast' import { ReadmeEntrance } from '../../readme-panel/entrance' import { ReadmeShowType } from '../../readme-panel/store' import { 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 625fcaa980..f52b76866a 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 @@ -3,6 +3,8 @@ import type { FormRefObject, FormSchema, } from '@/app/components/base/form/types' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useForm, useStore, @@ -16,8 +18,6 @@ import { import { useTranslation } from 'react-i18next' import AuthForm from '@/app/components/base/form/form-scenarios/auth' import Modal from '@/app/components/base/modal/modal' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { ReadmeEntrance } from '../../readme-panel/entrance' import { ReadmeShowType } from '../../readme-panel/store' import { diff --git a/web/app/components/plugins/plugin-auth/authorized-in-data-source-node.tsx b/web/app/components/plugins/plugin-auth/authorized-in-data-source-node.tsx index 548b1fb175..13044d7bbc 100644 --- a/web/app/components/plugins/plugin-auth/authorized-in-data-source-node.tsx +++ b/web/app/components/plugins/plugin-auth/authorized-in-data-source-node.tsx @@ -1,10 +1,10 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiEqualizer2Line } from '@remixicon/react' import { memo, } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import Indicator from '@/app/components/header/indicator' type AuthorizedInDataSourceNodeProps = { diff --git a/web/app/components/plugins/plugin-auth/authorized-in-node.tsx b/web/app/components/plugins/plugin-auth/authorized-in-node.tsx index 048bbf3e8f..e4f55e82e3 100644 --- a/web/app/components/plugins/plugin-auth/authorized-in-node.tsx +++ b/web/app/components/plugins/plugin-auth/authorized-in-node.tsx @@ -2,6 +2,7 @@ import type { Credential, PluginPayload, } from './types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowDownSLine } from '@remixicon/react' import { @@ -10,7 +11,6 @@ import { useState, } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import Indicator from '@/app/components/header/indicator' import { Authorized, diff --git a/web/app/components/plugins/plugin-auth/authorized/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-auth/authorized/__tests__/index.spec.tsx index a127067526..01e195b21b 100644 --- a/web/app/components/plugins/plugin-auth/authorized/__tests__/index.spec.tsx +++ b/web/app/components/plugins/plugin-auth/authorized/__tests__/index.spec.tsx @@ -57,7 +57,7 @@ const toastMocks = vi.hoisted(() => ({ promise: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(toastMocks.call, { success: vi.fn((message: string, options?: Record) => toastMocks.call({ type: 'success', message, ...options })), error: vi.fn((message: string, options?: Record) => toastMocks.call({ type: 'error', message, ...options })), diff --git a/web/app/components/plugins/plugin-auth/authorized/index.tsx b/web/app/components/plugins/plugin-auth/authorized/index.tsx index 4729909a1f..fed2873b98 100644 --- a/web/app/components/plugins/plugin-auth/authorized/index.tsx +++ b/web/app/components/plugins/plugin-auth/authorized/index.tsx @@ -2,7 +2,17 @@ import type { Credential, PluginPayload } from '../types' import type { PortalToFollowElemOptions, } from '@/app/components/base/portal-to-follow-elem' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowDownSLine, } from '@remixicon/react' @@ -18,16 +28,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Indicator from '@/app/components/header/indicator' import Authorize from '../authorize' import ApiKeyModal from '../authorize/api-key-modal' diff --git a/web/app/components/plugins/plugin-auth/authorized/item.tsx b/web/app/components/plugins/plugin-auth/authorized/item.tsx index 82e3fc4563..9193238a55 100644 --- a/web/app/components/plugins/plugin-auth/authorized/item.tsx +++ b/web/app/components/plugins/plugin-auth/authorized/item.tsx @@ -1,4 +1,5 @@ import type { Credential } from '../types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiCheckLine, @@ -16,7 +17,6 @@ import ActionButton from '@/app/components/base/action-button' import Badge from '@/app/components/base/badge' import Input from '@/app/components/base/input' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' import Indicator from '@/app/components/header/indicator' import { CredentialTypeEnum } from '../types' diff --git a/web/app/components/plugins/plugin-auth/hooks/__tests__/use-plugin-auth-action.spec.ts b/web/app/components/plugins/plugin-auth/hooks/__tests__/use-plugin-auth-action.spec.ts index ddf8f83019..06af4a88ee 100644 --- a/web/app/components/plugins/plugin-auth/hooks/__tests__/use-plugin-auth-action.spec.ts +++ b/web/app/components/plugins/plugin-auth/hooks/__tests__/use-plugin-auth-action.spec.ts @@ -16,7 +16,7 @@ const toastMocks = vi.hoisted(() => ({ promise: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(toastMocks.call, { success: vi.fn((message: string, options?: Record) => toastMocks.call({ type: 'success', message, ...options })), error: vi.fn((message: string, options?: Record) => toastMocks.call({ type: 'error', message, ...options })), diff --git a/web/app/components/plugins/plugin-auth/hooks/use-plugin-auth-action.ts b/web/app/components/plugins/plugin-auth/hooks/use-plugin-auth-action.ts index b4714ff96c..7c63753ee8 100644 --- a/web/app/components/plugins/plugin-auth/hooks/use-plugin-auth-action.ts +++ b/web/app/components/plugins/plugin-auth/hooks/use-plugin-auth-action.ts @@ -1,11 +1,11 @@ import type { PluginPayload } from '../types' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useRef, useState, } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { useDeletePluginCredentialHook, useSetPluginDefaultCredentialHook, diff --git a/web/app/components/plugins/plugin-auth/plugin-auth-in-agent.tsx b/web/app/components/plugins/plugin-auth/plugin-auth-in-agent.tsx index f54093f0f9..fd698f811c 100644 --- a/web/app/components/plugins/plugin-auth/plugin-auth-in-agent.tsx +++ b/web/app/components/plugins/plugin-auth/plugin-auth-in-agent.tsx @@ -2,6 +2,7 @@ import type { Credential, PluginPayload, } from './types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowDownSLine } from '@remixicon/react' import { @@ -10,7 +11,6 @@ import { useState, } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import Indicator from '@/app/components/header/indicator' import Authorize from './authorize' import Authorized from './authorized' diff --git a/web/app/components/plugins/plugin-auth/plugin-auth-in-datasource-node.tsx b/web/app/components/plugins/plugin-auth/plugin-auth-in-datasource-node.tsx index e3df399a1c..5cdc893ddd 100644 --- a/web/app/components/plugins/plugin-auth/plugin-auth-in-datasource-node.tsx +++ b/web/app/components/plugins/plugin-auth/plugin-auth-in-datasource-node.tsx @@ -1,8 +1,8 @@ import type { ReactNode } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { RiAddLine } from '@remixicon/react' import { memo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' type PluginAuthInDataSourceNodeProps = { children?: ReactNode diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/detail-header.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/detail-header.spec.tsx index 0eacbf3bd3..63cf25d039 100644 --- a/web/app/components/plugins/plugin-detail-panel/__tests__/detail-header.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/__tests__/detail-header.spec.tsx @@ -17,7 +17,7 @@ const { mockToast } = vi.hoisted(() => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: mockToast, })) diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx index 15c231cb17..1dab8bdf84 100644 --- a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx @@ -10,7 +10,7 @@ const mockDeleteEndpoint = vi.fn() const mockUpdateEndpoint = vi.fn() const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign( (message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-modal.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-modal.spec.tsx index 0be17f07d4..7ccd5065e5 100644 --- a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-modal.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-modal.spec.tsx @@ -6,7 +6,7 @@ import EndpointModal from '../endpoint-modal' const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign( (message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/operation-dropdown.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/operation-dropdown.spec.tsx index fa3d6f2266..db6ff57957 100644 --- a/web/app/components/plugins/plugin-detail-panel/__tests__/operation-dropdown.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/__tests__/operation-dropdown.spec.tsx @@ -14,7 +14,7 @@ vi.mock('@langgenius/dify-ui/cn', () => ({ cn: (...args: (string | undefined | false | null)[]) => args.filter(Boolean).join(' '), })) -vi.mock('@/app/components/base/ui/dropdown-menu', () => ({ +vi.mock('@langgenius/dify-ui/dropdown-menu', () => ({ DropdownMenu: ({ children, open }: { children: ReactNode, open: boolean }) => (
{children}
), diff --git a/web/app/components/plugins/plugin-detail-panel/datasource-action-list.tsx b/web/app/components/plugins/plugin-detail-panel/datasource-action-list.tsx index cafdb7b4b9..5bba7b823b 100644 --- a/web/app/components/plugins/plugin-detail-panel/datasource-action-list.tsx +++ b/web/app/components/plugins/plugin-detail-panel/datasource-action-list.tsx @@ -1,5 +1,5 @@ // import { useAppContext } from '@/context/app-context' -// import { Button } from '@/app/components/base/ui/button' +// import { Button } from '@langgenius/dify-ui/button' // import Indicator from '@/app/components/header/indicator' // import ToolItem from '@/app/components/tools/provider/tool-item' // import ConfigCredential from '@/app/components/tools/setting/build-in/config-credentials' diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/detail-header/__tests__/index.spec.tsx index 84a61cd643..24838fea59 100644 --- a/web/app/components/plugins/plugin-detail-panel/detail-header/__tests__/index.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/detail-header/__tests__/index.spec.tsx @@ -45,7 +45,7 @@ vi.mock('@/app/components/base/action-button', () => ({ ), })) -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, onClick }: { children: React.ReactNode, onClick?: () => void }) => ( ), @@ -57,7 +57,7 @@ vi.mock('@/app/components/base/badge', () => ({ ), })) -vi.mock('@/app/components/base/ui/tooltip', () => ({ +vi.mock('@langgenius/dify-ui/tooltip', () => ({ Tooltip: ({ children }: { children: React.ReactNode }) =>
{children}
, TooltipTrigger: ({ render }: { render: React.ReactNode }) => <>{render}, TooltipContent: ({ children }: { children: React.ReactNode }) =>
{children}
, diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/components/header-modals.tsx b/web/app/components/plugins/plugin-detail-panel/detail-header/components/header-modals.tsx index 3bf24a19b7..c2f6bb8210 100644 --- a/web/app/components/plugins/plugin-detail-panel/detail-header/components/header-modals.tsx +++ b/web/app/components/plugins/plugin-detail-panel/detail-header/components/header-modals.tsx @@ -3,7 +3,6 @@ import type { FC } from 'react' import type { PluginDetail } from '../../../types' import type { ModalStates, VersionTarget } from '../hooks' -import { useTranslation } from 'react-i18next' import { AlertDialog, AlertDialogActions, @@ -12,7 +11,8 @@ import { AlertDialogContent, AlertDialogDescription, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' +} from '@langgenius/dify-ui/alert-dialog' +import { useTranslation } from 'react-i18next' import PluginInfo from '@/app/components/plugins/plugin-page/plugin-info' import UpdateFromMarketplace from '@/app/components/plugins/update-plugin/from-market-place' import { useGetLanguage } from '@/context/i18n' diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/__tests__/use-plugin-operations.spec.ts b/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/__tests__/use-plugin-operations.spec.ts index b8873f1087..855530bf18 100644 --- a/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/__tests__/use-plugin-operations.spec.ts +++ b/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/__tests__/use-plugin-operations.spec.ts @@ -33,7 +33,7 @@ const { } }) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign( (message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/use-plugin-operations.ts b/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/use-plugin-operations.ts index 765c0e8a4e..62c762a35d 100644 --- a/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/use-plugin-operations.ts +++ b/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/use-plugin-operations.ts @@ -2,10 +2,10 @@ import type { PluginDetail } from '../../../types' import type { ModalStates, VersionTarget } from './use-detail-header-state' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import { trackEvent } from '@/app/components/base/amplitude' -import { toast } from '@/app/components/base/ui/toast' import { useModalContext } from '@/context/modal-context' import { useProviderContext } from '@/context/provider-context' import { uninstallPlugin } from '@/service/plugins' diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/index.tsx b/web/app/components/plugins/plugin-detail-panel/detail-header/index.tsx index 5a89afa2c9..1ed91a93f5 100644 --- a/web/app/components/plugins/plugin-detail-panel/detail-header/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/detail-header/index.tsx @@ -1,13 +1,13 @@ 'use client' import type { PluginDetail } from '../../types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' import Badge from '@/app/components/base/badge' -import { Button } from '@/app/components/base/ui/button' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' import { AuthCategory, PluginAuth } from '@/app/components/plugins/plugin-auth' import OperationDropdown from '@/app/components/plugins/plugin-detail-panel/operation-dropdown' import PluginVersionPicker from '@/app/components/plugins/update-plugin/plugin-version-picker' diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx index a8729763ec..e1adc6282d 100644 --- a/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx @@ -1,4 +1,14 @@ import type { EndpointListItem, PluginDetail } from '../types' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' +import { Switch } from '@langgenius/dify-ui/switch' +import { toast } from '@langgenius/dify-ui/toast' import { RiClipboardLine, RiDeleteBinLine, RiEditLine, RiLoginCircleLine } from '@remixicon/react' import { useBoolean } from 'ahooks' import copy from 'copy-to-clipboard' @@ -7,17 +17,7 @@ import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' import { CopyCheck } from '@/app/components/base/icons/src/vender/line/files' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { toast } from '@/app/components/base/ui/toast' import Indicator from '@/app/components/header/indicator' import { addDefaultValue, toolCredentialToFormSchemas } from '@/app/components/tools/utils/to-form-schema' import { diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx index c3c09db786..2d11305f6e 100644 --- a/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx @@ -1,5 +1,6 @@ import type { PluginDetail } from '@/app/components/plugins/types' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiAddLine, RiApps2AddLine, @@ -11,7 +12,6 @@ import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' import Tooltip from '@/app/components/base/tooltip' -import { toast } from '@/app/components/base/ui/toast' import { toolCredentialToFormSchemas } from '@/app/components/tools/utils/to-form-schema' import { useDocLink } from '@/context/i18n' import { diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx index 4c694d4293..0fe0fff6df 100644 --- a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx @@ -2,14 +2,14 @@ import type { FC } from 'react' import type { FormSchema } from '../../base/form/types' import type { PluginDetail } from '../types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowRightUpLine, RiCloseLine } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' import Drawer from '@/app/components/base/drawer' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form' import { useRenderI18nObject } from '@/hooks/use-i18n' import { ReadmeEntrance } from '../readme-panel/entrance' diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/index.spec.tsx index 107d42ada2..00ed9eb4f1 100644 --- a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/index.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/index.spec.tsx @@ -9,7 +9,7 @@ import ModelParameterModal from '../index' // ==================== Mock Setup ==================== const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign( (message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/tts-params-panel.spec.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/tts-params-panel.spec.tsx index e423359872..1d000f7c35 100644 --- a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/tts-params-panel.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/tts-params-panel.spec.tsx @@ -26,8 +26,8 @@ const MockSelectContext = React.createContext<{ onValueChange: () => {}, }) -vi.mock('@/app/components/base/ui/select', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/select', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx index 5f5c0494a9..d0dcab18ea 100644 --- a/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx @@ -9,14 +9,14 @@ import type { } from '@/app/components/header/account-setting/model-provider-page/declarations' import type { TriggerProps } from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal/trigger' import { cn } from '@langgenius/dify-ui/cn' -import { useMemo, useState } from 'react' -import { useTranslation } from 'react-i18next' import { Popover, PopoverContent, PopoverTrigger, -} from '@/app/components/base/ui/popover' -import { toast } from '@/app/components/base/ui/toast' +} from '@langgenius/dify-ui/popover' +import { toast } from '@langgenius/dify-ui/toast' +import { useMemo, useState } from 'react' +import { useTranslation } from 'react-i18next' import { ModelStatusEnum, ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useModelList, diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx index 1ab7ea2f11..7edf2f5d18 100644 --- a/web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx +++ b/web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx @@ -1,7 +1,7 @@ +import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, SelectValue } from '@langgenius/dify-ui/select' import * as React from 'react' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, SelectValue } from '@/app/components/base/ui/select' import { languages } from '@/i18n-config/language' type Props = { diff --git a/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx b/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx index 4b36e4612c..c7a1529a3e 100644 --- a/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx +++ b/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx @@ -1,16 +1,16 @@ 'use client' +import type { Placement } from '@langgenius/dify-ui/dropdown-menu' import type { FC } from 'react' -import type { Placement } from '@/app/components/base/ui/placement' import { cn } from '@langgenius/dify-ui/cn' -import * as React from 'react' -import { useTranslation } from 'react-i18next' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' +} from '@langgenius/dify-ui/dropdown-menu' +import * as React from 'react' +import { useTranslation } from 'react-i18next' import { useGlobalPublicStore } from '@/context/global-public-context' import { PluginSource } from '../types' diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/delete-confirm.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/delete-confirm.spec.tsx index f083c24f42..c2cc608b45 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/delete-confirm.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/delete-confirm.spec.tsx @@ -15,8 +15,8 @@ vi.mock('@/service/use-triggers', () => ({ useDeleteTriggerSubscription: () => ({ mutate: mockDelete, isPending: false }), })) -vi.mock('@/app/components/base/ui/toast', async (importOriginal) => { - const actual = await importOriginal() +vi.mock('@langgenius/dify-ui/toast', async (importOriginal) => { + const actual = await importOriginal() return { ...actual, toast: { diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/log-viewer.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/log-viewer.spec.tsx index 351c1f9d2d..3594c10ce2 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/log-viewer.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/log-viewer.spec.tsx @@ -6,7 +6,7 @@ import LogViewer from '../log-viewer' const mockToastNotify = vi.fn() const mockWriteText = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign( (message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/selector-entry.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/selector-entry.spec.tsx index 3c4ff83fc8..37d828591f 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/selector-entry.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/selector-entry.spec.tsx @@ -26,7 +26,7 @@ vi.mock('@/service/use-triggers', () => ({ useDeleteTriggerSubscription: () => ({ mutate: vi.fn(), isPending: false }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(vi.fn(), { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/selector-view.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/selector-view.spec.tsx index 44cec53e28..2256e90e9d 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/selector-view.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/selector-view.spec.tsx @@ -25,7 +25,7 @@ vi.mock('@/service/use-triggers', () => ({ useDeleteTriggerSubscription: () => ({ mutate: mockDelete, isPending: false }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(vi.fn(), { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/subscription-card.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/subscription-card.spec.tsx index 19edb65dfb..9a89aab7cf 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/subscription-card.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/subscription-card.spec.tsx @@ -29,7 +29,7 @@ vi.mock('@/service/use-triggers', () => ({ useDeleteTriggerSubscription: () => ({ mutate: vi.fn(), isPending: false }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(vi.fn(), { success: vi.fn(), error: vi.fn(), 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 72532ea38d..459b657f3f 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 @@ -122,7 +122,7 @@ vi.mock('@/utils/urlValidation', () => ({ })) const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign((params: unknown) => mockToastNotify(params), { success: (message: unknown) => mockToastNotify({ type: 'success', message }), error: (message: unknown) => mockToastNotify({ type: 'error', message }), diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/index.spec.tsx index 0714fbf554..e1615e7b0a 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/index.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/index.spec.tsx @@ -1,8 +1,8 @@ import type { SimpleDetail } from '../../../store' import type { TriggerOAuthConfig, TriggerProviderApiEntity, TriggerSubscription, TriggerSubscriptionBuilder } from '@/app/components/workflow/block-selector/types' +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen, waitFor } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' -import { toast } from '@/app/components/base/ui/toast' import { SupportedCreationMethods } from '@/app/components/plugins/types' import { TriggerCredentialTypeEnum } from '@/app/components/workflow/block-selector/types' import { CreateButtonType, CreateSubscriptionButton, DEFAULT_METHOD } from '../index' @@ -34,7 +34,7 @@ vi.mock('@/app/components/base/portal-to-follow-elem', () => ({ }, })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(vi.fn(), { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/oauth-client.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/oauth-client.spec.tsx index 5c4407b3c5..46b9499027 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/oauth-client.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/oauth-client.spec.tsx @@ -86,7 +86,7 @@ vi.mock('@/hooks/use-oauth', () => ({ })) const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign( (message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-common-modal-state.helpers.spec.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-common-modal-state.helpers.spec.ts index 61482e2912..87db85b56e 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-common-modal-state.helpers.spec.ts +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-common-modal-state.helpers.spec.ts @@ -27,7 +27,7 @@ const { mockIsPrivateOrLocalAddress: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: mockToastError, }, diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-common-modal-state.spec.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-common-modal-state.spec.ts index 399d3ba60c..26e4a69baa 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-common-modal-state.spec.ts +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-common-modal-state.spec.ts @@ -87,7 +87,7 @@ vi.mock('@/service/use-triggers', () => ({ })) const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: (message: string) => mockToastNotify({ type: 'success', message }), error: (message: string) => mockToastNotify({ type: 'error', message }), diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-oauth-client-state.spec.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-oauth-client-state.spec.ts index cebfc947e7..82eddf501d 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-oauth-client-state.spec.ts +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-oauth-client-state.spec.ts @@ -77,7 +77,7 @@ vi.mock('@/hooks/use-oauth', () => ({ })) const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign( (message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.helpers.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.helpers.ts index 8df864c4fa..2754bbf39d 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.helpers.ts +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.helpers.ts @@ -3,8 +3,8 @@ import type { Dispatch, SetStateAction } from 'react' import type { FormRefObject } from '@/app/components/base/form/types' import type { TriggerSubscriptionBuilder } from '@/app/components/workflow/block-selector/types' import type { BuildTriggerSubscriptionPayload } from '@/service/use-triggers' +import { toast } from '@langgenius/dify-ui/toast' import { useEffect, useRef } from 'react' -import { toast } from '@/app/components/base/ui/toast' import { SupportedCreationMethods } from '@/app/components/plugins/types' import { isPrivateOrLocalAddress } from '@/utils/urlValidation' diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts index 29613c6f4f..0f40da2d58 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts @@ -3,10 +3,10 @@ import type { SimpleDetail } from '../../../store' import type { SchemaItem } from '../components/modal-steps' import type { FormRefObject } from '@/app/components/base/form/types' import type { TriggerLogEntity, TriggerSubscriptionBuilder } from '@/app/components/workflow/block-selector/types' +import { toast } from '@langgenius/dify-ui/toast' import { debounce } from 'es-toolkit/compat' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { SupportedCreationMethods } from '@/app/components/plugins/types' import { TriggerCredentialTypeEnum } from '@/app/components/workflow/block-selector/types' import { diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-oauth-client-state.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-oauth-client-state.ts index e5a5ded9df..25058e529c 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-oauth-client-state.ts +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-oauth-client-state.ts @@ -2,9 +2,9 @@ import type { FormRefObject } from '@/app/components/base/form/types' import type { TriggerOAuthClientParams, TriggerOAuthConfig, TriggerSubscriptionBuilder } from '@/app/components/workflow/block-selector/types' import type { ConfigureTriggerOAuthPayload } from '@/service/use-triggers' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { openOAuthPopup } from '@/hooks/use-oauth' import { useConfigureTriggerOAuth, diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx index 4861f30934..b007c89cb9 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx @@ -1,6 +1,8 @@ import type { Option } from '@/app/components/base/select/custom' 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 { toast } from '@langgenius/dify-ui/toast' import { RiAddLine, RiEqualizer2Line } from '@remixicon/react' import { useBoolean } from 'ahooks' import { useCallback, useMemo, useState } from 'react' @@ -9,8 +11,6 @@ import { ActionButton, ActionButtonState } from '@/app/components/base/action-bu import Badge from '@/app/components/base/badge' import CustomSelect from '@/app/components/base/select/custom' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { openOAuthPopup } from '@/hooks/use-oauth' import { useInitiateTriggerOAuth, useTriggerOAuthConfig, useTriggerProviderInfo } from '@/service/use-triggers' import { SupportedCreationMethods } from '../../../types' 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 c4ae63ab66..450324ae40 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 @@ -1,5 +1,7 @@ 'use client' import type { TriggerOAuthConfig, TriggerSubscriptionBuilder } from '@/app/components/workflow/block-selector/types' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiClipboardLine, RiInformation2Fill, @@ -7,8 +9,6 @@ import { import { useTranslation } from 'react-i18next' import { BaseForm } from '@/app/components/base/form/components/base' import Modal from '@/app/components/base/modal/modal' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import OptionCard from '@/app/components/workflow/nodes/_base/components/option-card' import { usePluginStore } from '../../store' import { ClientTypeEnum, useOAuthClientState } from './hooks/use-oauth-client-state' diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx index a360a477e3..3599dc6260 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx @@ -1,6 +1,3 @@ -import { useState } from 'react' -import { useTranslation } from 'react-i18next' -import Input from '@/app/components/base/input' import { AlertDialog, AlertDialogActions, @@ -9,8 +6,11 @@ import { AlertDialogContent, AlertDialogDescription, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { toast } from '@/app/components/base/ui/toast' +} from '@langgenius/dify-ui/alert-dialog' +import { toast } from '@langgenius/dify-ui/toast' +import { useState } from 'react' +import { useTranslation } from 'react-i18next' +import Input from '@/app/components/base/input' import { useDeleteTriggerSubscription } from '@/service/use-triggers' import { useSubscriptionList } from './use-subscription-list' diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/apikey-edit-modal.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/apikey-edit-modal.spec.tsx index b33f0af8e9..6e192e025c 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/apikey-edit-modal.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/apikey-edit-modal.spec.tsx @@ -47,7 +47,7 @@ vi.mock('@/service/use-triggers', () => ({ useTriggerPluginDynamicOptions: () => ({ data: [], isLoading: false }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign((args: { type: string, message: string }) => mockToast(args), { success: (message: string) => mockToast({ type: 'success', message }), error: (message: string) => mockToast({ type: 'error', message }), 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 126d8e366d..6cf58b8972 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 @@ -13,7 +13,7 @@ import { OAuthEditModal } from '../oauth-edit-modal' // ==================== Mock Setup ==================== const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign((message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { success: (message: string) => mockToastNotify({ type: 'success', message }), error: (message: string) => mockToastNotify({ type: 'error', message }), diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/manual-edit-modal.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/manual-edit-modal.spec.tsx index 4fa236783b..e5fa43268a 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/manual-edit-modal.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/manual-edit-modal.spec.tsx @@ -30,7 +30,7 @@ vi.mock('@/service/use-triggers', () => ({ useTriggerPluginDynamicOptions: () => ({ data: [], isLoading: false }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign((args: { type: string, message: string }) => mockToast(args), { success: (message: string) => mockToast({ type: 'success', message }), error: (message: string) => mockToast({ type: 'error', message }), diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/oauth-edit-modal.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/oauth-edit-modal.spec.tsx index 1927ae5a43..c860cd2818 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/oauth-edit-modal.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/__tests__/oauth-edit-modal.spec.tsx @@ -30,7 +30,7 @@ vi.mock('@/service/use-triggers', () => ({ useTriggerPluginDynamicOptions: () => ({ data: [], isLoading: false }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign((args: { type: string, message: string }) => mockToast(args), { success: (message: string) => mockToast({ type: 'success', message }), error: (message: string) => mockToast({ type: 'error', message }), 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 eea9cb7ff0..f191ad41a8 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 @@ -2,6 +2,7 @@ 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 { toast } from '@langgenius/dify-ui/toast' import { isEqual } from 'es-toolkit/predicate' import { useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' @@ -9,7 +10,6 @@ import { EncryptedBottom } from '@/app/components/base/encrypted-bottom' import { BaseForm } from '@/app/components/base/form/components/base' import { FormTypeEnum } from '@/app/components/base/form/types' import Modal from '@/app/components/base/modal/modal' -import { toast } from '@/app/components/base/ui/toast' import { ReadmeEntrance } from '@/app/components/plugins/readme-panel/entrance' import { useUpdateTriggerSubscription, useVerifyTriggerSubscription } from '@/service/use-triggers' import { parsePluginErrorMessage } from '@/utils/error-parser' 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 333a800ffd..3b3fa1082f 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 @@ -2,13 +2,13 @@ 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 { toast } from '@langgenius/dify-ui/toast' import { isEqual } from 'es-toolkit/predicate' import { useMemo, useRef } from 'react' import { useTranslation } from 'react-i18next' import { BaseForm } from '@/app/components/base/form/components/base' import { FormTypeEnum } from '@/app/components/base/form/types' import Modal from '@/app/components/base/modal/modal' -import { toast } from '@/app/components/base/ui/toast' import { ReadmeEntrance } from '@/app/components/plugins/readme-panel/entrance' import { useUpdateTriggerSubscription } from '@/service/use-triggers' import { ReadmeShowType } from '../../../readme-panel/store' 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 3937d82a0e..355a132bd2 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 @@ -2,13 +2,13 @@ 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 { toast } from '@langgenius/dify-ui/toast' import { isEqual } from 'es-toolkit/predicate' import { useMemo, useRef } from 'react' import { useTranslation } from 'react-i18next' import { BaseForm } from '@/app/components/base/form/components/base' import { FormTypeEnum } from '@/app/components/base/form/types' import Modal from '@/app/components/base/modal/modal' -import { toast } from '@/app/components/base/ui/toast' import { ReadmeEntrance } from '@/app/components/plugins/readme-panel/entrance' import { useUpdateTriggerSubscription } from '@/service/use-triggers' import { ReadmeShowType } from '../../../readme-panel/store' diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/log-viewer.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/log-viewer.tsx index 1960103822..b0b3efe853 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/log-viewer.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/log-viewer.tsx @@ -1,6 +1,7 @@ 'use client' import type { TriggerLogEntity } from '@/app/components/workflow/block-selector/types' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowDownSLine, RiArrowRightSLine, @@ -12,7 +13,6 @@ import dayjs from 'dayjs' import * as React from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/__tests__/index.spec.tsx index 537e99d733..168e4f1eba 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/__tests__/index.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/__tests__/index.spec.tsx @@ -298,7 +298,7 @@ vi.mock('@/app/components/header/account-setting/model-provider-page/model-modal // Mock Toast - need to track notify calls for assertions const mockToastNotify = vi.fn() -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign((message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { success: (message: string) => mockToastNotify({ type: 'success', message }), error: (message: string) => mockToastNotify({ type: 'error', message }), diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx index b4bfd22405..beab35595c 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx @@ -30,8 +30,8 @@ vi.mock('@/app/components/base/select', () => ({ ), })) -vi.mock('@/app/components/base/switch', () => ({ - default: ({ checked, onCheckedChange }: { checked: boolean, onCheckedChange: (checked: boolean) => void }) => ( +vi.mock('@langgenius/dify-ui/switch', () => ({ + Switch: ({ checked, onCheckedChange }: { checked: boolean, onCheckedChange: (checked: boolean) => void }) => ( diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/tool-credentials-form.spec.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/tool-credentials-form.spec.tsx index bd2bc0dd5c..2d50a2d2bf 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/tool-credentials-form.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/tool-credentials-form.spec.tsx @@ -10,7 +10,7 @@ vi.mock('@langgenius/dify-ui/cn', () => ({ cn: (...args: unknown[]) => args.filter(Boolean).join(' '), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(vi.fn(), { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx index 4e6be7d81c..1c731d5eca 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx @@ -7,6 +7,7 @@ import type { ValueSelector, } from '@/app/components/workflow/types' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { RiArrowRightUpLine, RiBracesLine, @@ -16,7 +17,6 @@ import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' import { SimpleSelect } from '@/app/components/base/select' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import { FormTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks' diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-credentials-form.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-credentials-form.tsx index 90893c88ec..64068166d0 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-credentials-form.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-credentials-form.tsx @@ -2,7 +2,9 @@ import type { FC } from 'react' import type { Collection } from '@/app/components/tools/types' import type { ToolCredentialFormSchema } from '@/app/components/tools/utils/to-form-schema' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowRightUpLine, } from '@remixicon/react' @@ -10,8 +12,6 @@ import * as React from 'react' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import Loading from '@/app/components/base/loading' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form' import { addDefaultValue, toolCredentialToFormSchemas } from '@/app/components/tools/utils/to-form-schema' import { useRenderI18nObject } from '@/hooks/use-i18n' diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx index 3ba30790af..889243d507 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx @@ -1,5 +1,7 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { RiDeleteBinLine, RiEqualizer2Line, @@ -11,10 +13,8 @@ import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' import AppIcon from '@/app/components/base/app-icon' import { Group } from '@/app/components/base/icons/src/vender/other' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import { ToolTipContent } from '@/app/components/base/tooltip/content' -import { Button } from '@/app/components/base/ui/button' import Indicator from '@/app/components/header/indicator' import { InstallPluginButton } from '@/app/components/workflow/nodes/_base/components/install-plugin-button' import { useMCPToolAvailability } from '@/app/components/workflow/nodes/_base/components/mcp-tool-availability' diff --git a/web/app/components/plugins/plugin-item/__tests__/action.spec.tsx b/web/app/components/plugins/plugin-item/__tests__/action.spec.tsx index 0b0d9c7fc8..b0ecc839b3 100644 --- a/web/app/components/plugins/plugin-item/__tests__/action.spec.tsx +++ b/web/app/components/plugins/plugin-item/__tests__/action.spec.tsx @@ -26,7 +26,7 @@ const { mockToastNotify: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign( (message: string, options?: { type?: string }) => mockToastNotify({ type: options?.type, message }), { diff --git a/web/app/components/plugins/plugin-item/action.tsx b/web/app/components/plugins/plugin-item/action.tsx index ed401b534f..fe0ba932fc 100644 --- a/web/app/components/plugins/plugin-item/action.tsx +++ b/web/app/components/plugins/plugin-item/action.tsx @@ -2,11 +2,6 @@ import type { FC } from 'react' import type { MetaData } from '../types' import type { PluginCategoryEnum } from '@/app/components/plugins/types' -import { RiDeleteBinLine, RiInformation2Line, RiLoopLeftLine } from '@remixicon/react' -import { useBoolean } from 'ahooks' -import * as React from 'react' -import { useCallback } from 'react' -import { useTranslation } from 'react-i18next' import { AlertDialog, AlertDialogActions, @@ -14,8 +9,13 @@ import { AlertDialogConfirmButton, AlertDialogContent, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { toast } from '@/app/components/base/ui/toast' +} from '@langgenius/dify-ui/alert-dialog' +import { toast } from '@langgenius/dify-ui/toast' +import { RiDeleteBinLine, RiInformation2Line, RiLoopLeftLine } from '@remixicon/react' +import { useBoolean } from 'ahooks' +import * as React from 'react' +import { useCallback } from 'react' +import { useTranslation } from 'react-i18next' import { useModalContext } from '@/context/modal-context' import { uninstallPlugin } from '@/service/plugins' import { useInvalidateInstalledPluginList } from '@/service/use-plugins' diff --git a/web/app/components/plugins/plugin-mutation-model/index.tsx b/web/app/components/plugins/plugin-mutation-model/index.tsx index 4e8478f8ad..96a60fd938 100644 --- a/web/app/components/plugins/plugin-mutation-model/index.tsx +++ b/web/app/components/plugins/plugin-mutation-model/index.tsx @@ -1,10 +1,10 @@ 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 * as React from 'react' import { memo } from 'react' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' import Card from '@/app/components/plugins/card' type Props = { diff --git a/web/app/components/plugins/plugin-page/__tests__/debug-info.spec.tsx b/web/app/components/plugins/plugin-page/__tests__/debug-info.spec.tsx index 2af44ecf97..65a36f4009 100644 --- a/web/app/components/plugins/plugin-page/__tests__/debug-info.spec.tsx +++ b/web/app/components/plugins/plugin-page/__tests__/debug-info.spec.tsx @@ -15,7 +15,7 @@ vi.mock('@/service/use-plugins', () => ({ useDebugKey: () => mockDebugKey, })) -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children }: { children: React.ReactNode }) => , })) diff --git a/web/app/components/plugins/plugin-page/__tests__/install-plugin-dropdown.spec.tsx b/web/app/components/plugins/plugin-page/__tests__/install-plugin-dropdown.spec.tsx index 1f249b16c6..2dd884e18b 100644 --- a/web/app/components/plugins/plugin-page/__tests__/install-plugin-dropdown.spec.tsx +++ b/web/app/components/plugins/plugin-page/__tests__/install-plugin-dropdown.spec.tsx @@ -35,13 +35,13 @@ vi.mock('@/app/components/base/icons/src/vender/solid/mediaAndDevices', () => ({ MagicBox: () => magic, })) -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, onClick, className, ...props }: React.ButtonHTMLAttributes) => ( ), })) -vi.mock('@/app/components/base/ui/dropdown-menu', async () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', async () => { const React = await import('react') const DropdownMenuContext = React.createContext<{ isOpen: boolean, setOpen: (open: boolean) => void } | null>(null) diff --git a/web/app/components/plugins/plugin-page/__tests__/use-reference-setting.spec.ts b/web/app/components/plugins/plugin-page/__tests__/use-reference-setting.spec.ts index c3c415bb4b..efb31b5afb 100644 --- a/web/app/components/plugins/plugin-page/__tests__/use-reference-setting.spec.ts +++ b/web/app/components/plugins/plugin-page/__tests__/use-reference-setting.spec.ts @@ -1,7 +1,7 @@ +// Import mocks for assertions +import { toast } from '@langgenius/dify-ui/toast' import { renderHook, waitFor } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' -// Import mocks for assertions -import { toast } from '@/app/components/base/ui/toast' import { useAppContext } from '@/context/app-context' import { useGlobalPublicStore } from '@/context/global-public-context' diff --git a/web/app/components/plugins/plugin-page/debug-info.tsx b/web/app/components/plugins/plugin-page/debug-info.tsx index 4b3590f15c..4e02fdc2be 100644 --- a/web/app/components/plugins/plugin-page/debug-info.tsx +++ b/web/app/components/plugins/plugin-page/debug-info.tsx @@ -1,5 +1,6 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { RiArrowRightUpLine, RiBugLine, @@ -7,7 +8,6 @@ import { import * as React from 'react' import { useTranslation } from 'react-i18next' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' import { useDocLink } from '@/context/i18n' import { useDebugKey } from '@/service/use-plugins' import KeyValueItem from '../base/key-value-item' diff --git a/web/app/components/plugins/plugin-page/empty/index.tsx b/web/app/components/plugins/plugin-page/empty/index.tsx index 5141519e35..e90918b4ab 100644 --- a/web/app/components/plugins/plugin-page/empty/index.tsx +++ b/web/app/components/plugins/plugin-page/empty/index.tsx @@ -1,4 +1,5 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { noop } from 'es-toolkit/function' import * as React from 'react' import { useEffect, useMemo, useRef, useState } from 'react' @@ -7,7 +8,6 @@ import { Group } from '@/app/components/base/icons/src/vender/other' import { FileZip } from '@/app/components/base/icons/src/vender/solid/files' import { Github } from '@/app/components/base/icons/src/vender/solid/general' import { MagicBox } from '@/app/components/base/icons/src/vender/solid/mediaAndDevices' -import { Button } from '@/app/components/base/ui/button' import InstallFromGitHub from '@/app/components/plugins/install-plugin/install-from-github' import InstallFromLocalPackage from '@/app/components/plugins/install-plugin/install-from-local-package' import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config' diff --git a/web/app/components/plugins/plugin-page/index.tsx b/web/app/components/plugins/plugin-page/index.tsx index 05a6dd26e3..f80d37189a 100644 --- a/web/app/components/plugins/plugin-page/index.tsx +++ b/web/app/components/plugins/plugin-page/index.tsx @@ -2,6 +2,7 @@ import type { Dependency, PluginDeclaration, PluginManifestInMarket } from '../types' import type { PluginPageTab } from './context' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiBookOpenLine, @@ -14,7 +15,6 @@ import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import TabSlider from '@/app/components/base/tab-slider' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' import ReferenceSettingModal from '@/app/components/plugins/reference-setting-modal' import { MARKETPLACE_API_PREFIX, SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config' import { useGlobalPublicStore } from '@/context/global-public-context' diff --git a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx index 9b98d16410..dee3dc17bb 100644 --- a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx +++ b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx @@ -1,6 +1,13 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from '@langgenius/dify-ui/dropdown-menu' import { RiAddLine, RiArrowDownSLine } from '@remixicon/react' import { noop } from 'es-toolkit/function' import { useEffect, useRef, useState } from 'react' @@ -8,13 +15,6 @@ import { useTranslation } from 'react-i18next' import { FileZip } from '@/app/components/base/icons/src/vender/solid/files' import { Github } from '@/app/components/base/icons/src/vender/solid/general' import { MagicBox } from '@/app/components/base/icons/src/vender/solid/mediaAndDevices' -import { Button } from '@/app/components/base/ui/button' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' import InstallFromGitHub from '@/app/components/plugins/install-plugin/install-from-github' import InstallFromLocalPackage from '@/app/components/plugins/install-plugin/install-from-local-package' import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config' diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx index 0129c65ee2..ab17dd202b 100644 --- a/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx +++ b/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx @@ -1,9 +1,9 @@ import type { FC } from 'react' import type { Plugin, PluginStatus } from '@/app/components/plugins/types' import type { Locale } from '@/i18n-config' +import { Button } from '@langgenius/dify-ui/button' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import InstallFromMarketplace from '@/app/components/plugins/install-plugin/install-from-marketplace' import { PluginSource } from '@/app/components/plugins/types' import { fetchPluginInfoFromMarketPlace } from '@/service/plugins' diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/components/plugin-task-list.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/components/plugin-task-list.tsx index e0dcc5b6f8..24fcf85cde 100644 --- a/web/app/components/plugins/plugin-page/plugin-tasks/components/plugin-task-list.tsx +++ b/web/app/components/plugins/plugin-page/plugin-tasks/components/plugin-task-list.tsx @@ -1,7 +1,7 @@ import type { FC } from 'react' import type { PluginStatus } from '@/app/components/plugins/types' +import { Button } from '@langgenius/dify-ui/button' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import { useGetLanguage } from '@/context/i18n' import ErrorPluginItem from './error-plugin-item' import PluginSection from './plugin-section' diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx index 9a39b43bf6..7603cae33d 100644 --- a/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx +++ b/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx @@ -1,14 +1,14 @@ +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuTrigger, +} from '@langgenius/dify-ui/dropdown-menu' import { useCallback, useMemo, useState, } from 'react' import { useTranslation } from 'react-i18next' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' import useGetIcon from '@/app/components/plugins/install-plugin/base/use-get-icon' import PluginTaskList from './components/plugin-task-list' import TaskStatusIndicator from './components/task-status-indicator' diff --git a/web/app/components/plugins/plugin-page/plugins-panel.tsx b/web/app/components/plugins/plugin-page/plugins-panel.tsx index 142c9329cc..a824d55dda 100644 --- a/web/app/components/plugins/plugin-page/plugins-panel.tsx +++ b/web/app/components/plugins/plugin-page/plugins-panel.tsx @@ -1,11 +1,11 @@ 'use client' import type { PluginDetail } from '../types' import type { FilterState } from './filter-management' +import { Button } from '@langgenius/dify-ui/button' import { useDebounceFn } from 'ahooks' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import Loading from '@/app/components/base/loading' -import { Button } from '@/app/components/base/ui/button' import PluginDetailPanel from '@/app/components/plugins/plugin-detail-panel' import { useGetLanguage } from '@/context/i18n' import { renderI18nObject } from '@/i18n-config' diff --git a/web/app/components/plugins/plugin-page/use-reference-setting.ts b/web/app/components/plugins/plugin-page/use-reference-setting.ts index 0a0e925207..b688bdc11e 100644 --- a/web/app/components/plugins/plugin-page/use-reference-setting.ts +++ b/web/app/components/plugins/plugin-page/use-reference-setting.ts @@ -1,6 +1,6 @@ +import { toast } from '@langgenius/dify-ui/toast' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { useAppContext } from '@/context/app-context' import { useGlobalPublicStore } from '@/context/global-public-context' import { useInvalidateReferenceSettings, useMutationReferenceSettings, useReferenceSettings } from '@/service/use-plugins' diff --git a/web/app/components/plugins/provider-card.tsx b/web/app/components/plugins/provider-card.tsx index 7f07699771..06b611b355 100644 --- a/web/app/components/plugins/provider-card.tsx +++ b/web/app/components/plugins/provider-card.tsx @@ -1,6 +1,7 @@ 'use client' import type { FC } from 'react' import type { Plugin } from './types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowRightUpLine } from '@remixicon/react' import { useBoolean } from 'ahooks' @@ -8,7 +9,6 @@ import { useTheme } from 'next-themes' import * as React from 'react' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import InstallFromMarketplace from '@/app/components/plugins/install-plugin/install-from-marketplace' import { getPluginLinkInMarketplace } from '@/app/components/plugins/marketplace/utils' import { useLocale } from '@/context/i18n' diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/plugins-picker.spec.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/plugins-picker.spec.tsx index 299eecce54..99d7a5fdc5 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/plugins-picker.spec.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/plugins-picker.spec.tsx @@ -5,7 +5,7 @@ import { AUTO_UPDATE_MODE } from '../types' const mockToolPicker = vi.fn() -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, }: { diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/strategy-picker.spec.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/strategy-picker.spec.tsx index e1e72fbde2..5be10ff146 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/strategy-picker.spec.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/strategy-picker.spec.tsx @@ -5,7 +5,7 @@ import { AUTO_UPDATE_STRATEGY } from '../types' let portalOpen = false -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, }: { diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx index c0dbbea5c6..1bb4caeb3f 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx @@ -1,10 +1,10 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { RiAddLine } from '@remixicon/react' import { useBoolean } from 'ahooks' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import NoPluginSelected from './no-plugin-selected' import PluginsSelected from './plugins-selected' import ToolPicker from './tool-picker' diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/strategy-picker.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/strategy-picker.tsx index 0f85b95e3c..22bfa6a30b 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/strategy-picker.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/strategy-picker.tsx @@ -1,3 +1,4 @@ +import { Button } from '@langgenius/dify-ui/button' import { RiArrowDownSLine, RiCheckLine, @@ -9,7 +10,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import { AUTO_UPDATE_STRATEGY } from './types' const i18nPrefix = 'autoUpdate.strategy' diff --git a/web/app/components/plugins/reference-setting-modal/index.tsx b/web/app/components/plugins/reference-setting-modal/index.tsx index bbf19d8c0a..061777e38b 100644 --- a/web/app/components/plugins/reference-setting-modal/index.tsx +++ b/web/app/components/plugins/reference-setting-modal/index.tsx @@ -2,11 +2,11 @@ import type { FC } from 'react' import type { AutoUpdateConfig } from './auto-update-setting/types' import type { Permissions, ReferenceSetting } from '@/app/components/plugins/types' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' import { PermissionType } from '@/app/components/plugins/types' import OptionCard from '@/app/components/workflow/nodes/_base/components/option-card' import { useGlobalPublicStore } from '@/context/global-public-context' diff --git a/web/app/components/plugins/update-plugin/__tests__/from-market-place.spec.tsx b/web/app/components/plugins/update-plugin/__tests__/from-market-place.spec.tsx index 9d9ad77106..3cc3ef78d1 100644 --- a/web/app/components/plugins/update-plugin/__tests__/from-market-place.spec.tsx +++ b/web/app/components/plugins/update-plugin/__tests__/from-market-place.spec.tsx @@ -22,7 +22,7 @@ const { mockToastError: vi.fn(), })) -vi.mock('@/app/components/base/ui/dialog', () => ({ +vi.mock('@langgenius/dify-ui/dialog', () => ({ Dialog: ({ children }: { children: React.ReactNode }) =>
{children}
, DialogContent: ({ children }: { children: React.ReactNode }) =>
{children}
, DialogTitle: ({ children }: { children: React.ReactNode }) =>
{children}
, @@ -37,7 +37,7 @@ vi.mock('@/app/components/base/badge/index', () => ({ default: ({ children }: { children: React.ReactNode }) =>
{children}
, })) -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, onClick, @@ -49,7 +49,7 @@ vi.mock('@/app/components/base/ui/button', () => ({ }) => , })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: mockToastError, }, diff --git a/web/app/components/plugins/update-plugin/__tests__/index.spec.tsx b/web/app/components/plugins/update-plugin/__tests__/index.spec.tsx index cdd7462342..d0492696ca 100644 --- a/web/app/components/plugins/update-plugin/__tests__/index.spec.tsx +++ b/web/app/components/plugins/update-plugin/__tests__/index.spec.tsx @@ -4,11 +4,11 @@ import type { UpdateFromMarketPlacePayload, UpdatePluginModalType, } from '../../types' +import { toast } from '@langgenius/dify-ui/toast' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { fireEvent, render, screen, waitFor } from '@testing-library/react' import * as React from 'react' import { beforeEach, describe, expect, it, vi } from 'vitest' -import { toast } from '@/app/components/base/ui/toast' import { PluginCategoryEnum, PluginSource, TaskStatus } from '../../types' import DowngradeWarningModal from '../downgrade-warning' import FromGitHub from '../from-github' diff --git a/web/app/components/plugins/update-plugin/downgrade-warning.tsx b/web/app/components/plugins/update-plugin/downgrade-warning.tsx index da53ebfb12..801c8ede51 100644 --- a/web/app/components/plugins/update-plugin/downgrade-warning.tsx +++ b/web/app/components/plugins/update-plugin/downgrade-warning.tsx @@ -1,5 +1,5 @@ +import { Button } from '@langgenius/dify-ui/button' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' const i18nPrefix = 'autoUpdate.pluginDowngradeWarning' 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 bde5051808..52484e65aa 100644 --- a/web/app/components/plugins/update-plugin/from-market-place.tsx +++ b/web/app/components/plugins/update-plugin/from-market-place.tsx @@ -1,19 +1,19 @@ 'use client' import type { FC } from 'react' import type { UpdateFromMarketPlacePayload } from '../types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' -import * as React from 'react' -import { useCallback, useEffect, useMemo, useState } from 'react' -import { useTranslation } from 'react-i18next' -import Badge, { BadgeState } from '@/app/components/base/badge/index' -import { Button } from '@/app/components/base/ui/button' import { Dialog, DialogCloseButton, DialogContent, DialogTitle, -} from '@/app/components/base/ui/dialog' -import { toast } from '@/app/components/base/ui/toast' +} from '@langgenius/dify-ui/dialog' +import { toast } from '@langgenius/dify-ui/toast' +import * as React from 'react' +import { useCallback, useEffect, useMemo, useState } from 'react' +import { useTranslation } from 'react-i18next' +import Badge, { BadgeState } from '@/app/components/base/badge/index' import Card from '@/app/components/plugins/card' import checkTaskStatus from '@/app/components/plugins/install-plugin/base/check-task-status' import { pluginManifestToCardPluginProps } from '@/app/components/plugins/install-plugin/utils' diff --git a/web/app/components/plugins/update-plugin/plugin-version-picker.tsx b/web/app/components/plugins/update-plugin/plugin-version-picker.tsx index d590f0c9eb..a76fd085ba 100644 --- a/web/app/components/plugins/update-plugin/plugin-version-picker.tsx +++ b/web/app/components/plugins/update-plugin/plugin-version-picker.tsx @@ -1,16 +1,16 @@ 'use client' +import type { Placement } from '@langgenius/dify-ui/popover' import type { FC } from 'react' -import type { Placement } from '@/app/components/base/ui/placement' import { cn } from '@langgenius/dify-ui/cn' -import * as React from 'react' -import { useCallback } from 'react' -import { useTranslation } from 'react-i18next' -import Badge from '@/app/components/base/badge' import { Popover, PopoverContent, PopoverTrigger, -} from '@/app/components/base/ui/popover' +} from '@langgenius/dify-ui/popover' +import * as React from 'react' +import { useCallback } from 'react' +import { useTranslation } from 'react-i18next' +import Badge from '@/app/components/base/badge' import useTimestamp from '@/hooks/use-timestamp' import { useVersionListOfPlugin } from '@/service/use-plugins' import { isEarlierThanVersion } from '@/utils/semver' diff --git a/web/app/components/rag-pipeline/components/__tests__/conversion.spec.tsx b/web/app/components/rag-pipeline/components/__tests__/conversion.spec.tsx index 967e697813..cb11e5baf4 100644 --- a/web/app/components/rag-pipeline/components/__tests__/conversion.spec.tsx +++ b/web/app/components/rag-pipeline/components/__tests__/conversion.spec.tsx @@ -37,11 +37,11 @@ const { mockToast } = vi.hoisted(() => { return { mockToast } }) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: mockToast, })) -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, onClick, ...props }: Record) => ( ), diff --git a/web/app/components/rag-pipeline/components/__tests__/publish-as-knowledge-pipeline-modal.spec.tsx b/web/app/components/rag-pipeline/components/__tests__/publish-as-knowledge-pipeline-modal.spec.tsx index f9eb858b30..7a99b7ab90 100644 --- a/web/app/components/rag-pipeline/components/__tests__/publish-as-knowledge-pipeline-modal.spec.tsx +++ b/web/app/components/rag-pipeline/components/__tests__/publish-as-knowledge-pipeline-modal.spec.tsx @@ -22,7 +22,7 @@ vi.mock('@/app/components/base/modal', () => ({ isShow ?
{children}
: null, })) -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, onClick, disabled, ...props }: Record) => ( @@ -83,7 +83,7 @@ vi.mock('@/app/components/base/ui/dropdown-menu', () => ({ DropdownMenuContent: ({ children }: { children: React.ReactNode }) =>
{children}
, })) -vi.mock('@/app/components/base/ui/tooltip', () => ({ +vi.mock('@langgenius/dify-ui/tooltip', () => ({ Tooltip: ({ children }: { children: React.ReactNode }) => <>{children}, TooltipTrigger: ({ children, diff --git a/web/app/components/workflow/comment/thread.tsx b/web/app/components/workflow/comment/thread.tsx index d0ab65db15..34e0092372 100644 --- a/web/app/components/workflow/comment/thread.tsx +++ b/web/app/components/workflow/comment/thread.tsx @@ -2,20 +2,20 @@ import type { FC, ReactNode } from 'react' import type { WorkflowCommentDetail, WorkflowCommentDetailReply } from '@/service/workflow-comment' +import { Avatar, AvatarFallback, AvatarImage, AvatarRoot } from '@langgenius/dify-ui/avatar' import { cn } from '@langgenius/dify-ui/cn' +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuTrigger, +} from '@langgenius/dify-ui/dropdown-menu' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import { RiArrowDownSLine, RiArrowUpSLine, RiCheckboxCircleFill, RiCheckboxCircleLine, RiCloseLine, RiDeleteBinLine, RiMoreFill } from '@remixicon/react' import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { useReactFlow, useViewport } from 'reactflow' import Divider from '@/app/components/base/divider' import InlineDeleteConfirm from '@/app/components/base/inline-delete-confirm' -import { Avatar, AvatarFallback, AvatarImage, AvatarRoot } from '@/app/components/base/ui/avatar' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' import { getUserColor } from '@/app/components/workflow/collaboration/utils/user-color' import { useAppContext } from '@/context/app-context' import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now' diff --git a/web/app/components/workflow/dsl-export-confirm-modal.tsx b/web/app/components/workflow/dsl-export-confirm-modal.tsx index b256f8bd9f..6f60e19854 100644 --- a/web/app/components/workflow/dsl-export-confirm-modal.tsx +++ b/web/app/components/workflow/dsl-export-confirm-modal.tsx @@ -1,5 +1,6 @@ 'use client' import type { EnvironmentVariable } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiCloseLine, RiLock2Line } from '@remixicon/react' import { noop } from 'es-toolkit/function' @@ -9,7 +10,6 @@ import { useTranslation } from 'react-i18next' import Checkbox from '@/app/components/base/checkbox' import { Env } from '@/app/components/base/icons/src/vender/line/others' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' export type DSLExportConfirmModalProps = { envList: EnvironmentVariable[] diff --git a/web/app/components/workflow/edge-contextmenu.tsx b/web/app/components/workflow/edge-contextmenu.tsx index 61b208fcbd..2b7f13190a 100644 --- a/web/app/components/workflow/edge-contextmenu.tsx +++ b/web/app/components/workflow/edge-contextmenu.tsx @@ -1,14 +1,14 @@ +import { + ContextMenu, + ContextMenuContent, + ContextMenuItem, +} from '@langgenius/dify-ui/context-menu' import { memo, useMemo, } from 'react' import { useTranslation } from 'react-i18next' import { useEdges } from 'reactflow' -import { - ContextMenu, - ContextMenuContent, - ContextMenuItem, -} from '@/app/components/base/ui/context-menu' import { useEdgesInteractions, usePanelInteractions } from './hooks' import ShortcutsName from './shortcuts-name' import { useStore } from './store' diff --git a/web/app/components/workflow/header/__tests__/header-layouts.spec.tsx b/web/app/components/workflow/header/__tests__/header-layouts.spec.tsx index f04a160967..1ddf013f8d 100644 --- a/web/app/components/workflow/header/__tests__/header-layouts.spec.tsx +++ b/web/app/components/workflow/header/__tests__/header-layouts.spec.tsx @@ -60,7 +60,7 @@ vi.mock('@/service/use-workflow', () => ({ useInvalidAllLastRun: () => mockInvalidAllLastRun, })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: (message: string) => mockNotify({ type: 'success', message }), error: (message: string) => mockNotify({ type: 'error', message }), diff --git a/web/app/components/workflow/header/__tests__/run-mode.spec.tsx b/web/app/components/workflow/header/__tests__/run-mode.spec.tsx index 7bc5ef1b0c..02b645e079 100644 --- a/web/app/components/workflow/header/__tests__/run-mode.spec.tsx +++ b/web/app/components/workflow/header/__tests__/run-mode.spec.tsx @@ -46,7 +46,7 @@ vi.mock('../../hooks/use-dynamic-test-run-options', () => ({ useDynamicTestRunOptions: () => mockDynamicOptions, })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: (message: string) => mockNotify({ type: 'success', message }), error: (message: string) => mockNotify({ type: 'error', message }), diff --git a/web/app/components/workflow/header/__tests__/test-run-menu-helpers.spec.tsx b/web/app/components/workflow/header/__tests__/test-run-menu-helpers.spec.tsx index 7df9cd091f..09452055db 100644 --- a/web/app/components/workflow/header/__tests__/test-run-menu-helpers.spec.tsx +++ b/web/app/components/workflow/header/__tests__/test-run-menu-helpers.spec.tsx @@ -10,7 +10,7 @@ import { useShortcutMenu, } from '../test-run-menu-helpers' -vi.mock('@/app/components/base/ui/dropdown-menu', async () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', async () => { const React = await import('react') const DropdownMenuContext = React.createContext<{ open: boolean, setOpen: (open: boolean) => void } | null>(null) diff --git a/web/app/components/workflow/header/__tests__/test-run-menu.spec.tsx b/web/app/components/workflow/header/__tests__/test-run-menu.spec.tsx index 1d462bfc9c..8e93612dc0 100644 --- a/web/app/components/workflow/header/__tests__/test-run-menu.spec.tsx +++ b/web/app/components/workflow/header/__tests__/test-run-menu.spec.tsx @@ -5,7 +5,7 @@ import { act } from 'react' import * as React from 'react' import TestRunMenu, { TriggerType } from '../test-run-menu' -vi.mock('@/app/components/base/ui/dropdown-menu', async () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', async () => { const React = await import('react') const DropdownMenuContext = React.createContext<{ open: boolean, setOpen: (open: boolean) => void } | null>(null) diff --git a/web/app/components/workflow/header/chat-variable-button.tsx b/web/app/components/workflow/header/chat-variable-button.tsx index 63ac90aad6..efac64bd1b 100644 --- a/web/app/components/workflow/header/chat-variable-button.tsx +++ b/web/app/components/workflow/header/chat-variable-button.tsx @@ -1,7 +1,7 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { memo } from 'react' import { BubbleX } from '@/app/components/base/icons/src/vender/line/others' -import { Button } from '@/app/components/base/ui/button' import { useStore } from '@/app/components/workflow/store' import useTheme from '@/hooks/use-theme' diff --git a/web/app/components/workflow/header/checklist/__tests__/index.spec.tsx b/web/app/components/workflow/header/checklist/__tests__/index.spec.tsx index 2c83747dc0..25150e2d04 100644 --- a/web/app/components/workflow/header/checklist/__tests__/index.spec.tsx +++ b/web/app/components/workflow/header/checklist/__tests__/index.spec.tsx @@ -47,7 +47,7 @@ vi.mock('../../../hooks', () => ({ }), })) -vi.mock('@/app/components/base/ui/popover', () => ({ +vi.mock('@langgenius/dify-ui/popover', () => ({ Popover: ({ children, onOpenChange }: PopoverProps) => { latestOnOpenChange = onOpenChange return
{children}
diff --git a/web/app/components/workflow/header/checklist/__tests__/plugin-group.spec.tsx b/web/app/components/workflow/header/checklist/__tests__/plugin-group.spec.tsx index 275c8727d1..78341c2174 100644 --- a/web/app/components/workflow/header/checklist/__tests__/plugin-group.spec.tsx +++ b/web/app/components/workflow/header/checklist/__tests__/plugin-group.spec.tsx @@ -1,7 +1,7 @@ import type { ChecklistItem } from '../../../hooks/use-checklist' +import { Popover, PopoverContent } from '@langgenius/dify-ui/popover' import { fireEvent, render, screen } from '@testing-library/react' import { beforeEach, describe, expect, it } from 'vitest' -import { Popover, PopoverContent } from '@/app/components/base/ui/popover' import { useStore as usePluginDependencyStore } from '../../../plugin-dependency/store' import { BlockEnum } from '../../../types' import { ChecklistPluginGroup } from '../plugin-group' diff --git a/web/app/components/workflow/header/checklist/index.tsx b/web/app/components/workflow/header/checklist/index.tsx index 83384c5583..9a54175c8c 100644 --- a/web/app/components/workflow/header/checklist/index.tsx +++ b/web/app/components/workflow/header/checklist/index.tsx @@ -3,6 +3,12 @@ import type { CommonEdgeType, } from '../../types' import { cn } from '@langgenius/dify-ui/cn' +import { + Popover, + PopoverClose, + PopoverContent, + PopoverTrigger, +} from '@langgenius/dify-ui/popover' import { memo, useMemo, @@ -12,12 +18,6 @@ import { useTranslation } from 'react-i18next' import { useEdges, } from 'reactflow' -import { - Popover, - PopoverClose, - PopoverContent, - PopoverTrigger, -} from '@/app/components/base/ui/popover' import useNodes from '@/app/components/workflow/store/workflow/use-nodes' import { useChecklist, diff --git a/web/app/components/workflow/header/checklist/plugin-group.tsx b/web/app/components/workflow/header/checklist/plugin-group.tsx index f74b314a10..91bc385595 100644 --- a/web/app/components/workflow/header/checklist/plugin-group.tsx +++ b/web/app/components/workflow/header/checklist/plugin-group.tsx @@ -1,10 +1,10 @@ import type { ChecklistItem } from '../../hooks/use-checklist' import type { BlockEnum } from '../../types' import type { Dependency } from '@/app/components/plugins/types' +import { Button } from '@langgenius/dify-ui/button' +import { PopoverClose } from '@langgenius/dify-ui/popover' import { memo, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' -import { PopoverClose } from '@/app/components/base/ui/popover' import BlockIcon from '../../block-icon' import { useStore as usePluginDependencyStore } from '../../plugin-dependency/store' import { ItemIndicator } from './item-indicator' diff --git a/web/app/components/workflow/header/env-button.tsx b/web/app/components/workflow/header/env-button.tsx index 98ab6ba537..eec4af84c8 100644 --- a/web/app/components/workflow/header/env-button.tsx +++ b/web/app/components/workflow/header/env-button.tsx @@ -1,7 +1,7 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { memo } from 'react' import { Env } from '@/app/components/base/icons/src/vender/line/others' -import { Button } from '@/app/components/base/ui/button' import { useInputFieldPanel } from '@/app/components/rag-pipeline/hooks' import { useStore } from '@/app/components/workflow/store' import useTheme from '@/hooks/use-theme' diff --git a/web/app/components/workflow/header/global-variable-button.tsx b/web/app/components/workflow/header/global-variable-button.tsx index 63a4a427b6..f42677a3df 100644 --- a/web/app/components/workflow/header/global-variable-button.tsx +++ b/web/app/components/workflow/header/global-variable-button.tsx @@ -1,7 +1,7 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { memo } from 'react' import { GlobalVariable } from '@/app/components/base/icons/src/vender/line/others' -import { Button } from '@/app/components/base/ui/button' import { useInputFieldPanel } from '@/app/components/rag-pipeline/hooks' import { useStore } from '@/app/components/workflow/store' import useTheme from '@/hooks/use-theme' diff --git a/web/app/components/workflow/header/header-in-restoring.tsx b/web/app/components/workflow/header/header-in-restoring.tsx index e6ad4123ed..f07d28ff13 100644 --- a/web/app/components/workflow/header/header-in-restoring.tsx +++ b/web/app/components/workflow/header/header-in-restoring.tsx @@ -1,12 +1,12 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiHistoryLine } from '@remixicon/react' import { useCallback, } from 'react' import { useTranslation } from 'react-i18next' import { useFeaturesStore } from '@/app/components/base/features/hooks' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { useSelector as useAppContextSelector } from '@/context/app-context' import useTheme from '@/hooks/use-theme' import { useInvalidAllLastRun } from '@/service/use-workflow' diff --git a/web/app/components/workflow/header/header-in-view-history.tsx b/web/app/components/workflow/header/header-in-view-history.tsx index cd39ce605a..88077002c7 100644 --- a/web/app/components/workflow/header/header-in-view-history.tsx +++ b/web/app/components/workflow/header/header-in-view-history.tsx @@ -1,10 +1,10 @@ import type { ViewHistoryProps } from './view-history' +import { Button } from '@langgenius/dify-ui/button' import { useCallback, } from 'react' import { useTranslation } from 'react-i18next' import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows' -import { Button } from '@/app/components/base/ui/button' import Divider from '../../base/divider' import { useWorkflowRun, diff --git a/web/app/components/workflow/header/online-users.tsx b/web/app/components/workflow/header/online-users.tsx index cce2af0cdc..0f057f0787 100644 --- a/web/app/components/workflow/header/online-users.tsx +++ b/web/app/components/workflow/header/online-users.tsx @@ -1,17 +1,17 @@ 'use client' import type { OnlineUser } from '../collaboration/types/collaboration' import { ChevronDownIcon } from '@heroicons/react/20/solid' +import { AvatarFallback, AvatarImage, AvatarRoot } from '@langgenius/dify-ui/avatar' import { cn } from '@langgenius/dify-ui/cn' -import { useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { useReactFlow } from 'reactflow' -import { AvatarFallback, AvatarImage, AvatarRoot } from '@/app/components/base/ui/avatar' import { Popover, PopoverContent, PopoverTrigger, -} from '@/app/components/base/ui/popover' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' +} from '@langgenius/dify-ui/popover' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' +import { useEffect, useState } from 'react' +import { useTranslation } from 'react-i18next' +import { useReactFlow } from 'reactflow' import { useAppContext } from '@/context/app-context' import { getAvatar } from '@/service/common' import { useCollaboration } from '../collaboration/hooks/use-collaboration' diff --git a/web/app/components/workflow/header/run-mode.tsx b/web/app/components/workflow/header/run-mode.tsx index d98b4d6b18..923f6f0330 100644 --- a/web/app/components/workflow/header/run-mode.tsx +++ b/web/app/components/workflow/header/run-mode.tsx @@ -1,12 +1,12 @@ import type { TestRunMenuRef, TriggerOption } from './test-run-menu' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiLoader2Line, RiPlayLargeLine } from '@remixicon/react' import * as React from 'react' import { useCallback, useEffect, useRef } from 'react' import { useTranslation } from 'react-i18next' import { trackEvent } from '@/app/components/base/amplitude' import { StopCircle } from '@/app/components/base/icons/src/vender/line/mediaAndDevices' -import { toast } from '@/app/components/base/ui/toast' import { useWorkflowRun, useWorkflowRunValidation, useWorkflowStartRun } from '@/app/components/workflow/hooks' import ShortcutsName from '@/app/components/workflow/shortcuts-name' import { useStore } from '@/app/components/workflow/store' diff --git a/web/app/components/workflow/header/test-run-menu-helpers.tsx b/web/app/components/workflow/header/test-run-menu-helpers.tsx index 4a25cd87a6..9f14190c54 100644 --- a/web/app/components/workflow/header/test-run-menu-helpers.tsx +++ b/web/app/components/workflow/header/test-run-menu-helpers.tsx @@ -1,12 +1,12 @@ /* eslint-disable react-refresh/only-export-components */ import type { MouseEvent, MouseEventHandler, ReactElement } from 'react' import type { TriggerOption } from './test-run-menu' +import { DropdownMenuItem } from '@langgenius/dify-ui/dropdown-menu' import { cloneElement, isValidElement, useEffect, } from 'react' -import { DropdownMenuItem } from '@/app/components/base/ui/dropdown-menu' import ShortcutsName from '../shortcuts-name' export type ShortcutMapping = { diff --git a/web/app/components/workflow/header/test-run-menu.tsx b/web/app/components/workflow/header/test-run-menu.tsx index 6540875e6b..ceaf38592f 100644 --- a/web/app/components/workflow/header/test-run-menu.tsx +++ b/web/app/components/workflow/header/test-run-menu.tsx @@ -1,7 +1,7 @@ import type { ShortcutMapping } from './test-run-menu-helpers' +import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@langgenius/dify-ui/dropdown-menu' import { forwardRef, useCallback, useImperativeHandle, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@/app/components/base/ui/dropdown-menu' import { OptionRow, SingleOptionTrigger, useShortcutMenu } from './test-run-menu-helpers' export enum TriggerType { diff --git a/web/app/components/workflow/header/version-history-button.tsx b/web/app/components/workflow/header/version-history-button.tsx index ef79c4e411..69dc2b4c4c 100644 --- a/web/app/components/workflow/header/version-history-button.tsx +++ b/web/app/components/workflow/header/version-history-button.tsx @@ -1,11 +1,11 @@ import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiHistoryLine } from '@remixicon/react' import { useKeyPress } from 'ahooks' import * as React from 'react' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import useTheme from '@/hooks/use-theme' import Tooltip from '../../base/tooltip' import ShortcutsName from '../shortcuts-name' diff --git a/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts b/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts index 891007ff0e..f6d2774611 100644 --- a/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts +++ b/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts @@ -89,7 +89,7 @@ vi.mock('../index', () => ({ useNodesMetaData: () => ({ nodes: [], nodesMap: mockNodesMap }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/hooks/__tests__/use-leader-restore.spec.ts b/web/app/components/workflow/hooks/__tests__/use-leader-restore.spec.ts index 5837f1484d..a050994f4c 100644 --- a/web/app/components/workflow/hooks/__tests__/use-leader-restore.spec.ts +++ b/web/app/components/workflow/hooks/__tests__/use-leader-restore.spec.ts @@ -66,7 +66,7 @@ vi.mock('@/app/components/base/features/hooks', () => ({ }), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { info: (...args: unknown[]) => mockToastInfo(...args), }, diff --git a/web/app/components/workflow/hooks/use-checklist.ts b/web/app/components/workflow/hooks/use-checklist.ts index abafcfd8eb..ae9cc0a4a2 100644 --- a/web/app/components/workflow/hooks/use-checklist.ts +++ b/web/app/components/workflow/hooks/use-checklist.ts @@ -16,6 +16,7 @@ import type { ModelItem } from '@/app/components/header/account-setting/model-pr import type { Emoji } from '@/app/components/tools/types' import type { DataSet } from '@/models/datasets' import type { I18nKeysWithPrefix } from '@/types/i18n' +import { toast } from '@langgenius/dify-ui/toast' import { useQueries, useQueryClient } from '@tanstack/react-query' import isDeepEqual from 'fast-deep-equal' import { @@ -27,7 +28,6 @@ import { import { useTranslation } from 'react-i18next' import { useEdges, useStoreApi } from 'reactflow' import { useStore as useAppStore } from '@/app/components/app/store' -import { toast } from '@/app/components/base/ui/toast' import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useModelList } from '@/app/components/header/account-setting/model-provider-page/hooks' import useNodes from '@/app/components/workflow/store/workflow/use-nodes' diff --git a/web/app/components/workflow/hooks/use-leader-restore.ts b/web/app/components/workflow/hooks/use-leader-restore.ts index 048bb932e0..da0036a4ea 100644 --- a/web/app/components/workflow/hooks/use-leader-restore.ts +++ b/web/app/components/workflow/hooks/use-leader-restore.ts @@ -1,11 +1,11 @@ import type { RestoreCompleteData, RestoreIntentData, RestoreRequestData } from '../collaboration/types/collaboration' import type { SyncCallback } from './use-nodes-sync-draft' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useEffect, useRef } from 'react' import { useTranslation } from 'react-i18next' import { useReactFlow } from 'reactflow' import { useStore as useAppStore } from '@/app/components/app/store' import { useFeaturesStore } from '@/app/components/base/features/hooks' -import { toast } from '@/app/components/base/ui/toast' import { useGlobalPublicStore } from '@/context/global-public-context' import { collaborationManager } from '../collaboration/core/collaboration-manager' import { useWorkflowStore } from '../store' diff --git a/web/app/components/workflow/index.tsx b/web/app/components/workflow/index.tsx index 12122c5b72..c535196691 100644 --- a/web/app/components/workflow/index.tsx +++ b/web/app/components/workflow/index.tsx @@ -14,7 +14,17 @@ import type { Node, } from './types' import type { VarInInspect } from '@/types/workflow' +import { + AlertDialog, + AlertDialogActions, + AlertDialogCancelButton, + AlertDialogConfirmButton, + AlertDialogContent, + AlertDialogDescription, + AlertDialogTitle, +} from '@langgenius/dify-ui/alert-dialog' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { useEventListener, } from 'ahooks' @@ -41,16 +51,6 @@ import ReactFlow, { useReactFlow, useStoreApi, } from 'reactflow' -import { - AlertDialog, - AlertDialogActions, - AlertDialogCancelButton, - AlertDialogConfirmButton, - AlertDialogContent, - AlertDialogDescription, - AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' -import { toast } from '@/app/components/base/ui/toast' import { IS_DEV } from '@/config' import { useEventEmitterContextContext } from '@/context/event-emitter' import { diff --git a/web/app/components/workflow/nodes/_base/components/__tests__/file-support.spec.tsx b/web/app/components/workflow/nodes/_base/components/__tests__/file-support.spec.tsx index b58b045f92..1a3e004c7e 100644 --- a/web/app/components/workflow/nodes/_base/components/__tests__/file-support.spec.tsx +++ b/web/app/components/workflow/nodes/_base/components/__tests__/file-support.spec.tsx @@ -19,7 +19,7 @@ vi.mock('@/app/components/base/file-uploader/hooks', () => ({ useFileSizeLimit: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/nodes/_base/components/add-button.tsx b/web/app/components/workflow/nodes/_base/components/add-button.tsx index cd32ee0dc6..d64ab5d098 100644 --- a/web/app/components/workflow/nodes/_base/components/add-button.tsx +++ b/web/app/components/workflow/nodes/_base/components/add-button.tsx @@ -1,11 +1,11 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiAddLine, } from '@remixicon/react' import * as React from 'react' -import { Button } from '@/app/components/base/ui/button' type Props = { className?: string diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx index d13488a0b9..d20acd7f19 100644 --- a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx +++ b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx @@ -4,11 +4,6 @@ import type { NodeOutPutVar } from '../../../types' import type { ToolVarInputs } from '../../tool/types' import type { CredentialFormSchema, CredentialFormSchemaNumberInput, CredentialFormSchemaTextInput } from '@/app/components/header/account-setting/model-provider-page/declarations' import type { PluginMeta } from '@/app/components/plugins/types' -import { noop } from 'es-toolkit/function' -import { memo } from 'react' -import { useTranslation } from 'react-i18next' -import { Agent } from '@/app/components/base/icons/src/vender/workflow' -import ListEmpty from '@/app/components/base/list-empty' import { NumberField, NumberFieldControls, @@ -16,8 +11,13 @@ import { NumberFieldGroup, NumberFieldIncrement, NumberFieldInput, -} from '@/app/components/base/ui/number-field' -import { Slider } from '@/app/components/base/ui/slider' +} from '@langgenius/dify-ui/number-field' +import { Slider } from '@langgenius/dify-ui/slider' +import { noop } from 'es-toolkit/function' +import { memo } from 'react' +import { useTranslation } from 'react-i18next' +import { Agent } from '@/app/components/base/icons/src/vender/workflow' +import ListEmpty from '@/app/components/base/list-empty' import { FormTypeEnum, ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks' import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form' diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/__tests__/index.spec.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/__tests__/index.spec.tsx index a8837f6392..39b9fd8888 100644 --- a/web/app/components/workflow/nodes/_base/components/before-run-form/__tests__/index.spec.tsx +++ b/web/app/components/workflow/nodes/_base/components/before-run-form/__tests__/index.spec.tsx @@ -1,11 +1,11 @@ import type { Props as FormProps } from '../form' import type { BeforeRunFormProps } from '../index' +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen } from '@testing-library/react' -import { toast } from '@/app/components/base/ui/toast' import { BlockEnum, InputVarType } from '@/app/components/workflow/types' import BeforeRunForm from '../index' -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: vi.fn(), }, diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx index f42046a2ad..f15c60e117 100644 --- a/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx +++ b/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx @@ -5,12 +5,12 @@ import type { Emoji } from '@/app/components/tools/types' import type { SpecialResultPanelProps } from '@/app/components/workflow/run/special-result-panel' import type { NodeRunningStatus } from '@/app/components/workflow/types' import type { HumanInputFormData } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import * as React from 'react' import { useEffect, useRef } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Split from '@/app/components/workflow/nodes/_base/components/split' import SingleRunForm from '@/app/components/workflow/nodes/human-input/components/single-run-form' import { BlockEnum } from '@/app/components/workflow/types' diff --git a/web/app/components/workflow/nodes/_base/components/config-vision.tsx b/web/app/components/workflow/nodes/_base/components/config-vision.tsx index 109650cf51..d21e53368d 100644 --- a/web/app/components/workflow/nodes/_base/components/config-vision.tsx +++ b/web/app/components/workflow/nodes/_base/components/config-vision.tsx @@ -1,11 +1,11 @@ 'use client' import type { FC } from 'react' import type { ValueSelector, Var, VisionSetting } from '@/app/components/workflow/types' +import { Switch } from '@langgenius/dify-ui/switch' import { produce } from 'immer' import * as React from 'react' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import Field from '@/app/components/workflow/nodes/_base/components/field' import ResolutionPicker from '@/app/components/workflow/nodes/llm/components/resolution-picker' diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-type-selector.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-type-selector.tsx index 92ca3ed335..07b6519e41 100644 --- a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-type-selector.tsx +++ b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-type-selector.tsx @@ -1,3 +1,4 @@ +import { Button } from '@langgenius/dify-ui/button' import { RiArrowDownSLine, RiCheckLine, @@ -9,7 +10,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import { ErrorHandleTypeEnum } from './types' type ErrorHandleTypeSelectorProps = { diff --git a/web/app/components/workflow/nodes/_base/components/input-number-with-slider.tsx b/web/app/components/workflow/nodes/_base/components/input-number-with-slider.tsx index 4e253060d6..08afb50b80 100644 --- a/web/app/components/workflow/nodes/_base/components/input-number-with-slider.tsx +++ b/web/app/components/workflow/nodes/_base/components/input-number-with-slider.tsx @@ -1,8 +1,8 @@ 'use client' import type { FC } from 'react' +import { Slider } from '@langgenius/dify-ui/slider' import * as React from 'react' import { useCallback } from 'react' -import { Slider } from '@/app/components/base/ui/slider' export type InputNumberWithSliderProps = { value: number diff --git a/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx b/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx index f6e5434a2d..dd2611b395 100644 --- a/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx +++ b/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx @@ -1,9 +1,9 @@ import type { ComponentProps, MouseEventHandler } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiInstallLine, RiLoader2Line } from '@remixicon/react' import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import checkTaskStatus from '@/app/components/plugins/install-plugin/base/check-task-status' import { TaskStatus } from '@/app/components/plugins/types' import { useCheckInstalled, useInstallPackageFromMarketPlace } from '@/service/use-plugins' diff --git a/web/app/components/workflow/nodes/_base/components/layout/__tests__/field-title.spec.tsx b/web/app/components/workflow/nodes/_base/components/layout/__tests__/field-title.spec.tsx index abd630cccb..c11b5ecfc8 100644 --- a/web/app/components/workflow/nodes/_base/components/layout/__tests__/field-title.spec.tsx +++ b/web/app/components/workflow/nodes/_base/components/layout/__tests__/field-title.spec.tsx @@ -1,7 +1,7 @@ import { fireEvent, render, screen } from '@testing-library/react' import { FieldTitle } from '../field-title' -vi.mock('@/app/components/base/ui/tooltip', () => ({ +vi.mock('@langgenius/dify-ui/tooltip', () => ({ Tooltip: ({ children }: { children: React.ReactNode }) =>
{children}
, TooltipTrigger: ({ render }: { render: React.ReactNode }) => <>{render}, TooltipContent: ({ children }: { children: React.ReactNode }) =>
{children}
, diff --git a/web/app/components/workflow/nodes/_base/components/layout/field-title.tsx b/web/app/components/workflow/nodes/_base/components/layout/field-title.tsx index 5a478c25d3..205e75bf67 100644 --- a/web/app/components/workflow/nodes/_base/components/layout/field-title.tsx +++ b/web/app/components/workflow/nodes/_base/components/layout/field-title.tsx @@ -1,10 +1,10 @@ import type { ReactNode } from 'react' import { cn } from '@langgenius/dify-ui/cn' +import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import { memo, useState, } from 'react' -import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' export type FieldTitleProps = { title?: string diff --git a/web/app/components/workflow/nodes/_base/components/memory-config.tsx b/web/app/components/workflow/nodes/_base/components/memory-config.tsx index 15254ad4f4..ed193490a5 100644 --- a/web/app/components/workflow/nodes/_base/components/memory-config.tsx +++ b/web/app/components/workflow/nodes/_base/components/memory-config.tsx @@ -2,13 +2,13 @@ import type { FC } from 'react' import type { Memory } from '../../../types' import { cn } from '@langgenius/dify-ui/cn' +import { Slider } from '@langgenius/dify-ui/slider' +import { Switch } from '@langgenius/dify-ui/switch' import { produce } from 'immer' import * as React from 'react' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import Switch from '@/app/components/base/switch' -import { Slider } from '@/app/components/base/ui/slider' import Field from '@/app/components/workflow/nodes/_base/components/field' import { MemoryRole } from '../../../types' diff --git a/web/app/components/workflow/nodes/_base/components/next-step/__tests__/operator.spec.tsx b/web/app/components/workflow/nodes/_base/components/next-step/__tests__/operator.spec.tsx index 9afa29642d..62cf571ae0 100644 --- a/web/app/components/workflow/nodes/_base/components/next-step/__tests__/operator.spec.tsx +++ b/web/app/components/workflow/nodes/_base/components/next-step/__tests__/operator.spec.tsx @@ -18,7 +18,7 @@ vi.mock('react-i18next', () => ({ }), })) -vi.mock('@/app/components/base/ui/dropdown-menu', async () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', async () => { const React = await import('react') const DropdownMenuContext = React.createContext<{ open: boolean, setOpen: (open: boolean) => void } | null>(null) @@ -49,7 +49,7 @@ vi.mock('@/app/components/base/ui/dropdown-menu', async () => { } }) -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: ({ children, className }: { children: ReactNode, className?: string }) => ( ), diff --git a/web/app/components/workflow/nodes/human-input/components/__tests__/user-action.spec.tsx b/web/app/components/workflow/nodes/human-input/components/__tests__/user-action.spec.tsx index 13f8463676..a47a012f49 100644 --- a/web/app/components/workflow/nodes/human-input/components/__tests__/user-action.spec.tsx +++ b/web/app/components/workflow/nodes/human-input/components/__tests__/user-action.spec.tsx @@ -27,7 +27,7 @@ vi.mock('@/app/components/base/input', () => ({ ), })) -vi.mock('@/app/components/base/ui/button', () => ({ +vi.mock('@langgenius/dify-ui/button', () => ({ Button: (props: { children?: ReactNode onClick?: () => void @@ -38,7 +38,7 @@ vi.mock('@/app/components/base/ui/button', () => ({ ), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ __esModule: true, toast: { success: (message: string) => mockNotify({ type: 'success', message }), diff --git a/web/app/components/workflow/nodes/human-input/components/button-style-dropdown.tsx b/web/app/components/workflow/nodes/human-input/components/button-style-dropdown.tsx index 363e0070c0..44ddbbfa34 100644 --- a/web/app/components/workflow/nodes/human-input/components/button-style-dropdown.tsx +++ b/web/app/components/workflow/nodes/human-input/components/button-style-dropdown.tsx @@ -1,4 +1,5 @@ import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiFontSize, @@ -11,7 +12,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import { UserActionButtonType } from '../types' const i18nPrefix = 'nodes.humanInput' diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/email-configure-modal.spec.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/email-configure-modal.spec.tsx index cec9ffe69a..c5b5c680dc 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/email-configure-modal.spec.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/email-configure-modal.spec.tsx @@ -5,7 +5,7 @@ import EmailConfigureModal from '../email-configure-modal' const mockToastError = vi.hoisted(() => vi.fn()) const mockUseAppContextSelector = vi.hoisted(() => vi.fn()) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (message: string) => mockToastError(message), }, 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 1d77248037..de38564d95 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 @@ -3,6 +3,9 @@ import type { Node, NodeOutPutVar, } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' +import { Switch } from '@langgenius/dify-ui/switch' +import { toast } from '@langgenius/dify-ui/toast' import { RiBugLine, RiCloseLine } from '@remixicon/react' import { noop } from 'es-toolkit/compat' import { memo, useCallback, useState } from 'react' @@ -10,9 +13,6 @@ import { Trans, useTranslation } from 'react-i18next' import Divider from '@/app/components/base/divider' import Input from '@/app/components/base/input' import Modal from '@/app/components/base/modal' -import Switch from '@/app/components/base/switch' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { useSelector as useAppContextWithSelector } from '@/context/app-context' import MailBodyInput from './mail-body-input' import Recipient from './recipient' diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx index eae2e293e1..9cd63e96dd 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx @@ -4,7 +4,9 @@ import type { Node, NodeOutPutVar, } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { RiDeleteBinLine, RiEqualizer2Line, @@ -16,9 +18,7 @@ import { useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import ActionButton, { ActionButtonState } from '@/app/components/base/action-button' import Badge from '@/app/components/base/badge/index' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' import Indicator from '@/app/components/header/indicator' import { useSelector as useAppContextWithSelector } from '@/context/app-context' import { DeliveryMethodType } from '../../types' diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/__tests__/index.spec.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/__tests__/index.spec.tsx index 7fe768781b..cd95a8e9e3 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/__tests__/index.spec.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/__tests__/index.spec.tsx @@ -17,9 +17,8 @@ vi.mock('@/service/use-common', () => ({ useMembers: () => mockUseMembers(), })) -vi.mock('@/app/components/base/switch', () => ({ - __esModule: true, - default: (props: { +vi.mock('@langgenius/dify-ui/switch', () => ({ + Switch: (props: { checked: boolean onCheckedChange: (value: boolean) => void }) => ( diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-item.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-item.tsx index 8d370266b0..604736b2a9 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-item.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-item.tsx @@ -1,10 +1,10 @@ import type { Recipient as RecipientItem } from '../../../types' import type { Member } from '@/models/common' +import { Avatar } from '@langgenius/dify-ui/avatar' import { cn } from '@langgenius/dify-ui/cn' import { RiCloseCircleFill, RiErrorWarningFill } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Avatar } from '@/app/components/base/ui/avatar' type Props = { email: string diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx index 36483d33d6..42bd6df171 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx @@ -1,10 +1,10 @@ import type { RecipientData, Recipient as RecipientItem } from '../../../types' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { RiGroupLine } from '@remixicon/react' import { produce } from 'immer' import { memo } from 'react' import { useTranslation } from 'react-i18next' -import Switch from '@/app/components/base/switch' import { useAppContext } from '@/context/app-context' import { useMembers } from '@/service/use-common' import EmailInput from './email-input' diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx index c80c22639e..0e262e839e 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx @@ -2,11 +2,11 @@ import type { FC } from 'react' import type { Recipient } from '@/app/components/workflow/nodes/human-input/types' import type { Member } from '@/models/common' +import { Avatar } from '@langgenius/dify-ui/avatar' import { cn } from '@langgenius/dify-ui/cn' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Avatar } from '@/app/components/base/ui/avatar' const i18nPrefix = 'nodes.humanInput' diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx index 827e02c8bb..c2df6afb15 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx @@ -2,6 +2,7 @@ import type { FC } from 'react' import type { Recipient } from '@/app/components/workflow/nodes/human-input/types' import type { Member } from '@/models/common' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiContactsBookLine, @@ -9,7 +10,6 @@ import { import { useState } from 'react' import { useTranslation } from 'react-i18next' import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigger } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import MemberList from './member-list' const i18nPrefix = 'nodes.humanInput' 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 cef6d1380d..9ad52fa13e 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 @@ -4,6 +4,7 @@ import type { NodeOutPutVar, ValueSelector, } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowRightSFill, RiCloseLine } from '@remixicon/react' import { noop, unionBy } from 'es-toolkit/compat' @@ -13,7 +14,6 @@ import { useStore as useAppStore } from '@/app/components/app/store' import Divider from '@/app/components/base/divider' import Modal from '@/app/components/base/modal' import { getInputVars as doGetInputVars } from '@/app/components/base/prompt-editor/constants' -import { Button } from '@/app/components/base/ui/button' import FormItem from '@/app/components/workflow/nodes/_base/components/before-run-form/form-item' import { getNodeInfoById, diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx index c7b46732d0..060ec2428c 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx @@ -1,3 +1,4 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiMailSendFill, @@ -7,7 +8,6 @@ import { useTranslation } from 'react-i18next' import { SparklesSoft } from '@/app/components/base/icons/src/public/common' import Modal from '@/app/components/base/modal' import PremiumBadge from '@/app/components/base/premium-badge' -import { Button } from '@/app/components/base/ui/button' import { useModalContextSelector } from '@/context/modal-context' type UpgradeModalProps = { diff --git a/web/app/components/workflow/nodes/human-input/components/form-content-preview.tsx b/web/app/components/workflow/nodes/human-input/components/form-content-preview.tsx index 1364941edf..73e8850789 100644 --- a/web/app/components/workflow/nodes/human-input/components/form-content-preview.tsx +++ b/web/app/components/workflow/nodes/human-input/components/form-content-preview.tsx @@ -1,14 +1,14 @@ 'use client' +import type { ButtonProps } from '@langgenius/dify-ui/button' import type { FC } from 'react' import type { FormInputItem, UserAction } from '../types' -import type { ButtonProps } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' import Badge from '@/app/components/base/badge' import { getButtonStyle } from '@/app/components/base/chat/chat/answer/human-input-content/utils' import { Markdown } from '@/app/components/base/markdown' -import { Button } from '@/app/components/base/ui/button' import { useStore } from '@/app/components/workflow/store' import useNodes from '@/app/components/workflow/store/workflow/use-nodes' import { Note, rehypeNotes, rehypeVariable, Variable } from './variable-in-markdown' diff --git a/web/app/components/workflow/nodes/human-input/components/single-run-form.tsx b/web/app/components/workflow/nodes/human-input/components/single-run-form.tsx index dc735830c6..6226b6c06f 100644 --- a/web/app/components/workflow/nodes/human-input/components/single-run-form.tsx +++ b/web/app/components/workflow/nodes/human-input/components/single-run-form.tsx @@ -1,15 +1,15 @@ 'use client' -import type { ButtonProps } from '@/app/components/base/ui/button' +import type { ButtonProps } from '@langgenius/dify-ui/button' import type { UserAction } from '@/app/components/workflow/nodes/human-input/types' import type { HumanInputFormData } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import { RiArrowLeftLine } from '@remixicon/react' -import * as React from 'react' +import * as React from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import ContentItem from '@/app/components/base/chat/chat/answer/human-input-content/content-item' import { getButtonStyle, initializeInputs, splitByOutputVar } from '@/app/components/base/chat/chat/answer/human-input-content/utils' -import { Button } from '@/app/components/base/ui/button' type Props = { nodeName: string diff --git a/web/app/components/workflow/nodes/human-input/components/user-action.tsx b/web/app/components/workflow/nodes/human-input/components/user-action.tsx index 6ef5609a64..a83ea4f8f2 100644 --- a/web/app/components/workflow/nodes/human-input/components/user-action.tsx +++ b/web/app/components/workflow/nodes/human-input/components/user-action.tsx @@ -1,13 +1,13 @@ import type { FC } from 'react' import type { UserAction } from '../types' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiDeleteBinLine, } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import ButtonStyleDropdown from './button-style-dropdown' const i18nPrefix = 'nodes.humanInput' diff --git a/web/app/components/workflow/nodes/human-input/panel.tsx b/web/app/components/workflow/nodes/human-input/panel.tsx index 846b135fcf..b7b65e7de8 100644 --- a/web/app/components/workflow/nodes/human-input/panel.tsx +++ b/web/app/components/workflow/nodes/human-input/panel.tsx @@ -1,7 +1,9 @@ import type { FC } from 'react' import type { HumanInputNodeType } from './types' import type { NodePanelProps, Var } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiAddLine, RiClipboardLine, @@ -17,8 +19,6 @@ import { useTranslation } from 'react-i18next' import ActionButton from '@/app/components/base/action-button' import Divider from '@/app/components/base/divider' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' import Split from '@/app/components/workflow/nodes/_base/components/split' import useAvailableVarList from '@/app/components/workflow/nodes/_base/hooks/use-available-var-list' diff --git a/web/app/components/workflow/nodes/if-else/components/condition-add.tsx b/web/app/components/workflow/nodes/if-else/components/condition-add.tsx index 3b6d729078..85a45ac5c7 100644 --- a/web/app/components/workflow/nodes/if-else/components/condition-add.tsx +++ b/web/app/components/workflow/nodes/if-else/components/condition-add.tsx @@ -4,6 +4,7 @@ import type { ValueSelector, Var, } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' import { RiAddLine } from '@remixicon/react' import { useCallback, @@ -15,7 +16,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import VarReferenceVars from '@/app/components/workflow/nodes/_base/components/variable/var-reference-vars' type ConditionAddProps = { diff --git a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-operator.tsx b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-operator.tsx index 998cc48205..83dc97f088 100644 --- a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-operator.tsx +++ b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-operator.tsx @@ -1,5 +1,6 @@ import type { ComparisonOperator } from '../../types' import type { VarType } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowDownSLine } from '@remixicon/react' import { @@ -12,7 +13,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import { getOperators, isComparisonOperatorNeedTranslate } from '../../utils' const i18nPrefix = 'nodes.ifElse' diff --git a/web/app/components/workflow/nodes/if-else/components/condition-number-input.tsx b/web/app/components/workflow/nodes/if-else/components/condition-number-input.tsx index 7bcb4137b5..954f713a78 100644 --- a/web/app/components/workflow/nodes/if-else/components/condition-number-input.tsx +++ b/web/app/components/workflow/nodes/if-else/components/condition-number-input.tsx @@ -2,6 +2,7 @@ import type { NodeOutPutVar, ValueSelector, } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowDownSLine } from '@remixicon/react' import { useBoolean } from 'ahooks' @@ -18,7 +19,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import VarReferenceVars from '@/app/components/workflow/nodes/_base/components/variable/var-reference-vars' import { VarType } from '@/app/components/workflow/types' import { variableTransformer } from '@/app/components/workflow/utils' diff --git a/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx b/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx index 1744ee6490..92d70b37b1 100644 --- a/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx +++ b/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx @@ -2,6 +2,7 @@ import type { FC } from 'react' import type { Node, NodeOutPutVar, Var } from '../../../types' import type { CaseItem, HandleAddCondition, HandleAddSubVariableCondition, HandleRemoveCondition, handleRemoveSubVariableCondition, HandleToggleConditionLogicalOperator, HandleToggleSubVariableConditionLogicalOperator, HandleUpdateCondition, HandleUpdateSubVariableCondition } from '../types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiAddLine, @@ -14,7 +15,6 @@ import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import { ReactSortable } from 'react-sortablejs' import { PortalSelect as Select } from '@/app/components/base/select' -import { Button } from '@/app/components/base/ui/button' import { VarType } from '../../../types' import { SUB_VARIABLES } from '../../constants' import { useGetAvailableVars } from '../../variable-assigner/hooks' diff --git a/web/app/components/workflow/nodes/if-else/panel.tsx b/web/app/components/workflow/nodes/if-else/panel.tsx index e8dae6fad9..221b00d1f7 100644 --- a/web/app/components/workflow/nodes/if-else/panel.tsx +++ b/web/app/components/workflow/nodes/if-else/panel.tsx @@ -1,6 +1,7 @@ import type { FC } from 'react' import type { IfElseNodeType } from './types' import type { NodePanelProps } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' import { RiAddLine, } from '@remixicon/react' @@ -8,7 +9,6 @@ import { memo, } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import Field from '@/app/components/workflow/nodes/_base/components/field' import ConditionWrap from './components/condition-wrap' import useConfig from './use-config' diff --git a/web/app/components/workflow/nodes/iteration/__tests__/integration.spec.tsx b/web/app/components/workflow/nodes/iteration/__tests__/integration.spec.tsx index dc7538144e..26b938bf6e 100644 --- a/web/app/components/workflow/nodes/iteration/__tests__/integration.spec.tsx +++ b/web/app/components/workflow/nodes/iteration/__tests__/integration.spec.tsx @@ -1,9 +1,9 @@ import type { ReactNode } from 'react' import type { IterationNodeType } from '../types' import type { PanelProps } from '@/types/workflow' +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { toast } from '@/app/components/base/ui/toast' import { ErrorHandleMode } from '@/app/components/workflow/types' import { BlockEnum, VarType } from '../../../types' import AddBlock from '../add-block' @@ -15,7 +15,7 @@ const mockHandleNodeAdd = vi.fn() const mockHandleNodeIterationRerender = vi.fn() let mockNodesReadOnly = false -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/nodes/iteration/node.tsx b/web/app/components/workflow/nodes/iteration/node.tsx index ad9cb3b0fe..a3aee372d7 100644 --- a/web/app/components/workflow/nodes/iteration/node.tsx +++ b/web/app/components/workflow/nodes/iteration/node.tsx @@ -2,6 +2,7 @@ import type { FC } from 'react' import type { IterationNodeType } from './types' import type { NodeProps } from '@/app/components/workflow/types' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { memo, useEffect, @@ -13,7 +14,6 @@ import { useNodesInitialized, useViewport, } from 'reactflow' -import { toast } from '@/app/components/base/ui/toast' import { IterationStartNodeDumb } from '../iteration-start' import AddBlock from './add-block' import { useNodeIterationInteractions } from './use-interactions' diff --git a/web/app/components/workflow/nodes/iteration/panel.tsx b/web/app/components/workflow/nodes/iteration/panel.tsx index 7128c2d4b4..c9ed2de363 100644 --- a/web/app/components/workflow/nodes/iteration/panel.tsx +++ b/web/app/components/workflow/nodes/iteration/panel.tsx @@ -1,12 +1,12 @@ import type { FC } from 'react' import type { IterationNodeType } from './types' import type { NodePanelProps } from '@/app/components/workflow/types' +import { Slider } from '@langgenius/dify-ui/slider' +import { Switch } from '@langgenius/dify-ui/switch' import * as React from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' import Select from '@/app/components/base/select' -import Switch from '@/app/components/base/switch' -import { Slider } from '@/app/components/base/ui/slider' import Field from '@/app/components/workflow/nodes/_base/components/field' import { ErrorHandleMode } from '@/app/components/workflow/types' import { MAX_PARALLEL_LIMIT } from '@/config' diff --git a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx index a7bba6879e..0920e8a8a7 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx @@ -1,7 +1,7 @@ import type { ChunkStructureEnum } from '../../types' +import { Button } from '@langgenius/dify-ui/button' import { memo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import { Field } from '@/app/components/workflow/nodes/_base/components/layout' import OptionCard from '../option-card' import { useChunkStructure } from './hooks' diff --git a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/selector.tsx b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/selector.tsx index 5018bbc784..7ab8de508f 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/selector.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/selector.tsx @@ -1,6 +1,7 @@ import type { ReactNode } from 'react' import type { ChunkStructureEnum } from '../../types' import type { Option } from './type' +import { Button } from '@langgenius/dify-ui/button' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import { @@ -8,7 +9,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import OptionCard from '../option-card' type SelectorProps = { diff --git a/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx b/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx index 12cc0f1eb5..70ff0e47eb 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx @@ -1,4 +1,5 @@ import { cn } from '@langgenius/dify-ui/cn' +import { Slider } from '@langgenius/dify-ui/slider' import { RiQuestionLine } from '@remixicon/react' import { memo, @@ -11,7 +12,6 @@ import { } from '@/app/components/base/icons/src/vender/knowledge' import Input from '@/app/components/base/input' import Tooltip from '@/app/components/base/tooltip' -import { Slider } from '@/app/components/base/ui/slider' import { Field } from '@/app/components/workflow/nodes/_base/components/layout' import { ChunkStructureEnum, diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx index fe1d863944..a1f601cce9 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx @@ -8,6 +8,7 @@ import type { Option, } from './type' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { memo, useCallback, @@ -16,7 +17,6 @@ import { import { useTranslation } from 'react-i18next' import WeightedScoreComponent from '@/app/components/app/configuration/dataset-config/params-config/weighted-score' import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback' -import Switch from '@/app/components/base/switch' import Tooltip from '@/app/components/base/tooltip' import { DEFAULT_WEIGHTED_SCORE } from '@/models/datasets' import { diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx index 5136d4897f..814b3cea6d 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx @@ -1,7 +1,3 @@ -import { memo, useCallback } from 'react' -import { useTranslation } from 'react-i18next' -import Switch from '@/app/components/base/switch' -import Tooltip from '@/app/components/base/tooltip' import { NumberField, NumberFieldControls, @@ -9,7 +5,11 @@ import { NumberFieldGroup, NumberFieldIncrement, NumberFieldInput, -} from '@/app/components/base/ui/number-field' +} from '@langgenius/dify-ui/number-field' +import { Switch } from '@langgenius/dify-ui/switch' +import { memo, useCallback } from 'react' +import { useTranslation } from 'react-i18next' +import Tooltip from '@/app/components/base/tooltip' import { env } from '@/env' export type TopKAndScoreThresholdProps = { diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/add-condition.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/add-condition.tsx index e94caf7b30..ea7870431a 100644 --- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/add-condition.tsx +++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/add-condition.tsx @@ -1,5 +1,6 @@ import type { MetadataShape } from '@/app/components/workflow/nodes/knowledge-retrieval/types' import type { MetadataInDoc } from '@/models/datasets' +import { Button } from '@langgenius/dify-ui/button' import { RiAddLine, } from '@remixicon/react' @@ -15,7 +16,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import MetadataIcon from './metadata-icon' const AddCondition = ({ diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-operator.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-operator.tsx index d6828a5392..f14743ce9f 100644 --- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-operator.tsx +++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-operator.tsx @@ -2,6 +2,7 @@ import type { ComparisonOperator, MetadataFilteringVariableType, } from '@/app/components/workflow/nodes/knowledge-retrieval/types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowDownSLine } from '@remixicon/react' import { @@ -14,7 +15,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import { getOperators, isComparisonOperatorNeedTranslate, diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-value-method.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-value-method.tsx index b69bd05cdd..12d7c9cc69 100644 --- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-value-method.tsx +++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-value-method.tsx @@ -1,3 +1,4 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowDownSLine } from '@remixicon/react' import { capitalize } from 'es-toolkit/string' @@ -7,7 +8,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' export type ConditionValueMethodProps = { valueMethod?: string diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/metadata-filter-selector.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/metadata-filter-selector.tsx index 67939a6448..396fd069e7 100644 --- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/metadata-filter-selector.tsx +++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/metadata-filter-selector.tsx @@ -1,3 +1,4 @@ +import { Button } from '@langgenius/dify-ui/button' import { RiArrowDownSLine, RiCheckLine, @@ -9,7 +10,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import { MetadataFilteringModeEnum } from '@/app/components/workflow/nodes/knowledge-retrieval/types' type MetadataFilterSelectorProps = { diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx index 1553da1e1f..dd530ae679 100644 --- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx +++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx @@ -1,4 +1,5 @@ import type { MetadataShape } from '@/app/components/workflow/nodes/knowledge-retrieval/types' +import { Button } from '@langgenius/dify-ui/button' import { RiFilter3Line } from '@remixicon/react' import { useEffect, @@ -10,7 +11,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import MetadataPanel from './metadata-panel' const MetadataTrigger = ({ diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx index 3f8198a822..da71682b35 100644 --- a/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx +++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx @@ -5,6 +5,7 @@ import type { MultipleRetrievalConfig, SingleRetrievalConfig } from '../types' import type { ModelParameterModalProps } from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' import type { DataSet } from '@/models/datasets' import type { DatasetConfigs } from '@/models/debug' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiEqualizer2Line } from '@remixicon/react' import * as React from 'react' @@ -16,7 +17,6 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { Button } from '@/app/components/base/ui/button' import { DATASET_DEFAULT } from '@/config' import { RETRIEVE_TYPE } from '@/types/app' diff --git a/web/app/components/workflow/nodes/list-operator/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/list-operator/__tests__/panel.spec.tsx index 9e5147bc92..945ca70104 100644 --- a/web/app/components/workflow/nodes/list-operator/__tests__/panel.spec.tsx +++ b/web/app/components/workflow/nodes/list-operator/__tests__/panel.spec.tsx @@ -22,9 +22,8 @@ vi.mock('../use-config', () => ({ default: (...args: unknown[]) => mockUseConfig(...args), })) -vi.mock('@/app/components/base/switch', () => ({ - __esModule: true, - default: (props: { +vi.mock('@langgenius/dify-ui/switch', () => ({ + Switch: (props: { checked?: boolean disabled?: boolean onCheckedChange: (value: boolean) => void diff --git a/web/app/components/workflow/nodes/list-operator/components/__tests__/limit-config.spec.tsx b/web/app/components/workflow/nodes/list-operator/components/__tests__/limit-config.spec.tsx index fbc3356b32..1314b4600b 100644 --- a/web/app/components/workflow/nodes/list-operator/components/__tests__/limit-config.spec.tsx +++ b/web/app/components/workflow/nodes/list-operator/components/__tests__/limit-config.spec.tsx @@ -19,8 +19,8 @@ type MockSliderProps = { const mockSwitch = vi.fn<(props: MockSwitchProps) => void>() const mockSlider = vi.fn<(props: MockSliderProps) => void>() -vi.mock('@/app/components/base/switch', () => ({ - default: (props: MockSwitchProps) => { +vi.mock('@langgenius/dify-ui/switch', () => ({ + Switch: (props: MockSwitchProps) => { mockSwitch(props) return ( diff --git a/web/app/components/workflow/panel/comments-panel/index.tsx b/web/app/components/workflow/panel/comments-panel/index.tsx index 21b3c3c4e6..05480abb2b 100644 --- a/web/app/components/workflow/panel/comments-panel/index.tsx +++ b/web/app/components/workflow/panel/comments-panel/index.tsx @@ -1,10 +1,10 @@ import type { WorkflowCommentList } from '@/service/workflow-comment' import { cn } from '@langgenius/dify-ui/cn' +import { Switch } from '@langgenius/dify-ui/switch' import { RiCheckboxCircleFill, RiCheckboxCircleLine, RiCheckLine, RiCloseLine, RiFilter3Line } from '@remixicon/react' import { memo, useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import Divider from '@/app/components/base/divider' -import Switch from '@/app/components/base/switch' import { UserAvatarList } from '@/app/components/base/user-avatar-list' import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager' import { useWorkflowComment } from '@/app/components/workflow/hooks/use-workflow-comment' diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks.spec.ts index 425dd90e87..9a2b8a8df7 100644 --- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks.spec.ts +++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks.spec.ts @@ -26,7 +26,7 @@ vi.mock('@/service/workflow', () => ({ submitHumanInputForm: (...args: unknown[]) => mockSubmitHumanInputForm(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-resume.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-resume.spec.ts index 04c19f50e9..5a608dcc5b 100644 --- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-resume.spec.ts +++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-resume.spec.ts @@ -27,7 +27,7 @@ vi.mock('@/service/workflow', () => ({ submitHumanInputForm: (...args: any[]) => mockSubmitHumanInputForm(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-send.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-send.spec.ts index 0f6ae5d713..fb045c4723 100644 --- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-send.spec.ts +++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-send.spec.ts @@ -26,7 +26,7 @@ vi.mock('@/service/workflow', () => ({ submitHumanInputForm: (...args: any[]) => mockSubmitHumanInputForm(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-stop-restart.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-stop-restart.spec.ts index d0b1908606..2868471bd3 100644 --- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-stop-restart.spec.ts +++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-stop-restart.spec.ts @@ -27,7 +27,7 @@ vi.mock('@/service/workflow', () => ({ submitHumanInputForm: (...args: any[]) => mockSubmitHumanInputForm(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/misc.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/misc.spec.ts index 549fe08e05..cd2eaa0e00 100644 --- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/misc.spec.ts +++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/misc.spec.ts @@ -27,7 +27,7 @@ vi.mock('@/service/workflow', () => ({ submitHumanInputForm: (...args: any[]) => mockSubmitHumanInputForm(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts index 57db5502b5..cb45029340 100644 --- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts +++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts @@ -27,7 +27,7 @@ vi.mock('@/service/workflow', () => ({ submitHumanInputForm: (...args: any[]) => mockSubmitHumanInputForm(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/sse-callbacks.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/sse-callbacks.spec.ts index 03857ce3d6..f8f3a02c5c 100644 --- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/sse-callbacks.spec.ts +++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/sse-callbacks.spec.ts @@ -26,7 +26,7 @@ vi.mock('@/service/workflow', () => ({ submitHumanInputForm: (...args: any[]) => mockSubmitHumanInputForm(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/panel/debug-and-preview/hooks.ts b/web/app/components/workflow/panel/debug-and-preview/hooks.ts index 6eef69bfdb..a94e4c1edd 100644 --- a/web/app/components/workflow/panel/debug-and-preview/hooks.ts +++ b/web/app/components/workflow/panel/debug-and-preview/hooks.ts @@ -6,6 +6,7 @@ import type { } from '@/app/components/base/chat/types' import type { FileEntity } from '@/app/components/base/file-uploader/types' import type { IOtherOptions } from '@/service/base' +import { toast } from '@langgenius/dify-ui/toast' import { uniqBy } from 'es-toolkit/compat' import { produce, setAutoFreeze } from 'immer' import { @@ -26,7 +27,6 @@ import { getProcessedFiles, getProcessedFilesFromResponse, } from '@/app/components/base/file-uploader/utils' -import { toast } from '@/app/components/base/ui/toast' import { CUSTOM_NODE, } from '@/app/components/workflow/constants' diff --git a/web/app/components/workflow/panel/env-panel/__tests__/variable-modal.spec.tsx b/web/app/components/workflow/panel/env-panel/__tests__/variable-modal.spec.tsx index 7e97ef62dc..258784b692 100644 --- a/web/app/components/workflow/panel/env-panel/__tests__/variable-modal.spec.tsx +++ b/web/app/components/workflow/panel/env-panel/__tests__/variable-modal.spec.tsx @@ -1,14 +1,14 @@ import type { ReactElement } from 'react' import type { Shape } from '@/app/components/workflow/store/workflow' import type { EnvironmentVariable } from '@/app/components/workflow/types' +import { toast } from '@langgenius/dify-ui/toast' import { fireEvent, render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { toast } from '@/app/components/base/ui/toast' import { WorkflowContext } from '@/app/components/workflow/context' import { createWorkflowStore } from '@/app/components/workflow/store/workflow' import VariableModal from '../variable-modal' -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/panel/env-panel/variable-modal.tsx b/web/app/components/workflow/panel/env-panel/variable-modal.tsx index e824dd9f08..267c014e1d 100644 --- a/web/app/components/workflow/panel/env-panel/variable-modal.tsx +++ b/web/app/components/workflow/panel/env-panel/variable-modal.tsx @@ -1,5 +1,7 @@ import type { EnvironmentVariable } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiCloseLine } from '@remixicon/react' import * as React from 'react' import { useEffect } from 'react' @@ -7,8 +9,6 @@ import { useTranslation } from 'react-i18next' import { v4 as uuid4 } from 'uuid' import Input from '@/app/components/base/input' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { useWorkflowStore } from '@/app/components/workflow/store' import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var' diff --git a/web/app/components/workflow/panel/env-panel/variable-trigger.tsx b/web/app/components/workflow/panel/env-panel/variable-trigger.tsx index e075238e48..378fc1c1b5 100644 --- a/web/app/components/workflow/panel/env-panel/variable-trigger.tsx +++ b/web/app/components/workflow/panel/env-panel/variable-trigger.tsx @@ -1,10 +1,10 @@ 'use client' import type { EnvironmentVariable } from '@/app/components/workflow/types' +import { Button } from '@langgenius/dify-ui/button' +import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover' import { RiAddLine } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' -import { Popover, PopoverContent, PopoverTrigger } from '@/app/components/base/ui/popover' import VariableModal from '@/app/components/workflow/panel/env-panel/variable-modal' type Props = { diff --git a/web/app/components/workflow/panel/inputs-panel.tsx b/web/app/components/workflow/panel/inputs-panel.tsx index 4e6255a2c0..10004236dd 100644 --- a/web/app/components/workflow/panel/inputs-panel.tsx +++ b/web/app/components/workflow/panel/inputs-panel.tsx @@ -1,4 +1,5 @@ import type { StartNodeType } from '../nodes/start/types' +import { Button } from '@langgenius/dify-ui/button' import { memo, useCallback, @@ -10,7 +11,6 @@ import { useCheckInputsForms } from '@/app/components/base/chat/chat/check-input import { getProcessedInputs, } from '@/app/components/base/chat/chat/utils' -import { Button } from '@/app/components/base/ui/button' import { TransferMethod } from '../../base/text-generation/types' import { useWorkflowRun } from '../hooks' import { useHooksStore } from '../hooks-store' diff --git a/web/app/components/workflow/panel/version-history-panel/context-menu/__tests__/menu-item.spec.tsx b/web/app/components/workflow/panel/version-history-panel/context-menu/__tests__/menu-item.spec.tsx index 844e189067..7dfc362a90 100644 --- a/web/app/components/workflow/panel/version-history-panel/context-menu/__tests__/menu-item.spec.tsx +++ b/web/app/components/workflow/panel/version-history-panel/context-menu/__tests__/menu-item.spec.tsx @@ -1,6 +1,6 @@ +import { DropdownMenu, DropdownMenuContent } from '@langgenius/dify-ui/dropdown-menu' import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { DropdownMenu, DropdownMenuContent } from '@/app/components/base/ui/dropdown-menu' import { VersionHistoryContextMenuOptions } from '../../../../types' import MenuItem from '../menu-item' diff --git a/web/app/components/workflow/panel/version-history-panel/context-menu/index.tsx b/web/app/components/workflow/panel/version-history-panel/context-menu/index.tsx index f063902753..1b90166f65 100644 --- a/web/app/components/workflow/panel/version-history-panel/context-menu/index.tsx +++ b/web/app/components/workflow/panel/version-history-panel/context-menu/index.tsx @@ -1,13 +1,13 @@ import type { FC } from 'react' -import { RiMoreFill } from '@remixicon/react' -import * as React from 'react' -import { Button } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { DropdownMenu, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' +} from '@langgenius/dify-ui/dropdown-menu' +import { RiMoreFill } from '@remixicon/react' +import * as React from 'react' import { VersionHistoryContextMenuOptions } from '../../../types' import MenuItem from './menu-item' import useContextMenu from './use-context-menu' diff --git a/web/app/components/workflow/panel/version-history-panel/context-menu/menu-item.tsx b/web/app/components/workflow/panel/version-history-panel/context-menu/menu-item.tsx index b1d9ef6ec5..0c0096ab25 100644 --- a/web/app/components/workflow/panel/version-history-panel/context-menu/menu-item.tsx +++ b/web/app/components/workflow/panel/version-history-panel/context-menu/menu-item.tsx @@ -1,8 +1,8 @@ import type { FC } from 'react' import type { VersionHistoryContextMenuOptions } from '../../../types' import { cn } from '@langgenius/dify-ui/cn' +import { DropdownMenuItem } from '@langgenius/dify-ui/dropdown-menu' import * as React from 'react' -import { DropdownMenuItem } from '@/app/components/base/ui/dropdown-menu' type MenuItemProps = { item: { diff --git a/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx b/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx index 4779be8984..1f7948c41b 100644 --- a/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx +++ b/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx @@ -1,9 +1,9 @@ import type { FC } from 'react' import type { VersionHistory } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' type DeleteConfirmModalProps = { isOpen: boolean diff --git a/web/app/components/workflow/panel/version-history-panel/empty.tsx b/web/app/components/workflow/panel/version-history-panel/empty.tsx index 2c8f6655e1..21751234d7 100644 --- a/web/app/components/workflow/panel/version-history-panel/empty.tsx +++ b/web/app/components/workflow/panel/version-history-panel/empty.tsx @@ -1,8 +1,8 @@ import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' import { RiHistoryLine } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' type EmptyProps = { onResetFilter: () => void diff --git a/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx b/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx index 1df519d0f3..587dc43bdf 100644 --- a/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx +++ b/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx @@ -1,7 +1,7 @@ import type { FC } from 'react' +import { Switch } from '@langgenius/dify-ui/switch' import * as React from 'react' import { useTranslation } from 'react-i18next' -import Switch from '@/app/components/base/switch' type FilterSwitchProps = { enabled: boolean diff --git a/web/app/components/workflow/panel/version-history-panel/index.tsx b/web/app/components/workflow/panel/version-history-panel/index.tsx index 10dd0e794a..eb1f5c962e 100644 --- a/web/app/components/workflow/panel/version-history-panel/index.tsx +++ b/web/app/components/workflow/panel/version-history-panel/index.tsx @@ -1,5 +1,6 @@ 'use client' import type { VersionHistory } from '@/types/workflow' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowDownDoubleLine, RiCloseLine, RiLoader2Line } from '@remixicon/react' import copy from 'copy-to-clipboard' import * as React from 'react' @@ -7,7 +8,6 @@ import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import VersionInfoModal from '@/app/components/app/app-publisher/version-info-modal' import Divider from '@/app/components/base/divider' -import { toast } from '@/app/components/base/ui/toast' import { useSelector as useAppContextSelector } from '@/context/app-context' import { useDeleteWorkflow, useInvalidAllLastRun, useResetWorkflowVersionHistory, useRestoreWorkflow, useUpdateWorkflow, useWorkflowVersionHistory } from '@/service/use-workflow' import { useDSL, useWorkflowRefreshDraft, useWorkflowRun } from '../../hooks' diff --git a/web/app/components/workflow/panel/version-history-panel/restore-confirm-modal.tsx b/web/app/components/workflow/panel/version-history-panel/restore-confirm-modal.tsx index 695e6fe35c..9fc2c25742 100644 --- a/web/app/components/workflow/panel/version-history-panel/restore-confirm-modal.tsx +++ b/web/app/components/workflow/panel/version-history-panel/restore-confirm-modal.tsx @@ -1,9 +1,9 @@ import type { FC } from 'react' import type { VersionHistory } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import * as React from 'react' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' type RestoreConfirmModalProps = { isOpen: boolean diff --git a/web/app/components/workflow/panel/workflow-preview.tsx b/web/app/components/workflow/panel/workflow-preview.tsx index e28c494b20..89ae09c374 100644 --- a/web/app/components/workflow/panel/workflow-preview.tsx +++ b/web/app/components/workflow/panel/workflow-preview.tsx @@ -1,4 +1,6 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import copy from 'copy-to-clipboard' import { memo, @@ -8,8 +10,6 @@ import { } from 'react' import { useTranslation } from 'react-i18next' import Loading from '@/app/components/base/loading' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { submitHumanInputForm } from '@/service/workflow' import { useWorkflowInteractions, diff --git a/web/app/components/workflow/run/__tests__/index.spec.tsx b/web/app/components/workflow/run/__tests__/index.spec.tsx index 87937dfb4f..39f26df97e 100644 --- a/web/app/components/workflow/run/__tests__/index.spec.tsx +++ b/web/app/components/workflow/run/__tests__/index.spec.tsx @@ -22,7 +22,7 @@ vi.mock('@/service/log', () => ({ fetchTracingList: (...args: unknown[]) => mockFetchTracingList(...args), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { error: (...args: unknown[]) => mockToastError(...args), }, diff --git a/web/app/components/workflow/run/agent-log/__tests__/agent-log-nav-more.spec.tsx b/web/app/components/workflow/run/agent-log/__tests__/agent-log-nav-more.spec.tsx index 35b32a5ce6..e283740613 100644 --- a/web/app/components/workflow/run/agent-log/__tests__/agent-log-nav-more.spec.tsx +++ b/web/app/components/workflow/run/agent-log/__tests__/agent-log-nav-more.spec.tsx @@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import AgentLogNavMore from '../agent-log-nav-more' -vi.mock('@/app/components/base/ui/dropdown-menu', async () => { +vi.mock('@langgenius/dify-ui/dropdown-menu', async () => { const React = await import('react') const DropdownMenuContext = React.createContext<{ open: boolean, setOpen: (open: boolean) => void } | null>(null) diff --git a/web/app/components/workflow/run/agent-log/agent-log-item.tsx b/web/app/components/workflow/run/agent-log/agent-log-item.tsx index e1714c5f35..67da9c7aa9 100644 --- a/web/app/components/workflow/run/agent-log/agent-log-item.tsx +++ b/web/app/components/workflow/run/agent-log/agent-log-item.tsx @@ -1,4 +1,5 @@ import type { AgentLogItemWithChildren } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { RiArrowRightSLine, @@ -8,7 +9,6 @@ import { useMemo, useState, } from 'react' -import { Button } from '@/app/components/base/ui/button' import useGetIcon from '@/app/components/plugins/install-plugin/base/use-get-icon' import BlockIcon from '@/app/components/workflow/block-icon' import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' diff --git a/web/app/components/workflow/run/agent-log/agent-log-nav-more.tsx b/web/app/components/workflow/run/agent-log/agent-log-nav-more.tsx index 77f3c778a6..5c8d100012 100644 --- a/web/app/components/workflow/run/agent-log/agent-log-nav-more.tsx +++ b/web/app/components/workflow/run/agent-log/agent-log-nav-more.tsx @@ -1,13 +1,13 @@ import type { AgentLogItemWithChildren } from '@/types/workflow' -import { RiMoreLine } from '@remixicon/react' -import { useState } from 'react' -import { Button } from '@/app/components/base/ui/button' +import { Button } from '@langgenius/dify-ui/button' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' +} from '@langgenius/dify-ui/dropdown-menu' +import { RiMoreLine } from '@remixicon/react' +import { useState } from 'react' type AgentLogNavMoreProps = { options: AgentLogItemWithChildren[] diff --git a/web/app/components/workflow/run/agent-log/agent-log-nav.tsx b/web/app/components/workflow/run/agent-log/agent-log-nav.tsx index 2548256cb1..7996595186 100644 --- a/web/app/components/workflow/run/agent-log/agent-log-nav.tsx +++ b/web/app/components/workflow/run/agent-log/agent-log-nav.tsx @@ -1,7 +1,7 @@ import type { AgentLogItemWithChildren } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import { RiArrowLeftLine } from '@remixicon/react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import AgentLogNavMore from './agent-log-nav-more' type AgentLogNavProps = { diff --git a/web/app/components/workflow/run/index.tsx b/web/app/components/workflow/run/index.tsx index bd71b662f5..d066690120 100644 --- a/web/app/components/workflow/run/index.tsx +++ b/web/app/components/workflow/run/index.tsx @@ -3,10 +3,10 @@ import type { FC } from 'react' import type { WorkflowRunDetailResponse } from '@/models/log' import type { NodeTracing } from '@/types/workflow' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import Loading from '@/app/components/base/loading' -import { toast } from '@/app/components/base/ui/toast' import { WorkflowRunningStatus } from '@/app/components/workflow/types' import { fetchRunDetail, fetchTracingList } from '@/service/log' import { useStore } from '../store' diff --git a/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx b/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx index 77b9425501..8fb857f344 100644 --- a/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx +++ b/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx @@ -2,10 +2,10 @@ import type { IterationDurationMap, NodeTracing, } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import { RiArrowRightSLine } from '@remixicon/react' import { useTranslation } from 'react-i18next' import { Iteration } from '@/app/components/base/icons/src/vender/workflow' -import { Button } from '@/app/components/base/ui/button' import { NodeRunningStatus } from '@/app/components/workflow/types' type IterationLogTriggerProps = { diff --git a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx index 42593e564f..277db8cef4 100644 --- a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx +++ b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx @@ -3,10 +3,10 @@ import type { LoopVariableMap, NodeTracing, } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import { RiArrowRightSLine } from '@remixicon/react' import { useTranslation } from 'react-i18next' import { Loop } from '@/app/components/base/icons/src/vender/workflow' -import { Button } from '@/app/components/base/ui/button' type LoopLogTriggerProps = { nodeInfo: NodeTracing diff --git a/web/app/components/workflow/run/retry-log/retry-log-trigger.tsx b/web/app/components/workflow/run/retry-log/retry-log-trigger.tsx index 592b7775f1..84c7808df1 100644 --- a/web/app/components/workflow/run/retry-log/retry-log-trigger.tsx +++ b/web/app/components/workflow/run/retry-log/retry-log-trigger.tsx @@ -1,10 +1,10 @@ import type { NodeTracing } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import { RiArrowRightSLine, RiRestartFill, } from '@remixicon/react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' type RetryLogTriggerProps = { nodeInfo: NodeTracing diff --git a/web/app/components/workflow/selection-contextmenu.tsx b/web/app/components/workflow/selection-contextmenu.tsx index c82f431ddf..26b5429df4 100644 --- a/web/app/components/workflow/selection-contextmenu.tsx +++ b/web/app/components/workflow/selection-contextmenu.tsx @@ -1,4 +1,12 @@ import type { Node } from './types' +import { + ContextMenu, + ContextMenuContent, + ContextMenuGroup, + ContextMenuItem, + ContextMenuLabel, + ContextMenuSeparator, +} from '@langgenius/dify-ui/context-menu' import { produce } from 'immer' import { memo, @@ -8,14 +16,6 @@ import { } from 'react' import { useTranslation } from 'react-i18next' import { useStore as useReactFlowStore } from 'reactflow' -import { - ContextMenu, - ContextMenuContent, - ContextMenuGroup, - ContextMenuItem, - ContextMenuLabel, - ContextMenuSeparator, -} from '@/app/components/base/ui/context-menu' import { useCollaborativeWorkflow } from '@/app/components/workflow/hooks/use-collaborative-workflow' import { useNodesInteractions, useNodesReadOnly, useNodesSyncDraft } from './hooks' import { useSelectionInteractions } from './hooks/use-selection-interactions' diff --git a/web/app/components/workflow/update-dsl-modal.tsx b/web/app/components/workflow/update-dsl-modal.tsx index 04d687ce73..cfa9c995eb 100644 --- a/web/app/components/workflow/update-dsl-modal.tsx +++ b/web/app/components/workflow/update-dsl-modal.tsx @@ -1,6 +1,8 @@ 'use client' import type { MouseEventHandler } from 'react' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiAlertFill, RiCloseLine, @@ -16,8 +18,6 @@ import { useTranslation } from 'react-i18next' import Uploader from '@/app/components/app/create-from-dsl-modal/uploader' import { useStore as useAppStore } from '@/app/components/app/store' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks' import { useEventEmitterContextContext } from '@/context/event-emitter' import { diff --git a/web/app/components/workflow/variable-inspect/__tests__/value-content-sections.spec.tsx b/web/app/components/workflow/variable-inspect/__tests__/value-content-sections.spec.tsx index 2ebe527104..bba17a7c32 100644 --- a/web/app/components/workflow/variable-inspect/__tests__/value-content-sections.spec.tsx +++ b/web/app/components/workflow/variable-inspect/__tests__/value-content-sections.spec.tsx @@ -18,7 +18,7 @@ const toastMocks = vi.hoisted(() => ({ promise: vi.fn(), })) -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: Object.assign(toastMocks.call, { success: vi.fn(), error: vi.fn(), diff --git a/web/app/components/workflow/variable-inspect/group.tsx b/web/app/components/workflow/variable-inspect/group.tsx index 7d94226786..24786e4b1f 100644 --- a/web/app/components/workflow/variable-inspect/group.tsx +++ b/web/app/components/workflow/variable-inspect/group.tsx @@ -10,7 +10,7 @@ import { } from '@remixicon/react' import { useState } from 'react' import { useTranslation } from 'react-i18next' -// import { Button } from '@/app/components/base/ui/button' +// import { Button } from '@langgenius/dify-ui/button' import ActionButton from '@/app/components/base/action-button' import Tooltip from '@/app/components/base/tooltip' import BlockIcon from '@/app/components/workflow/block-icon' diff --git a/web/app/components/workflow/variable-inspect/left.tsx b/web/app/components/workflow/variable-inspect/left.tsx index f3450cea13..6d590eb281 100644 --- a/web/app/components/workflow/variable-inspect/left.tsx +++ b/web/app/components/workflow/variable-inspect/left.tsx @@ -1,10 +1,10 @@ import type { currentVarType } from './panel' import type { VarInInspect } from '@/types/workflow' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' // import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import { VarInInspectType } from '@/types/workflow' import useCurrentVars from '../hooks/use-inspect-vars-crud' import { useNodesInteractions } from '../hooks/use-nodes-interactions' diff --git a/web/app/components/workflow/variable-inspect/listening.tsx b/web/app/components/workflow/variable-inspect/listening.tsx index 4559665ffa..3994355d58 100644 --- a/web/app/components/workflow/variable-inspect/listening.tsx +++ b/web/app/components/workflow/variable-inspect/listening.tsx @@ -3,13 +3,13 @@ import type { FC } from 'react' import type { Node } from 'reactflow' import type { ScheduleTriggerNodeType } from '@/app/components/workflow/nodes/trigger-schedule/types' import type { WebhookTriggerNodeType } from '@/app/components/workflow/nodes/trigger-webhook/types' +import { Button } from '@langgenius/dify-ui/button' import copy from 'copy-to-clipboard' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { useStoreApi } from 'reactflow' import { StopCircle } from '@/app/components/base/icons/src/vender/line/mediaAndDevices' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' import BlockIcon from '@/app/components/workflow/block-icon' import { useGetToolIcon } from '@/app/components/workflow/hooks/use-tool-icon' import { getNextExecutionTime } from '@/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator' diff --git a/web/app/components/workflow/workflow-preview/components/zoom-in-out.tsx b/web/app/components/workflow/workflow-preview/components/zoom-in-out.tsx index 3f714c5ca9..9ea32caec3 100644 --- a/web/app/components/workflow/workflow-preview/components/zoom-in-out.tsx +++ b/web/app/components/workflow/workflow-preview/components/zoom-in-out.tsx @@ -1,5 +1,12 @@ import type { FC } from 'react' import { cn } from '@langgenius/dify-ui/cn' +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from '@langgenius/dify-ui/dropdown-menu' import { Fragment, memo, @@ -10,13 +17,6 @@ import { useReactFlow, useViewport, } from 'reactflow' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from '@/app/components/base/ui/dropdown-menu' import TipPopup from '@/app/components/workflow/operator/tip-popup' import ShortcutsName from '@/app/components/workflow/shortcuts-name' diff --git a/web/app/education-apply/education-apply-page.tsx b/web/app/education-apply/education-apply-page.tsx index 7fda139aa9..93259c1ccb 100644 --- a/web/app/education-apply/education-apply-page.tsx +++ b/web/app/education-apply/education-apply-page.tsx @@ -1,5 +1,7 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiExternalLinkLine } from '@remixicon/react' import { noop } from 'es-toolkit/function' import { @@ -7,8 +9,6 @@ import { } from 'react' import { useTranslation } from 'react-i18next' import Checkbox from '@/app/components/base/checkbox' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { EDUCATION_VERIFYING_LOCALSTORAGE_ITEM } from '@/app/education-apply/constants' import { useDocLink } from '@/context/i18n' import { useProviderContext } from '@/context/provider-context' diff --git a/web/app/education-apply/expire-notice-modal.tsx b/web/app/education-apply/expire-notice-modal.tsx index ec88bba1b5..e54afaecde 100644 --- a/web/app/education-apply/expire-notice-modal.tsx +++ b/web/app/education-apply/expire-notice-modal.tsx @@ -1,9 +1,9 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { RiExternalLinkLine } from '@remixicon/react' import * as React from 'react' import { useTranslation } from 'react-i18next' import Modal from '@/app/components/base/modal' -import { Button } from '@/app/components/base/ui/button' import { useDocLink } from '@/context/i18n' import { useModalContextSelector } from '@/context/modal-context' import useTimestamp from '@/hooks/use-timestamp' diff --git a/web/app/education-apply/user-info.tsx b/web/app/education-apply/user-info.tsx index 32d56b2780..be9b319038 100644 --- a/web/app/education-apply/user-info.tsx +++ b/web/app/education-apply/user-info.tsx @@ -1,7 +1,7 @@ +import { Avatar } from '@langgenius/dify-ui/avatar' +import { Button } from '@langgenius/dify-ui/button' import { useTranslation } from 'react-i18next' import { Triangle } from '@/app/components/base/icons/src/public/education' -import { Avatar } from '@/app/components/base/ui/avatar' -import { Button } from '@/app/components/base/ui/button' import { useAppContext } from '@/context/app-context' import { useRouter } from '@/next/navigation' import { useLogout } from '@/service/use-common' diff --git a/web/app/education-apply/verify-state-modal.tsx b/web/app/education-apply/verify-state-modal.tsx index c4d836f178..bb7439352e 100644 --- a/web/app/education-apply/verify-state-modal.tsx +++ b/web/app/education-apply/verify-state-modal.tsx @@ -1,3 +1,4 @@ +import { Button } from '@langgenius/dify-ui/button' import { RiExternalLinkLine, } from '@remixicon/react' @@ -5,7 +6,6 @@ import * as React from 'react' import { useEffect, useRef, useState } from 'react' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import { useDocLink } from '@/context/i18n' type IConfirm = { diff --git a/web/app/forgot-password/ChangePasswordForm.tsx b/web/app/forgot-password/ChangePasswordForm.tsx index bf262181a9..deb520c436 100644 --- a/web/app/forgot-password/ChangePasswordForm.tsx +++ b/web/app/forgot-password/ChangePasswordForm.tsx @@ -1,11 +1,11 @@ 'use client' import { CheckCircleIcon } from '@heroicons/react/24/solid' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Loading from '@/app/components/base/loading' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { validPassword } from '@/config' import { useSearchParams } from '@/next/navigation' import { changePasswordWithToken } from '@/service/common' diff --git a/web/app/forgot-password/ForgotPasswordForm.tsx b/web/app/forgot-password/ForgotPasswordForm.tsx index 7ce5e7d8dd..b4fba60182 100644 --- a/web/app/forgot-password/ForgotPasswordForm.tsx +++ b/web/app/forgot-password/ForgotPasswordForm.tsx @@ -1,15 +1,15 @@ 'use client' import type { InitValidateStatusResponse } from '@/models/common' +import { Button } from '@langgenius/dify-ui/button' + import { useStore } from '@tanstack/react-form' import * as React from 'react' - import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import * as z from 'zod' import { formContext, useAppForm } from '@/app/components/base/form' import { zodSubmitValidator } from '@/app/components/base/form/utils/zod-submit-validator' -import { Button } from '@/app/components/base/ui/button' import { useRouter } from '@/next/navigation' import { fetchInitValidateStatus, diff --git a/web/app/init/InitPasswordPopup.tsx b/web/app/init/InitPasswordPopup.tsx index b0c74978fa..6b25fa371a 100644 --- a/web/app/init/InitPasswordPopup.tsx +++ b/web/app/init/InitPasswordPopup.tsx @@ -1,9 +1,9 @@ 'use client' import type { InitValidateStatusResponse } from '@/models/common' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import useDocumentTitle from '@/hooks/use-document-title' import { useRouter } from '@/next/navigation' import { fetchInitValidateStatus, initValidate } from '@/service/common' diff --git a/web/app/install/installForm.tsx b/web/app/install/installForm.tsx index c068548561..d9b6e0c7ad 100644 --- a/web/app/install/installForm.tsx +++ b/web/app/install/installForm.tsx @@ -1,8 +1,9 @@ 'use client' import type { InitValidateStatusResponse, SetupStatusResponse } from '@/models/common' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' -import { useStore } from '@tanstack/react-form' +import { useStore } from '@tanstack/react-form' import * as React from 'react' import { useEffect } from 'react' import { useTranslation } from 'react-i18next' @@ -10,7 +11,6 @@ import * as z from 'zod' import { formContext, useAppForm } from '@/app/components/base/form' import { zodSubmitValidator } from '@/app/components/base/form/utils/zod-submit-validator' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' import { validPassword } from '@/config' import { LICENSE_LINK } from '@/constants/link' diff --git a/web/app/layout.tsx b/web/app/layout.tsx index 63e506bd45..be0c854f02 100644 --- a/web/app/layout.tsx +++ b/web/app/layout.tsx @@ -1,4 +1,6 @@ import type { Viewport } from '@/next' +import { ToastHost } from '@langgenius/dify-ui/toast' +import { TooltipProvider } from '@langgenius/dify-ui/tooltip' import { Provider as JotaiProvider } from 'jotai/react' import { ThemeProvider } from 'next-themes' import { NuqsAdapter } from 'nuqs/adapters/next/app' @@ -6,8 +8,6 @@ import GlobalPublicStoreProvider from '@/context/global-public-context' import { TanstackQueryInitializer } from '@/context/query-client' import { getDatasetMap } from '@/env' import { getLocaleOnServer } from '@/i18n-config/server' -import { ToastHost } from './components/base/ui/toast' -import { TooltipProvider } from './components/base/ui/tooltip' import PartnerStackCookieRecorder from './components/billing/partner-stack/cookie-recorder' import CreateAppAttributionBootstrap from './components/create-app-attribution-bootstrap' import { AgentationLoader } from './components/devtools/agentation-loader' diff --git a/web/app/reset-password/check-code/page.tsx b/web/app/reset-password/check-code/page.tsx index 98ea828aae..b11935481e 100644 --- a/web/app/reset-password/check-code/page.tsx +++ b/web/app/reset-password/check-code/page.tsx @@ -1,10 +1,10 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowLeftLine, RiMailSendFill } from '@remixicon/react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' import { useRouter, useSearchParams } from '@/next/navigation' diff --git a/web/app/reset-password/page.tsx b/web/app/reset-password/page.tsx index d58fd7e9ff..63b950bd11 100644 --- a/web/app/reset-password/page.tsx +++ b/web/app/reset-password/page.tsx @@ -1,11 +1,11 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowLeftLine, RiLockPasswordLine } from '@remixicon/react' import { noop } from 'es-toolkit/function' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' import useDocumentTitle from '@/hooks/use-document-title' diff --git a/web/app/reset-password/set-password/page.tsx b/web/app/reset-password/set-password/page.tsx index 7277b6d30c..4a8cb2af9b 100644 --- a/web/app/reset-password/set-password/page.tsx +++ b/web/app/reset-password/set-password/page.tsx @@ -1,12 +1,12 @@ 'use client' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiCheckboxCircleFill } from '@remixicon/react' import { useCountDown } from 'ahooks' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { validPassword } from '@/config' import { useRouter, useSearchParams } from '@/next/navigation' import { changePasswordWithToken } from '@/service/common' diff --git a/web/app/signin/check-code/page.tsx b/web/app/signin/check-code/page.tsx index b86c984f31..fb52e0b5b7 100644 --- a/web/app/signin/check-code/page.tsx +++ b/web/app/signin/check-code/page.tsx @@ -1,12 +1,12 @@ 'use client' import type { FormEvent } from 'react' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowLeftLine, RiMailSendFill } from '@remixicon/react' import { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { trackEvent } from '@/app/components/base/amplitude' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' diff --git a/web/app/signin/components/mail-and-code-auth.tsx b/web/app/signin/components/mail-and-code-auth.tsx index 5c5431c42a..41cf50854e 100644 --- a/web/app/signin/components/mail-and-code-auth.tsx +++ b/web/app/signin/components/mail-and-code-auth.tsx @@ -1,9 +1,9 @@ import type { FormEvent } from 'react' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { COUNT_DOWN_KEY, COUNT_DOWN_TIME_MS } from '@/app/components/signin/countdown' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' diff --git a/web/app/signin/components/mail-and-password-auth.tsx b/web/app/signin/components/mail-and-password-auth.tsx index ca93b9b391..6feaf11426 100644 --- a/web/app/signin/components/mail-and-password-auth.tsx +++ b/web/app/signin/components/mail-and-password-auth.tsx @@ -1,11 +1,11 @@ import type { ResponseError } from '@/service/fetch' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { noop } from 'es-toolkit/function' import { useState } from 'react' import { useTranslation } from 'react-i18next' import { trackEvent } from '@/app/components/base/amplitude' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { emailRegex } from '@/config' import { useLocale } from '@/context/i18n' import Link from '@/next/link' diff --git a/web/app/signin/components/social-auth.tsx b/web/app/signin/components/social-auth.tsx index 6eb9d62703..09fa528d1f 100644 --- a/web/app/signin/components/social-auth.tsx +++ b/web/app/signin/components/social-auth.tsx @@ -1,6 +1,6 @@ +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { useTranslation } from 'react-i18next' -import { Button } from '@/app/components/base/ui/button' import { API_PREFIX } from '@/config' import { useSearchParams } from '@/next/navigation' import { getPurifyHref } from '@/utils' diff --git a/web/app/signin/components/sso-auth.tsx b/web/app/signin/components/sso-auth.tsx index 5ead876741..32612e4edd 100644 --- a/web/app/signin/components/sso-auth.tsx +++ b/web/app/signin/components/sso-auth.tsx @@ -1,10 +1,10 @@ 'use client' import type { FC } from 'react' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useState } from 'react' import { useTranslation } from 'react-i18next' import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { useRouter, useSearchParams } from '@/next/navigation' import { getUserOAuth2SSOUrl, getUserOIDCSSOUrl, getUserSAMLSSOUrl } from '@/service/sso' import { SSOProtocol } from '@/types/feature' diff --git a/web/app/signin/invite-settings/page.tsx b/web/app/signin/invite-settings/page.tsx index 91973f07f9..fe3dac7153 100644 --- a/web/app/signin/invite-settings/page.tsx +++ b/web/app/signin/invite-settings/page.tsx @@ -1,5 +1,7 @@ 'use client' import type { Locale } from '@/i18n-config' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiAccountCircleLine } from '@remixicon/react' import { noop } from 'es-toolkit/function' import { useCallback, useState } from 'react' @@ -7,8 +9,6 @@ import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' import Loading from '@/app/components/base/loading' import { SimpleSelect } from '@/app/components/base/select' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { LICENSE_LINK } from '@/constants/link' import { useGlobalPublicStore } from '@/context/global-public-context' import { setLocaleOnClient } from '@/i18n-config' diff --git a/web/app/signin/normal-form.tsx b/web/app/signin/normal-form.tsx index 4fd0eabf66..2ead90f068 100644 --- a/web/app/signin/normal-form.tsx +++ b/web/app/signin/normal-form.tsx @@ -1,9 +1,9 @@ import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import { RiContractLine, RiDoorLockLine, RiErrorWarningFill } from '@remixicon/react' import * as React from 'react' import { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { IS_CE_EDITION } from '@/config' import { useGlobalPublicStore } from '@/context/global-public-context' import Link from '@/next/link' diff --git a/web/app/signin/one-more-step.tsx b/web/app/signin/one-more-step.tsx index 6368533e2a..1f615d5e5a 100644 --- a/web/app/signin/one-more-step.tsx +++ b/web/app/signin/one-more-step.tsx @@ -1,11 +1,11 @@ 'use client' import type { Reducer } from 'react' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useReducer } from 'react' import { useTranslation } from 'react-i18next' import { SimpleSelect } from '@/app/components/base/select' import Tooltip from '@/app/components/base/tooltip' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { LICENSE_LINK } from '@/constants/link' import { languages, LanguagesSupported } from '@/i18n-config/language' import Link from '@/next/link' diff --git a/web/app/signup/check-code/page.tsx b/web/app/signup/check-code/page.tsx index a71d5289fe..a6a8cadc13 100644 --- a/web/app/signup/check-code/page.tsx +++ b/web/app/signup/check-code/page.tsx @@ -1,11 +1,11 @@ 'use client' import type { MailSendResponse, MailValidityResponse } from '@/service/use-common' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { RiArrowLeftLine, RiMailSendFill } from '@remixicon/react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Countdown from '@/app/components/signin/countdown' import { useLocale } from '@/context/i18n' import { useRouter, useSearchParams } from '@/next/navigation' diff --git a/web/app/signup/components/input-mail.tsx b/web/app/signup/components/input-mail.tsx index ae7fbb986d..f4c5214c11 100644 --- a/web/app/signup/components/input-mail.tsx +++ b/web/app/signup/components/input-mail.tsx @@ -1,10 +1,10 @@ 'use client' import type { MailSendResponse } from '@/service/use-common' +import { Button } from '@langgenius/dify-ui/button' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import Split from '@/app/signin/split' import { emailRegex } from '@/config' import { useGlobalPublicStore } from '@/context/global-public-context' diff --git a/web/app/signup/set-password/page.tsx b/web/app/signup/set-password/page.tsx index ffecd0bc0c..a8eb883078 100644 --- a/web/app/signup/set-password/page.tsx +++ b/web/app/signup/set-password/page.tsx @@ -1,13 +1,13 @@ 'use client' import type { MailRegisterResponse } from '@/service/use-common' +import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' +import { toast } from '@langgenius/dify-ui/toast' import Cookies from 'js-cookie' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import { trackEvent } from '@/app/components/base/amplitude' import Input from '@/app/components/base/input' -import { Button } from '@/app/components/base/ui/button' -import { toast } from '@/app/components/base/ui/toast' import { validPassword } from '@/config' import { useRouter, useSearchParams } from '@/next/navigation' import { useMailRegister } from '@/service/use-common' diff --git a/web/context/provider-context-provider.tsx b/web/context/provider-context-provider.tsx index 078a954e31..0af0f24b9a 100644 --- a/web/context/provider-context-provider.tsx +++ b/web/context/provider-context-provider.tsx @@ -1,11 +1,11 @@ 'use client' import type { ReactNode } from 'react' +import { toast } from '@langgenius/dify-ui/toast' import { useQueryClient } from '@tanstack/react-query' import dayjs from 'dayjs' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { setZendeskConversationFields } from '@/app/components/base/zendesk/utils' import { defaultPlan } from '@/app/components/billing/config' import { parseCurrentPlan } from '@/app/components/billing/utils' diff --git a/web/docs/overlay-migration.md b/web/docs/overlay-migration.md index 29ef814fcd..0016f34e12 100644 --- a/web/docs/overlay-migration.md +++ b/web/docs/overlay-migration.md @@ -11,14 +11,14 @@ This document tracks the migration away from legacy overlay APIs. - `@/app/components/base/select` (including `custom` / `pure`) - `@/app/components/base/dialog` - Replacement primitives: - - `@/app/components/base/ui/tooltip` - - `@/app/components/base/ui/dropdown-menu` - - `@/app/components/base/ui/context-menu` - - `@/app/components/base/ui/popover` - - `@/app/components/base/ui/dialog` - - `@/app/components/base/ui/alert-dialog` - - `@/app/components/base/ui/select` - - `@/app/components/base/ui/toast` + - `@langgenius/dify-ui/tooltip` + - `@langgenius/dify-ui/dropdown-menu` + - `@langgenius/dify-ui/context-menu` + - `@langgenius/dify-ui/popover` + - `@langgenius/dify-ui/dialog` + - `@langgenius/dify-ui/alert-dialog` + - `@langgenius/dify-ui/select` + - `@langgenius/dify-ui/toast` - Tracking issue: ## ESLint policy diff --git a/web/eslint.constants.mjs b/web/eslint.constants.mjs index 57a14fc22d..46690035fb 100644 --- a/web/eslint.constants.mjs +++ b/web/eslint.constants.mjs @@ -33,7 +33,7 @@ export const OVERLAY_RESTRICTED_IMPORT_PATTERNS = [ '**/base/tooltip', '**/base/tooltip/index', ], - message: 'Deprecated: use @/app/components/base/ui/tooltip instead. See issue #32767.', + message: 'Deprecated: use @langgenius/dify-ui/tooltip instead. See issue #32767.', }, { group: [ @@ -41,7 +41,7 @@ export const OVERLAY_RESTRICTED_IMPORT_PATTERNS = [ '**/base/modal/index', '**/base/modal/modal', ], - message: 'Deprecated: use @/app/components/base/ui/dialog instead. See issue #32767.', + message: 'Deprecated: use @langgenius/dify-ui/dialog instead. See issue #32767.', }, { group: [ @@ -50,14 +50,14 @@ export const OVERLAY_RESTRICTED_IMPORT_PATTERNS = [ '**/base/select/custom', '**/base/select/pure', ], - message: 'Deprecated: use @/app/components/base/ui/select instead. See issue #32767.', + message: 'Deprecated: use @langgenius/dify-ui/select instead. See issue #32767.', }, { group: [ '**/base/dialog', '**/base/dialog/index', ], - message: 'Deprecated: use @/app/components/base/ui/dialog instead. See issue #32767.', + message: 'Deprecated: use @langgenius/dify-ui/dialog instead. See issue #32767.', }, ] diff --git a/web/hooks/use-import-dsl.ts b/web/hooks/use-import-dsl.ts index 6be67c22ac..1ece2a27f0 100644 --- a/web/hooks/use-import-dsl.ts +++ b/web/hooks/use-import-dsl.ts @@ -3,13 +3,13 @@ import type { DSLImportResponse, } from '@/models/app' import type { AppIconType } from '@/types/app' +import { toast } from '@langgenius/dify-ui/toast' import { useCallback, useRef, useState, } from 'react' import { useTranslation } from 'react-i18next' -import { toast } from '@/app/components/base/ui/toast' import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks' import { NEED_REFRESH_APP_LIST_KEY } from '@/config' import { useSelector } from '@/context/app-context' diff --git a/web/hooks/use-pay.tsx b/web/hooks/use-pay.tsx index 237913b433..593a33a1d2 100644 --- a/web/hooks/use-pay.tsx +++ b/web/hooks/use-pay.tsx @@ -1,7 +1,5 @@ 'use client' -import { useCallback, useEffect, useState } from 'react' -import { useTranslation } from 'react-i18next' import { AlertDialog, AlertDialogActions, @@ -9,7 +7,9 @@ import { AlertDialogContent, AlertDialogDescription, AlertDialogTitle, -} from '@/app/components/base/ui/alert-dialog' +} from '@langgenius/dify-ui/alert-dialog' +import { useCallback, useEffect, useState } from 'react' +import { useTranslation } from 'react-i18next' import { useRouter, useSearchParams } from '@/next/navigation' import { useNotionBinding } from '@/service/use-common' diff --git a/web/service/base.ts b/web/service/base.ts index 2063b5bc37..64d13ef59a 100644 --- a/web/service/base.ts +++ b/web/service/base.ts @@ -27,8 +27,8 @@ import type { WorkflowPausedResponse, WorkflowStartedResponse, } from '@/types/workflow' +import { toast } from '@langgenius/dify-ui/toast' import Cookies from 'js-cookie' -import { toast } from '@/app/components/base/ui/toast' import { API_PREFIX, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, IS_CE_EDITION, PASSPORT_HEADER_NAME, PUBLIC_API_PREFIX, WEB_APP_SHARE_CODE_HEADER_NAME } from '@/config' import { asyncRunSafe } from '@/utils' import { basePath } from '@/utils/var' diff --git a/web/service/fetch.spec.ts b/web/service/fetch.spec.ts index 0c01d32438..632f898e88 100644 --- a/web/service/fetch.spec.ts +++ b/web/service/fetch.spec.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import { base } from './fetch' -vi.mock('@/app/components/base/ui/toast', () => ({ +vi.mock('@langgenius/dify-ui/toast', () => ({ toast: { add: vi.fn(), }, diff --git a/web/service/fetch.ts b/web/service/fetch.ts index 82870a8d2e..34bd07160a 100644 --- a/web/service/fetch.ts +++ b/web/service/fetch.ts @@ -1,8 +1,8 @@ import type { AfterResponseHook, BeforeRequestHook, Hooks } from 'ky' import type { IOtherOptions } from './base' +import { toast } from '@langgenius/dify-ui/toast' import Cookies from 'js-cookie' import ky, { HTTPError } from 'ky' -import { toast } from '@/app/components/base/ui/toast' import { API_PREFIX, APP_VERSION, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, IS_MARKETPLACE, MARKETPLACE_API_PREFIX, PASSPORT_HEADER_NAME, PUBLIC_API_PREFIX, WEB_APP_SHARE_CODE_HEADER_NAME } from '@/config' import { getWebAppAccessToken, getWebAppPassport } from './webapp-auth' diff --git a/web/tailwind.config.ts b/web/tailwind.config.ts index 32b889e707..21c0455177 100644 --- a/web/tailwind.config.ts +++ b/web/tailwind.config.ts @@ -6,9 +6,11 @@ const config: Config = { './app/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}', './context/**/*.{js,ts,jsx,tsx}', + '../packages/dify-ui/src/**/*.{ts,tsx}', './node_modules/streamdown/dist/*.js', './node_modules/@streamdown/math/dist/*.js', '!./**/*.{spec,test}.{js,ts,jsx,tsx}', + '!../packages/dify-ui/src/**/*.{spec,test}.{ts,tsx}', ], ...commonConfig, }