Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat(dify-ui): add input group composition (#40890)
yyh6d8955735583
diff --git a/.agents/skills/frontend-code-review/references/dify-ui.md b/.agents/skills/frontend-code-review/references/dify-ui.mdindex 93484a6a0fc..7da481ef6e6 100644--- a/.agents/skills/frontend-code-review/references/dify-ui.md+++ b/.agents/skills/frontend-code-review/references/dify-ui.md@@ -55,7 +55,8 @@ For non-string `Select` and `RadioGroup` values, prefer explicit domain genericsFlag:- Form-like UI using unrelated `Input` and `Button` pieces without a submit boundary.-- Text-like fields not composed through `Field`, `FieldLabel`, and `FieldControl` when using Dify UI form semantics.+- Text-like fields not composed through `Field`, `FieldLabel`, and `Input` or `InputGroupInput` when using Dify UI form semantics.+- Prefixes, suffixes, or actions manually layered over `Input` instead of using the canonical `InputGroup` composition.- Select fields using `FieldLabel` instead of `SelectLabel`.- Slider fields using a generic label instead of `SliderLabel`.- Checkbox/radio groups missing `Fieldset` and `FieldsetLegend`.diff --git a/oxlint-suppressions.json b/oxlint-suppressions.jsonindex 9acd454609f..eae0a944da4 100644--- a/oxlint-suppressions.json+++ b/oxlint-suppressions.json@@ -1642,11 +1642,6 @@"count": 2}},- "web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx": {- "jsx-a11y/no-autofocus": {- "count": 1- }- },"web/app/components/base/prompt-editor/plugins/hitl-input-block/pre-populate.tsx": {"jsx-a11y/no-autofocus": {"count": 1@@ -2787,9 +2782,6 @@}},"web/app/components/plugins/install-plugin/install-from-github/index.tsx": {- "jsx-a11y/no-autofocus": {- "count": 1- },"typescript/no-explicit-any": {"count": 2}@@ -3303,11 +3295,6 @@"count": 6}},- "web/app/components/snippets/create-snippet-dialog.tsx": {- "jsx-a11y/no-autofocus": {- "count": 1- }- },"web/app/components/snippets/hooks/use-snippet-run.ts": {"no-restricted-imports": {"count": 2@@ -3322,12 +3309,6 @@"eslint-react/set-state-in-effect": {"count": 4},- "jsx-a11y/click-events-have-key-events": {- "count": 1- },- "jsx-a11y/no-static-element-interactions": {- "count": 1- },"typescript/no-explicit-any": {"count": 2}diff --git a/packages/dify-ui/AGENTS.md b/packages/dify-ui/AGENTS.mdindex 0cb66d50e4c..9b877e2a8dd 100644--- a/packages/dify-ui/AGENTS.md+++ b/packages/dify-ui/AGENTS.md@@ -16,6 +16,7 @@ This package owns shared design tokens, CSS-first Tailwind styles, the `cn()` utUse the README sections as the detailed owners:- [Button and icon-button contracts]+- [Form and input composition]- [Imports and public boundaries]- [Typed value contracts]- [Search and picker selection]@@ -25,6 +26,7 @@ Use the README sections as the detailed owners:[Button and icon-button contracts]: README.md#button-loading-and-disabled-contract[Development and test boundaries]: README.md#development+[Form and input composition]: README.md#form-contract[Imports and public boundaries]: README.md#imports[Overlay and portal contracts]: README.md#overlay--portal-contract[Search and picker selection]: README.md#search-and-picker-selectiondiff --git a/packages/dify-ui/README.md b/packages/dify-ui/README.mdindex 8597cf73c9e..75c35061387 100644--- a/packages/dify-ui/README.md+++ b/packages/dify-ui/README.md@@ -30,9 +30,11 @@ import { Button } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'import { Dialog, DialogContent, DialogTrigger } from '@langgenius/dify-ui/dialog'import { Drawer, DrawerPopup, DrawerTrigger } from '@langgenius/dify-ui/drawer'-import { Field, FieldControl, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'import { IconButton } from '@langgenius/dify-ui/icon-button'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'+import { Input } from '@langgenius/dify-ui/input'import { Kbd, KbdGroup } from '@langgenius/dify-ui/kbd'import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover'import { SegmentedControl, SegmentedControlItem } from '@langgenius/dify-ui/segmented-control'@@ -63,18 +65,18 @@ Keep implementation-only render helpers, context values, styling helpers, and up## Primitives-| Category | Subpath | Notes |-| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |-| Actions | `./button`, `./icon-button`, `./toggle` | Visible-label actions, icon-only commands, and persistent toggles. |-| Controls | `./segmented-control` | SegmentedControl for mode, filter, and view selection. |-| Display | `./collapsible`, `./kbd` | Collapsible disclosure primitive; keyboard input and shortcut keycap primitives. |-| Feedback | `./meter`, `./progress`, `./status-dot`, `./toast` | Inline and asynchronous status primitives; Toast owns the `z-60` layer. |-| Form | `./form`, `./field`, `./fieldset`, `./input`, `./textarea`, `./checkbox`, `./checkbox-group`, `./radio`, `./number-field`, `./select`, `./slider`, `./switch` | Native form boundary, field semantics, and controls. |-| Layout | `./scroll-area` | Custom-styled scrollbar over the host viewport. |-| Media | `./avatar` | Avatar root, image, and fallback primitives. |-| Navigation | `./file-tree`, `./pagination`, `./tabs` | FileTree for preview-oriented file disclosure lists; Pagination for page navigation; Tabs for panels. |-| Overlay / menu | `./alert-dialog`, `./context-menu`, `./dialog`, `./drawer`, `./dropdown-menu`, `./popover`, `./preview-card`, `./tooltip` | Portalled. See [Overlay & portal contract] below. |-| Search / pickers | `./autocomplete`, `./combobox`, `./select` | Search input, searchable picker, and closed picker. |+| Category | Subpath | Notes |+| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |+| Actions | `./button`, `./icon-button`, `./toggle` | Visible-label actions, icon-only commands, and persistent toggles. |+| Controls | `./segmented-control` | SegmentedControl for mode, filter, and view selection. |+| Display | `./collapsible`, `./kbd` | Collapsible disclosure primitive; keyboard input and shortcut keycap primitives. |+| Feedback | `./meter`, `./progress`, `./status-dot`, `./toast` | Inline and asynchronous status primitives; Toast owns the `z-60` layer. |+| Form | `./form`, `./field`, `./fieldset`, `./input`, `./input-group`, `./textarea`, `./checkbox`, `./checkbox-group`, `./radio`, `./number-field`, `./select`, `./slider`, `./switch` | Native form boundary, field semantics, and controls. |+| Layout | `./scroll-area` | Custom-styled scrollbar over the host viewport. |+| Media | `./avatar` | Avatar root, image, and fallback primitives. |+| Navigation | `./file-tree`, `./pagination`, `./tabs` | FileTree for preview-oriented file disclosure lists; Pagination for page navigation; Tabs for panels. |+| Overlay / menu | `./alert-dialog`, `./context-menu`, `./dialog`, `./drawer`, `./dropdown-menu`, `./popover`, `./preview-card`, `./tooltip` | Portalled. See [Overlay & portal contract] below. |+| Search / pickers | `./autocomplete`, `./combobox`, `./select` | Search input, searchable picker, and closed picker. |Utilities:@@ -122,7 +124,9 @@ Dify UI's form primitives are a Base UI composition layer for native form semantUse `Form` for the submit boundary. It renders a native `<form>`, preserves Enter-to-submit and submit-button behavior, and adds Base UI's `onFormSubmit`, `errors`, `actionsRef`, and `validationMode` APIs for structured values and consolidated field validation. Prefer it over a bare `<form>` when the form is composed with Dify UI fields.-Use `Field` for each standalone named field. A field must have a stable `name`, a label relationship, and either a `FieldControl` or another control that participates in the same Base UI field context. Prefer a visible label for normal form rows; when the surrounding UI already supplies the visible text, use the matching label primitive visually hidden or put `aria-label` on the actual interactive control. `FieldDescription` and `FieldError` provide the message relationships that screen readers need, while the Dify wrapper adds the default Form Input Set styling from the design system.+Use `Field` when a text control needs Base UI field semantics such as shared name, label, validation, description, or error state. A standalone `Input` may instead use a native `<label htmlFor>` relationship or an accessible name on the input itself. Prefer a visible label for normal form rows. `FieldDescription` and `FieldError` provide the message relationships that screen readers need, while the Dify wrapper adds the default Form Input Set styling from the design system.++`Input` is the standalone Dify UI text-input control. When `Field` is present, it owns the shared name, label, validation, and messages. For a prefix, suffix, or action, use the [Input Group composition contract].Choose the label primitive by the control semantics. Text-like inputs, `Textarea`, input-based `Combobox` / `Autocomplete`, single `Checkbox` / `Radio`, `Switch`, and `NumberField` use `FieldLabel`. Trigger-based `Select` fields use `SelectLabel`; `Slider` fields use `SliderLabel`, with per-thumb `aria-label` only when the thumbs need distinct names. `SelectGroupLabel` and `AutocompleteGroupLabel` only label grouped options inside their popup content; they are not field labels.@@ -324,6 +328,7 @@ See [component authoring rules] for:[Base UI docs index]: https://base-ui.com/llms.txt[Base UI forms handbook]: https://base-ui.com/react/handbook/forms[Base UI]: https://base-ui.com/react+[Input Group composition contract]: ./src/input-group/README.md[Overlay & portal contract]: #overlay--portal-contract[component authoring rules]: ./AGENTS.md[web overlay guide]: ../../web/docs/overlay.mddiff --git a/packages/dify-ui/package.json b/packages/dify-ui/package.jsonindex 10682bb455f..c423d111fc6 100644--- a/packages/dify-ui/package.json+++ b/packages/dify-ui/package.json@@ -85,6 +85,10 @@"types": "./src/input/index.tsx","import": "./src/input/index.tsx"},+ "./input-group": {+ "types": "./src/input-group/index.tsx",+ "import": "./src/input-group/index.tsx"+ },"./kbd": {"types": "./src/kbd/index.tsx","import": "./src/kbd/index.tsx"diff --git a/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx b/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsxindex a026df78d6b..111da03ebb3 100644--- a/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx+++ b/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx@@ -1,4 +1,5 @@import * as React from 'react'+import { userEvent } from 'vite-plus/test/browser'import { render } from 'vitest-browser-react'import {Autocomplete,@@ -67,6 +68,20 @@ const renderAutocomplete = ({describe('Autocomplete wrappers', () => {describe('Input group and input', () => {+ it('should show the compound focus surface when keyboard users enter without Field', async () => {+ const screen = await renderAutocomplete()+ const inputGroup = screen.getByTestId('input-group')+ const input = screen.getByTestId('input')+ const restingBoxShadow = getComputedStyle(inputGroup.element()).boxShadow++ await userEvent.keyboard('{Tab}')++ await expect.element(input).toHaveFocus()+ await expect+ .poll(() => getComputedStyle(inputGroup.element()).boxShadow)+ .not.toBe(restingBoxShadow)+ })+it('should set input defaults and forward passthrough props', async () => {const screen = await renderAutocomplete({children: (diff --git a/packages/dify-ui/src/autocomplete/index.tsx b/packages/dify-ui/src/autocomplete/index.tsxindex d878f500f11..eb690608d99 100644--- a/packages/dify-ui/src/autocomplete/index.tsx+++ b/packages/dify-ui/src/autocomplete/index.tsx@@ -6,7 +6,7 @@ import type { Placement } from '../placement'import { Autocomplete as BaseAutocomplete } from '@base-ui/react/autocomplete'import { cva } from 'class-variance-authority'import { cn } from '../cn'-import { textControlCompoundFocusClassName } from '../form-control-shared'+import { textControlCompoundInputFocusClassName } from '../form-control-shared'import {floatingGroupLabelClassName,floatingItemIndicatorClassName,@@ -82,7 +82,7 @@ const autocompleteInputGroupVariants = cva(['group/autocomplete flex w-full min-w-0 items-center border border-transparent bg-components-input-bg-normal text-components-input-text-filled shadow-none outline-hidden transition-[background-color,border-color,box-shadow]','hover:border-components-input-border-hover hover:bg-components-input-bg-hover',- textControlCompoundFocusClassName,+ textControlCompoundInputFocusClassName,'data-focused:border-components-input-border-active data-focused:bg-components-input-bg-active data-focused:shadow-xs','data-disabled:cursor-not-allowed data-disabled:border-transparent data-disabled:bg-components-input-bg-disabled data-disabled:text-components-input-text-filled-disabled','data-disabled:hover:border-transparent data-disabled:hover:bg-components-input-bg-disabled',diff --git a/packages/dify-ui/src/combobox/__tests__/index.spec.tsx b/packages/dify-ui/src/combobox/__tests__/index.spec.tsxindex f3a13f000aa..0b3ab2673ee 100644--- a/packages/dify-ui/src/combobox/__tests__/index.spec.tsx+++ b/packages/dify-ui/src/combobox/__tests__/index.spec.tsx@@ -1,4 +1,5 @@import * as React from 'react'+import { userEvent } from 'vite-plus/test/browser'import { render } from 'vitest-browser-react'import {Combobox,@@ -115,6 +116,20 @@ describe('Combobox wrappers', () => {})describe('Input group and controls', () => {+ it('should show the compound focus surface when keyboard users enter without Field', async () => {+ const screen = await renderInputCombobox()+ const inputGroup = screen.getByTestId('input-group')+ const input = screen.getByTestId('input')+ const restingBoxShadow = getComputedStyle(inputGroup.element()).boxShadow++ await userEvent.keyboard('{Tab}')++ await expect.element(input).toHaveFocus()+ await expect+ .poll(() => getComputedStyle(inputGroup.element()).boxShadow)+ .not.toBe(restingBoxShadow)+ })+it('should set input defaults and forward passthrough props', async () => {const screen = await renderInputCombobox({children: (@@ -366,6 +381,28 @@ describe('Combobox wrappers', () => {})describe('Multiple selection chips', () => {+ it('should show the compound focus surface for a nested input without Field', async () => {+ const screen = await renderWithSafeViewport(+ <Combobox multiple items={['maya', 'nora']}>+ <ComboboxInputGroup data-testid="input-group">+ <ComboboxChips>+ <ComboboxInput aria-label="Reviewers" data-testid="input" />+ </ComboboxChips>+ </ComboboxInputGroup>+ </Combobox>,+ )+ const inputGroup = screen.getByTestId('input-group')+ const input = screen.getByTestId('input')+ const restingBoxShadow = getComputedStyle(inputGroup.element()).boxShadow++ await userEvent.keyboard('{Tab}')++ await expect.element(input).toHaveFocus()+ await expect+ .poll(() => getComputedStyle(inputGroup.element()).boxShadow)+ .not.toBe(restingBoxShadow)+ })+it('should expose a controlled null value to a typed multiple value renderer', async () => {const screen = await renderWithSafeViewport(<Combobox<string, true> multiple value={null}>diff --git a/packages/dify-ui/src/combobox/index.tsx b/packages/dify-ui/src/combobox/index.tsxindex f4ce555ece1..ed8866f506e 100644--- a/packages/dify-ui/src/combobox/index.tsx+++ b/packages/dify-ui/src/combobox/index.tsx@@ -6,7 +6,7 @@ import type { Placement } from '../placement'import { Combobox as BaseCombobox } from '@base-ui/react/combobox'import { cva } from 'class-variance-authority'import { cn } from '../cn'-import { formLabelClassName, textControlCompoundFocusClassName } from '../form-control-shared'+import { formLabelClassName, textControlCompoundInputFocusClassName } from '../form-control-shared'import {floatingGroupLabelClassName,floatingItemIndicatorClassName,@@ -145,7 +145,7 @@ const comboboxInputGroupVariants = cva(['group/combobox flex w-full min-w-0 items-center border border-transparent bg-components-input-bg-normal text-components-input-text-filled shadow-none outline-hidden transition-[background-color,border-color,box-shadow]','hover:border-components-input-border-hover hover:bg-components-input-bg-hover',- textControlCompoundFocusClassName,+ textControlCompoundInputFocusClassName,'data-focused:border-components-input-border-active data-focused:bg-components-input-bg-active data-focused:shadow-xs','data-popup-open:border-components-input-border-active data-popup-open:bg-components-input-bg-active','data-disabled:cursor-not-allowed data-disabled:border-transparent data-disabled:bg-components-input-bg-disabled data-disabled:text-components-input-text-filled-disabled',diff --git a/packages/dify-ui/src/dialog/index.stories.tsx b/packages/dify-ui/src/dialog/index.stories.tsxindex d171d862a9f..9920459dfd7 100644--- a/packages/dify-ui/src/dialog/index.stories.tsx+++ b/packages/dify-ui/src/dialog/index.stories.tsx@@ -15,7 +15,7 @@ import {DialogViewport,} from '.'import { Button } from '../button'-import { Field, FieldControl, FieldDescription, FieldError, FieldLabel } from '../field'+import { Field, FieldDescription, FieldError, FieldLabel } from '../field'import { Form } from '../form'import { Input } from '../input'import {@@ -273,12 +273,12 @@ const FormDialogDemo = () => {><Field name="name"><FieldLabel>Name</FieldLabel>- <FieldControl required placeholder="Production API" />+ <Input required placeholder="Production API" /><FieldError match="valueMissing">Name is required.</FieldError></Field><Field name="endpoint"><FieldLabel>Endpoint</FieldLabel>- <FieldControl type="url" required placeholder="https://api.example.com" />+ <Input type="url" required placeholder="https://api.example.com" /><FieldDescription><ahref="https://docs.dify.ai/use-dify/workspace/api-extension/api-extension"@@ -302,7 +302,7 @@ const FormDialogDemo = () => {}}><FieldLabel>API key</FieldLabel>- <FieldControl required placeholder="sk-..." />+ <Input required placeholder="sk-..." /><FieldError match="valueMissing">API key is required.</FieldError><FieldError match="customError" /></Field>diff --git a/packages/dify-ui/src/field/__tests__/index.spec.tsx b/packages/dify-ui/src/field/__tests__/index.spec.tsxindex 0401e7446ea..881d78da25b 100644--- a/packages/dify-ui/src/field/__tests__/index.spec.tsx+++ b/packages/dify-ui/src/field/__tests__/index.spec.tsx@@ -3,7 +3,8 @@ import { Checkbox } from '../../checkbox'import { CheckboxGroup } from '../../checkbox-group'import { Fieldset, FieldsetLegend } from '../../fieldset'import { Form } from '../../form'-import { Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel } from '../index'+import { Input } from '../../input'+import { Field, FieldDescription, FieldError, FieldItem, FieldLabel } from '../index'const asHTMLElement = (element: HTMLElement | SVGElement) => element as HTMLElement@@ -14,7 +15,7 @@ describe('Field primitives', () => {<Form aria-label="profile form" onFormSubmit={onFormSubmit}><Field name="email"><FieldLabel>Email</FieldLabel>- <FieldControl type="email" required />+ <Input type="email" required /><FieldDescription>Used for account notifications.</FieldDescription><FieldError match="valueMissing">Email is required.</FieldError></Field>@@ -52,7 +53,7 @@ describe('Field primitives', () => {<Form aria-label="settings form" onFormSubmit={onFormSubmit}><Field name="apiKey"><FieldLabel>API key</FieldLabel>- <FieldControl defaultValue="sk-test" required />+ <Input defaultValue="sk-test" required /></Field><button type="submit">Save</button></Form>,@@ -64,7 +65,7 @@ describe('Field primitives', () => {expect(onFormSubmit.mock.calls[0]?.[0]).toMatchObject({ apiKey: 'sk-test' })})- it('should support external invalid state without requiring FieldControl', async () => {+ it('should support external invalid state without requiring a text input', async () => {const screen = await render(<Field name="features" invalid><Fieldset render={<CheckboxGroup value={['search']} />}>@@ -90,7 +91,7 @@ describe('Field primitives', () => {const screen = await render(<Field name="token"><FieldLabel>Token</FieldLabel>- <FieldControl readOnly defaultValue="readonly-token" />+ <Input readOnly defaultValue="readonly-token" /></Field>,)diff --git a/packages/dify-ui/src/field/index.stories.tsx b/packages/dify-ui/src/field/index.stories.tsxindex 46e85639734..2a3b57d6868 100644--- a/packages/dify-ui/src/field/index.stories.tsx+++ b/packages/dify-ui/src/field/index.stories.tsx@@ -1,6 +1,7 @@import type { Meta, StoryObj } from '@storybook/react-vite'import { Button } from '../button'-import { Field, FieldControl, FieldDescription, FieldError, FieldLabel } from './index'+import { Input } from '../input'+import { Field, FieldDescription, FieldError, FieldLabel } from './index'const meta = {title: 'Base/Form/Field',@@ -10,7 +11,7 @@ const meta = {docs: {description: {component:- 'Field primitives built on Base UI Field. Use Field with FieldLabel, FieldControl, FieldDescription, and FieldError for one named form field. External form libraries can control invalid, dirty, and touched on Field.',+ 'Field primitives built on Base UI Field. Compose Field with the actual Dify UI control, FieldLabel, FieldDescription, and FieldError for one named form field. External form libraries can control invalid, dirty, and touched on Field.',},},},@@ -26,7 +27,7 @@ export const TextField: Story = {<form className="grid w-96 gap-4"><Field name="endpoint"><FieldLabel>Endpoint</FieldLabel>- <FieldControl type="url" required placeholder="https://api.example.com" />+ <Input type="url" required placeholder="https://api.example.com" /><FieldDescription>Used as the base URL for extension requests.</FieldDescription><FieldError match="valueMissing">Endpoint is required.</FieldError><FieldError match="typeMismatch">Enter a valid URL.</FieldError>@@ -45,19 +46,19 @@ export const MultipleFields: Story = {<form className="grid w-96 gap-4"><Field name="name"><FieldLabel>Name</FieldLabel>- <FieldControl required placeholder="Production API" />+ <Input required placeholder="Production API" /><FieldError match="valueMissing">Name is required.</FieldError></Field><Field name="endpoint"><FieldLabel>Endpoint</FieldLabel>- <FieldControl type="url" required placeholder="https://api.example.com" />+ <Input type="url" required placeholder="https://api.example.com" /><FieldDescription>Used as the base URL for extension requests.</FieldDescription><FieldError match="valueMissing">Endpoint is required.</FieldError><FieldError match="typeMismatch">Enter a valid URL.</FieldError></Field><Field name="apiKey"><FieldLabel>API key</FieldLabel>- <FieldControl required placeholder="sk-..." />+ <Input required placeholder="sk-..." /><FieldDescription>Stored with the extension configuration.</FieldDescription><FieldError match="valueMissing">API key is required.</FieldError></Field>@@ -74,36 +75,17 @@ export const ExternalInvalidState: Story = {render: () => (<Field name="apiKey" invalid className="w-96"><FieldLabel>API key</FieldLabel>- <FieldControl defaultValue="expired-key" />+ <Input defaultValue="expired-key" /><FieldError match>API key has expired.</FieldError></Field>),}-export const Sizes: Story = {- render: () => (- <div className="grid w-96 gap-4">- <Field name="smallEndpoint">- <FieldLabel>Small</FieldLabel>- <FieldControl size="small" placeholder="Small input" />- </Field>- <Field name="regularEndpoint">- <FieldLabel>Regular</FieldLabel>- <FieldControl placeholder="Regular input" />- </Field>- <Field name="largeEndpoint">- <FieldLabel>Large</FieldLabel>- <FieldControl size="large" placeholder="Large input" />- </Field>- </div>- ),-}-export const ReadOnly: Story = {render: () => (<Field name="readonlyEndpoint" className="w-96"><FieldLabel>Endpoint</FieldLabel>- <FieldControl readOnly defaultValue="https://api.example.com" />+ <Input readOnly defaultValue="https://api.example.com" /><FieldDescription>This value is managed by the workspace owner.</FieldDescription></Field>),diff --git a/packages/dify-ui/src/field/index.tsx b/packages/dify-ui/src/field/index.tsxindex 97256610eb2..f3c3361383a 100644--- a/packages/dify-ui/src/field/index.tsx+++ b/packages/dify-ui/src/field/index.tsx@@ -1,10 +1,9 @@'use client'import type { Field as BaseFieldNS } from '@base-ui/react/field'-import type { VariantProps } from 'class-variance-authority'import { Field as BaseField } from '@base-ui/react/field'import { cn } from '../cn'-import { formLabelClassName, textControlVariants } from '../form-control-shared'+import { formLabelClassName } from '../form-control-shared'type FieldProps = Omit<BaseFieldNS.Root.Props, 'className'> & {className?: string@@ -30,15 +29,6 @@ function FieldLabel({ className, ...props }: FieldLabelProps) {return <BaseField.Label className={cn(formLabelClassName, className)} {...props} />}-type FieldControlProps = Omit<BaseFieldNS.Control.Props, 'className' | 'size'> &- VariantProps<typeof textControlVariants> & {- className?: string- }--function FieldControl({ className, size = 'medium', ...props }: FieldControlProps) {- return <BaseField.Control className={cn(textControlVariants({ size }), className)} {...props} />-}-type FieldDescriptionProps = Omit<BaseFieldNS.Description.Props, 'className'> & {className?: string}@@ -69,10 +59,9 @@ type FieldValidityProps = BaseFieldNS.Validity.Propsconst FieldValidity = BaseField.Validity-export { Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel, FieldValidity }+export { Field, FieldDescription, FieldError, FieldItem, FieldLabel, FieldValidity }export type {- FieldControlProps,FieldDescriptionProps,FieldErrorProps,FieldItemProps,diff --git a/packages/dify-ui/src/form-control-shared.ts b/packages/dify-ui/src/form-control-shared.tsindex bf432e79c33..75346c5e1a9 100644--- a/packages/dify-ui/src/form-control-shared.ts+++ b/packages/dify-ui/src/form-control-shared.ts@@ -1,36 +1,8 @@-import { cva } from 'class-variance-authority'-export const formLabelClassName ='w-fit py-1 text-text-secondary system-sm-medium data-disabled:cursor-not-allowed'export const textControlFocusClassName ='focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs'-export const textControlCompoundFocusClassName =- 'focus-within:border-components-input-border-active focus-within:bg-components-input-bg-active focus-within:shadow-xs'--export const textControlVariants = cva(- [- 'w-full appearance-none border border-transparent bg-components-input-bg-normal text-components-input-text-filled caret-primary-600 outline-hidden transition-[background-color,border-color,box-shadow]',- 'placeholder:text-components-input-text-placeholder',- 'hover:border-components-input-border-hover hover:bg-components-input-bg-hover',- textControlFocusClassName,- 'data-invalid:border-components-input-border-destructive data-invalid:bg-components-input-bg-destructive',- 'read-only:cursor-default read-only:shadow-none read-only:hover:border-transparent read-only:hover:bg-components-input-bg-normal read-only:focus:border-transparent read-only:focus:bg-components-input-bg-normal read-only:focus:shadow-none',- 'disabled:cursor-not-allowed disabled:border-transparent disabled:bg-components-input-bg-disabled disabled:text-components-input-text-filled-disabled',- 'disabled:hover:border-transparent disabled:hover:bg-components-input-bg-disabled',- 'motion-reduce:transition-none',- ],- {- variants: {- size: {- small: 'rounded-md px-2 py-0.75 system-xs-regular',- medium: 'rounded-lg px-3 py-1.75 system-sm-regular',- large: 'rounded-[10px] px-4 py-1.75 system-md-regular',- },- },- defaultVariants: {- size: 'medium',- },- },-)+export const textControlCompoundInputFocusClassName =+ 'has-[input:focus]:border-components-input-border-active has-[input:focus]:bg-components-input-bg-active has-[input:focus]:shadow-xs has-[textarea:focus]:border-components-input-border-active has-[textarea:focus]:bg-components-input-bg-active has-[textarea:focus]:shadow-xs'diff --git a/packages/dify-ui/src/form/__tests__/index.spec.tsx b/packages/dify-ui/src/form/__tests__/index.spec.tsxindex 99a40007ab3..277318fcf48 100644--- a/packages/dify-ui/src/form/__tests__/index.spec.tsx+++ b/packages/dify-ui/src/form/__tests__/index.spec.tsx@@ -1,5 +1,6 @@import { render } from 'vitest-browser-react'-import { Field, FieldControl, FieldLabel } from '../../field'+import { Field, FieldLabel } from '../../field'+import { Input } from '../../input'import { Form } from '../index'describe('Form primitive', () => {@@ -8,7 +9,7 @@ describe('Form primitive', () => {<Form aria-label="profile form" className="custom-form"><Field name="name"><FieldLabel>Name</FieldLabel>- <FieldControl defaultValue="Ada" />+ <Input defaultValue="Ada" /></Field></Form>,)@@ -24,7 +25,7 @@ describe('Form primitive', () => {<Form aria-label="api form" onFormSubmit={onFormSubmit}><Field name="endpoint"><FieldLabel>Endpoint</FieldLabel>- <FieldControl defaultValue="https://api.example.com" />+ <Input defaultValue="https://api.example.com" /></Field><button type="submit">Save</button></Form>,@@ -43,7 +44,7 @@ describe('Form primitive', () => {<Form aria-label="server form" errors={{ token: 'Token has expired.' }}><Field name="token"><FieldLabel>Token</FieldLabel>- <FieldControl defaultValue="expired" />+ <Input defaultValue="expired" /></Field></Form>,)diff --git a/packages/dify-ui/src/form/index.stories.tsx b/packages/dify-ui/src/form/index.stories.tsxindex 4874bf025ab..80ef97e4f23 100644--- a/packages/dify-ui/src/form/index.stories.tsx+++ b/packages/dify-ui/src/form/index.stories.tsx@@ -3,8 +3,9 @@ import * as React from 'react'import { Button } from '../button'import { Checkbox } from '../checkbox'import { CheckboxGroup } from '../checkbox-group'-import { Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel } from '../field'+import { Field, FieldDescription, FieldError, FieldItem, FieldLabel } from '../field'import { Fieldset, FieldsetLegend } from '../fieldset'+import { Input } from '../input'import { Form } from './index'const meta = {@@ -36,13 +37,13 @@ function BasicFormDemo() {><Field name="name"><FieldLabel>Name</FieldLabel>- <FieldControl required placeholder="Enter a name" />+ <Input required placeholder="Enter a name" /><FieldError match="valueMissing">Name is required.</FieldError></Field><Field name="email"><FieldLabel>Email</FieldLabel>- <FieldControl type="email" required placeholder="[email protected]" />+ <Input type="email" required placeholder="[email protected]" /><FieldDescription>Used for account notifications.</FieldDescription><FieldError match="valueMissing">Email is required.</FieldError><FieldError match="typeMismatch">Enter a valid email address.</FieldError>diff --git a/packages/dify-ui/src/input-group/README.md b/packages/dify-ui/src/input-group/README.mdnew file mode 100644index 00000000000..e39d166cc09--- /dev/null+++ b/packages/dify-ui/src/input-group/README.md@@ -0,0 +1,11 @@+# Input Group++Use `InputGroup` when one text input shares a visual surface with a prefix, suffix, or action. Otherwise, use the standalone `Input` component.++In `web/`, reuse the existing `SearchInput` composite when its search, clear, and IME behavior matches the feature. For other compound inputs, compose this primitive instead of absolutely positioning content over `Input`.++Compose exactly one direct `InputGroupInput` with direct `InputGroupAddon` children. `InputGroup` owns the shared border, background, focus state, and non-interactive pointer surface; `InputGroupInput` owns the native input and its value; addons own layout. Put interactive content in a semantic `Button`, `IconButton`, or link instead of adding interaction to the addon; those controls keep their own focus and events.++Place `InputGroupInput` before every `InputGroupAddon` in the DOM. The input is the primary control and addons are read or reached after it. Use `align="inline-start"` or `align="inline-end"` to choose visual placement without changing that semantic and focus order.++The initial contract supports the default input size. If another size is needed, add it to `InputGroup`, which owns the shared surface and addon layout.diff --git a/packages/dify-ui/src/input-group/__tests__/index.spec.tsx b/packages/dify-ui/src/input-group/__tests__/index.spec.tsxnew file mode 100644index 00000000000..c173e3584e5--- /dev/null+++ b/packages/dify-ui/src/input-group/__tests__/index.spec.tsx@@ -0,0 +1,149 @@+import { userEvent } from 'vite-plus/test/browser'+import { render } from 'vitest-browser-react'+import { Button } from '../../button'+import { Field, FieldLabel } from '../../field'+import { Popover, PopoverContent, PopoverTrigger } from '../../popover'+import { InputGroup, InputGroupAddon, InputGroupInput } from '../index'++function InputGroupInputTypeExamples() {+ // @ts-expect-error InputGroupInput requires a native input host+ return <InputGroupInput render={<textarea />} />+}++void InputGroupInputTypeExamples++describe('InputGroup', () => {+ it('should project Field state onto the grouped surface', async () => {+ const screen = await render(+ <Field name="repositoryUrl" invalid>+ <FieldLabel>Repository URL</FieldLabel>+ <InputGroup data-testid="group">+ <InputGroupInput defaultValue="github.com/langgenius" />+ <InputGroupAddon>https://</InputGroupAddon>+ </InputGroup>+ </Field>,+ )++ const input = screen.getByRole('textbox', { name: 'Repository URL' })++ await expect.element(input).toHaveAttribute('aria-invalid', 'true')+ expect(getComputedStyle(input.element()).borderTopWidth).toBe('0px')+ expect(getComputedStyle(input.element()).backgroundColor).toBe('rgba(0, 0, 0, 0)')+ })++ it('should extend the input pointer surface through a static add-on', async () => {+ const screen = await render(+ <InputGroup>+ <InputGroupInput aria-label="Repository URL" />+ <InputGroupAddon>https://</InputGroupAddon>+ </InputGroup>,+ )++ await screen.getByText('https://').click()++ await expect.element(screen.getByRole('textbox', { name: 'Repository URL' })).toHaveFocus()+ })++ it('should let consumers cancel input pointer-surface behavior', async () => {+ const screen = await render(+ <InputGroup onMouseDown={(event) => event.preventDefault()}>+ <InputGroupInput aria-label="Repository URL" />+ <InputGroupAddon>https://</InputGroupAddon>+ </InputGroup>,+ )++ await screen.getByText('https://').click()++ await expect.element(screen.getByRole('textbox', { name: 'Repository URL' })).not.toHaveFocus()+ })++ it('should show keyboard focus on a read-only input', async () => {+ const screen = await render(+ <InputGroup data-testid="group">+ <InputGroupInput aria-label="API key" defaultValue="sk-test" readOnly />+ </InputGroup>,+ )+ const group = screen.getByTestId('group')+ const input = screen.getByRole('textbox', { name: 'API key' })+ const restingBoxShadow = getComputedStyle(group.element()).boxShadow++ await userEvent.keyboard('{Tab}')++ await expect.element(input).toHaveFocus()+ await expect.poll(() => getComputedStyle(group.element()).boxShadow).not.toBe(restingBoxShadow)+ })++ it('should preserve an interactive add-on as the focus owner', async () => {+ const onCopy = vi.fn()+ const screen = await render(+ <InputGroup data-testid="group">+ <InputGroupInput aria-label="API key" defaultValue="sk-test" />+ <InputGroupAddon align="inline-end">+ <Button size="small" variant="tertiary" onClick={onCopy}>+ Copy+ </Button>+ </InputGroupAddon>+ </InputGroup>,+ )++ const input = screen.getByRole('textbox', { name: 'API key' })+ const copyButton = screen.getByRole('button', { name: 'Copy' })+ const group = screen.getByTestId('group')+ const restingBoxShadow = getComputedStyle(group.element()).boxShadow++ await input.click()+ await expect.poll(() => getComputedStyle(group.element()).boxShadow).not.toBe(restingBoxShadow)++ await copyButton.click()++ await expect.element(copyButton).toHaveFocus()+ await expect.poll(() => getComputedStyle(group.element()).boxShadow).toBe(restingBoxShadow)+ expect(onCopy).toHaveBeenCalledTimes(1)+ })++ it('should not handle pointer events from portalled add-on content', async () => {+ const screen = await render(+ <InputGroup>+ <InputGroupInput aria-label="File name" />+ <InputGroupAddon align="inline-end">+ <Popover>+ <PopoverTrigger>More</PopoverTrigger>+ <PopoverContent popupProps={{ 'aria-label': 'File actions' }}>+ <span>File details</span>+ </PopoverContent>+ </Popover>+ </InputGroupAddon>+ </InputGroup>,+ )++ await screen.getByRole('button', { name: 'More' }).click()+ const popup = screen.getByRole('dialog', { name: 'File actions' })+ await expect.element(popup).toHaveFocus()++ await screen.getByText('File details').click()++ await expect.element(popup).toHaveFocus()+ await expect.element(screen.getByRole('textbox', { name: 'File name' })).not.toHaveFocus()+ })++ it('should keep a visually leading interactive add-on after the input in focus order', async () => {+ const screen = await render(+ <InputGroup>+ <InputGroupInput aria-label="Amount" />+ <InputGroupAddon>+ <Button size="small" variant="tertiary">+ Currency+ </Button>+ </InputGroupAddon>+ </InputGroup>,+ )++ const input = screen.getByRole('textbox', { name: 'Amount' })+ const addonButton = screen.getByRole('button', { name: 'Currency' })+ input.element().focus()++ await userEvent.keyboard('{Tab}')++ await expect.element(addonButton).toHaveFocus()+ })+})diff --git a/packages/dify-ui/src/input-group/index.stories.tsx b/packages/dify-ui/src/input-group/index.stories.tsxnew file mode 100644index 00000000000..fc7a0a1fce3--- /dev/null+++ b/packages/dify-ui/src/input-group/index.stories.tsx@@ -0,0 +1,212 @@+import type { Meta, StoryObj } from '@storybook/react-vite'+import * as React from 'react'+import { expect, spyOn, within } from 'storybook/test'+import { Button } from '../button'+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+} from '../dropdown-menu'+import { Field, FieldDescription, FieldLabel } from '../field'+import { IconButton } from '../icon-button'+import { InputGroup, InputGroupAddon, InputGroupInput } from './index'++const meta = {+ title: 'Base/Form/InputGroup',+ component: InputGroup,+ parameters: {+ layout: 'centered',+ docs: {+ description: {+ component:+ 'A compound text-input surface for a prefix, suffix, or action. Place the direct InputGroupInput before direct InputGroupAddon children in the DOM, and use align for visual placement; interactive add-ons keep their own semantics and focus.',+ },+ },+ },+ tags: ['autodocs'],+} satisfies Meta<typeof InputGroup>++export default meta++type Story = StoryObj<typeof meta>++function InputGroupsDemo() {+ const [passwordVisible, setPasswordVisible] = React.useState(false)++ return (+ <div className="grid w-80 gap-4">+ <Field name="repositoryUrl">+ <FieldLabel>Repository URL</FieldLabel>+ <InputGroup>+ <InputGroupInput+ placeholder="github.com/langgenius/dify"+ autoComplete="url"+ spellCheck={false}+ />+ <InputGroupAddon className="pe-0">https://</InputGroupAddon>+ </InputGroup>+ <FieldDescription>+ https:// is displayed as a fixed prefix and is not part of the input value.+ </FieldDescription>+ </Field>++ <Field name="password">+ <FieldLabel>Password</FieldLabel>+ <InputGroup>+ <InputGroupInput+ type={passwordVisible ? 'text' : 'password'}+ placeholder="Enter your password"+ autoComplete="current-password"+ />+ <InputGroupAddon align="inline-end">+ <IconButton+ size="md"+ aria-label={passwordVisible ? 'Hide password' : 'Show password'}+ onClick={() => setPasswordVisible((visible) => !visible)}+ >+ <span+ className={passwordVisible ? 'i-ri-eye-off-line size-4' : 'i-ri-eye-line size-4'}+ aria-hidden="true"+ />+ </IconButton>+ </InputGroupAddon>+ </InputGroup>+ </Field>+ </div>+ )+}++function InputGroupActionDemo() {+ const apiKey = 'sk-test'+ const [copied, setCopied] = React.useState(false)+ const resetTimerRef = React.useRef<number | undefined>(undefined)++ React.useEffect(() => {+ return () => window.clearTimeout(resetTimerRef.current)+ }, [])++ const handleCopy = async () => {+ try {+ await navigator.clipboard.writeText(apiKey)+ } catch {+ return+ }++ setCopied(true)+ window.clearTimeout(resetTimerRef.current)+ resetTimerRef.current = window.setTimeout(() => setCopied(false), 2000)+ }++ return (+ <Field name="apiKey" className="w-80">+ <FieldLabel>API key</FieldLabel>+ <InputGroup>+ <InputGroupInput value={apiKey} readOnly />+ <InputGroupAddon align="inline-end">+ <Button type="button" size="small" variant="tertiary" onClick={handleCopy}>+ <span aria-live="polite">{copied ? 'Copied' : 'Copy'}</span>+ </Button>+ </InputGroupAddon>+ </InputGroup>+ </Field>+ )+}++function InputGroupDecorativeIconDemo() {+ return (+ <Field name="resourceSearch" className="w-80">+ <FieldLabel>Search resources</FieldLabel>+ <InputGroup>+ <InputGroupInput+ type="search"+ placeholder="Search resources"+ autoComplete="off"+ enterKeyHint="search"+ />+ <InputGroupAddon>+ <span+ aria-hidden="true"+ className="i-ri-search-line size-4 text-components-input-text-placeholder"+ />+ </InputGroupAddon>+ </InputGroup>+ </Field>+ )+}++function InputGroupDropdownDemo() {+ return (+ <Field name="fileName" className="w-80">+ <FieldLabel>File name</FieldLabel>+ <InputGroup>+ <InputGroupInput defaultValue="report.md" />+ <InputGroupAddon align="inline-end">+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <IconButton+ size="md"+ aria-label="File actions"+ className="text-text-tertiary data-popup-open:bg-state-base-hover-alt data-popup-open:text-text-secondary data-popup-open:hover:bg-state-base-hover-alt"+ >+ <span aria-hidden="true" className="i-ri-more-fill size-4" />+ </IconButton>+ }+ />+ <DropdownMenuContent placement="bottom-end" sideOffset={8}>+ <DropdownMenuItem>Settings</DropdownMenuItem>+ <DropdownMenuItem>Copy path</DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </InputGroupAddon>+ </InputGroup>+ </Field>+ )+}++export const Basic: Story = {+ render: () => <InputGroupsDemo />,+ play: async ({ canvas, userEvent }) => {+ const passwordInput = canvas.getByLabelText('Password')++ await expect(passwordInput).toHaveAttribute('type', 'password')+ await userEvent.click(canvas.getByRole('button', { name: 'Show password' }))+ await expect(passwordInput).toHaveAttribute('type', 'text')+ },+}++export const WithAction: Story = {+ render: () => <InputGroupActionDemo />,+ play: async ({ canvas, userEvent }) => {+ const writeText = spyOn(navigator.clipboard, 'writeText').mockResolvedValue(undefined)+ const input = canvas.getByRole('textbox', { name: 'API key' })+ const copyButton = canvas.getByRole('button', { name: 'Copy' })++ await expect(input).toHaveValue('sk-test')+ await expect(input).toHaveAttribute('readonly')+ expect(input.getBoundingClientRect().width).toBeGreaterThan(0)++ await userEvent.click(copyButton)+ await expect(writeText).toHaveBeenCalledWith('sk-test')+ await expect(canvas.getByRole('button', { name: 'Copied' })).toBeVisible()+ },+}++export const WithDecorativeIcon: Story = {+ render: () => <InputGroupDecorativeIconDemo />,+}++export const WithDropdownAction: Story = {+ render: () => <InputGroupDropdownDemo />,+ play: async ({ canvas, canvasElement, userEvent }) => {+ const trigger = canvas.getByRole('button', { name: 'File actions' })+ await userEvent.click(trigger)++ const body = within(canvasElement.ownerDocument.body)+ await userEvent.click(await body.findByRole('menuitem', { name: 'Settings' }))++ await expect(trigger).toHaveFocus()+ await expect(body.queryByRole('menuitem', { name: 'Settings' })).not.toBeInTheDocument()+ },+}diff --git a/packages/dify-ui/src/input-group/index.tsx b/packages/dify-ui/src/input-group/index.tsxnew file mode 100644index 00000000000..810d7447e58--- /dev/null+++ b/packages/dify-ui/src/input-group/index.tsx@@ -0,0 +1,110 @@+'use client'++import type { Input as BaseInputNS } from '@base-ui/react/input'+import type { VariantProps } from 'class-variance-authority'+import type * as React from 'react'+import { Input as BaseInput } from '@base-ui/react/input'+import { cva } from 'class-variance-authority'+import { cn } from '../cn'++const interactiveElementSelector =+ 'button,a[href],[role="button"],[role="link"],select,[tabindex]:not([tabindex="-1"]),input:not([type="hidden"]):not([disabled]),[contenteditable]:not([contenteditable="false"]),textarea:not([disabled])'++type InputGroupProps = React.ComponentProps<'div'>++function InputGroup({ className, onMouseDown, ...props }: InputGroupProps) {+ return (+ // oxlint-disable-next-line jsx-a11y/no-static-element-interactions -- The handler extends the native input's pointer target; keyboard users reach the input directly.+ <div+ {...props}+ className={cn(+ [+ 'flex min-h-8 w-full min-w-0 items-center rounded-lg border border-transparent bg-components-input-bg-normal transition-[background-color,border-color,box-shadow]',+ 'has-[>input:enabled]:not-has-[>input[readonly]]:hover:border-components-input-border-hover has-[>input:enabled]:not-has-[>input[readonly]]:hover:bg-components-input-bg-hover',+ 'has-[>input:focus]:not-has-[>input[readonly]]:border-components-input-border-active has-[>input:focus]:not-has-[>input[readonly]]:bg-components-input-bg-active has-[>input:focus]:not-has-[>input[readonly]]:shadow-xs',+ 'has-[>input[data-invalid]]:border-components-input-border-destructive has-[>input[data-invalid]]:bg-components-input-bg-destructive',+ 'has-[>input[data-disabled]]:cursor-not-allowed has-[>input[data-disabled]]:border-transparent has-[>input[data-disabled]]:bg-components-input-bg-disabled has-[>input[data-disabled]]:text-components-input-text-filled-disabled',+ 'has-[>input[data-disabled]]:*:data-align:cursor-not-allowed has-[>input[data-disabled]]:*:data-align:text-components-input-text-filled-disabled',+ 'has-[>input[readonly]]:cursor-default has-[>input[readonly]]:*:data-align:cursor-default',+ 'has-[>input[readonly]:focus-visible]:ring-2 has-[>input[readonly]:focus-visible]:ring-state-accent-solid',+ 'has-[>[data-align=inline-start]]:[&>input]:ps-0',+ 'has-[>[data-align=inline-end]]:[&>input]:pe-0',+ 'motion-reduce:transition-none',+ ],+ className,+ )}+ onMouseDown={(event) => {+ onMouseDown?.(event)+ if (event.defaultPrevented || event.button !== 0) return++ const eventPath = event.nativeEvent.composedPath()+ if (!eventPath.includes(event.currentTarget)) return++ const target = eventPath[0]+ const ElementConstructor = event.currentTarget.ownerDocument.defaultView?.Element+ if (!ElementConstructor || !(target instanceof ElementConstructor)) return+ if (target !== event.currentTarget && target.closest(interactiveElementSelector)) return++ const input = event.currentTarget.querySelector<HTMLInputElement>(':scope > input')+ if (!input || input.disabled) return++ event.preventDefault()+ input.focus()+ }}+ />+ )+}++type InputGroupInputProps = Omit<BaseInputNS.Props, 'className' | 'render' | 'size'> & {+ className?: string+}++function InputGroupInput({ className, ...props }: InputGroupInputProps) {+ return (+ <BaseInput+ {...props}+ className={cn(+ [+ 'w-0 min-w-0 flex-1 appearance-none rounded-none border-0 bg-transparent px-3 py-1.75 system-sm-regular text-components-input-text-filled caret-primary-600 outline-hidden',+ 'placeholder:text-components-input-text-placeholder',+ 'read-only:cursor-default',+ 'disabled:cursor-not-allowed disabled:text-components-input-text-filled-disabled',+ ],+ className,+ )}+ />+ )+}++const inputGroupAddonVariants = cva(+ 'flex shrink-0 cursor-text items-center self-stretch system-sm-regular text-text-secondary select-none',+ {+ variants: {+ align: {+ 'inline-start': 'order-first ps-2 pe-1',+ 'inline-end': 'order-last ps-1 pe-2',+ },+ },+ defaultVariants: {+ align: 'inline-start',+ },+ },+)++type InputGroupAddonProps = Omit<React.ComponentPropsWithRef<'div'>, 'className'> &+ VariantProps<typeof inputGroupAddonVariants> & {+ className?: string+ }++function InputGroupAddon({ align = 'inline-start', className, ...props }: InputGroupAddonProps) {+ return (+ <div+ {...props}+ data-align={align}+ className={cn(inputGroupAddonVariants({ align }), className)}+ />+ )+}++export { InputGroup, InputGroupAddon, InputGroupInput }+export type { InputGroupAddonProps, InputGroupInputProps, InputGroupProps }diff --git a/packages/dify-ui/src/input/__tests__/index.spec.tsx b/packages/dify-ui/src/input/__tests__/index.spec.tsxindex 0bcdf350bde..244886936c6 100644--- a/packages/dify-ui/src/input/__tests__/index.spec.tsx+++ b/packages/dify-ui/src/input/__tests__/index.spec.tsx@@ -1,9 +1,21 @@+import { userEvent } from 'vite-plus/test/browser'import { render } from 'vitest-browser-react'import { Field, FieldError, FieldLabel } from '../../field'import { Form } from '../../form'import { Input } from '../index'describe('Input', () => {+ it('should show keyboard focus when read-only', async () => {+ const screen = await render(<Input aria-label="API key" defaultValue="sk-test" readOnly />)+ const input = screen.getByRole('textbox', { name: 'API key' })+ const restingBoxShadow = getComputedStyle(input.element()).boxShadow++ await userEvent.keyboard('{Tab}')++ await expect.element(input).toHaveFocus()+ await expect.poll(() => getComputedStyle(input.element()).boxShadow).not.toBe(restingBoxShadow)+ })+it('should use Field invalid state', async () => {const screen = await render(<Field name="repositoryUrl" invalid>diff --git a/packages/dify-ui/src/input/index.stories.tsx b/packages/dify-ui/src/input/index.stories.tsxindex a8d76bd9bfa..560bad85856 100644--- a/packages/dify-ui/src/input/index.stories.tsx+++ b/packages/dify-ui/src/input/index.stories.tsx@@ -12,7 +12,7 @@ const meta = {docs: {description: {component:- 'A standalone text input primitive built on Base UI Input. Use it for labelled text boxes outside FieldControl, and keep FieldControl for full Field form composition.',+ 'The standalone Dify text input built on Base UI Input. Compose it with Field for labels, descriptions, and validation; use InputGroupInput for controls inside an InputGroup.',},},},@@ -42,42 +42,6 @@ export const Basic: Story = {),}-export const Sizes: Story = {- render: () => (- <div className="grid w-80 gap-3">- <label className="grid gap-1 system-sm-medium text-text-secondary" htmlFor="small-input">- Small- <Input- id="small-input"- size="small"- name="smallInput"- placeholder="e.g. tag…"- autoComplete="off"- />- </label>- <label className="grid gap-1 system-sm-medium text-text-secondary" htmlFor="medium-input">- Medium- <Input- id="medium-input"- name="mediumInput"- placeholder="e.g. Production API…"- autoComplete="off"- />- </label>- <label className="grid gap-1 system-sm-medium text-text-secondary" htmlFor="large-input">- Large- <Input- id="large-input"- size="large"- name="largeInput"- placeholder="e.g. Customer portal…"- autoComplete="off"- />- </label>- </div>- ),-}-export const States: Story = {render: () => (<div className="grid w-80 gap-3">diff --git a/packages/dify-ui/src/input/index.tsx b/packages/dify-ui/src/input/index.tsxindex 1cbb516ab68..9a7aa121e99 100644--- a/packages/dify-ui/src/input/index.tsx+++ b/packages/dify-ui/src/input/index.tsx@@ -1,18 +1,34 @@'use client'import type { Input as BaseInputNS } from '@base-ui/react/input'-import type { VariantProps } from 'class-variance-authority'import { Input as BaseInput } from '@base-ui/react/input'import { cn } from '../cn'-import { textControlVariants } from '../form-control-shared'+import { textControlFocusClassName } from '../form-control-shared'-type InputProps = Omit<BaseInputNS.Props, 'className' | 'size'> &- VariantProps<typeof textControlVariants> & {- className?: string- }+type InputProps = Omit<BaseInputNS.Props, 'className' | 'size'> & {+ className?: string+}-function Input({ className, size = 'medium', ...props }: InputProps) {- return <BaseInput className={cn(textControlVariants({ size }), className)} {...props} />+function Input({ className, ...props }: InputProps) {+ return (+ <BaseInput+ className={cn(+ [+ 'w-full appearance-none rounded-lg border border-transparent bg-components-input-bg-normal px-3 py-1.75 system-sm-regular text-components-input-text-filled caret-primary-600 outline-hidden transition-[background-color,border-color,box-shadow]',+ 'placeholder:text-components-input-text-placeholder',+ 'hover:border-components-input-border-hover hover:bg-components-input-bg-hover',+ textControlFocusClassName,+ 'data-invalid:border-components-input-border-destructive data-invalid:bg-components-input-bg-destructive',+ 'read-only:cursor-default read-only:shadow-none read-only:hover:border-transparent read-only:hover:bg-components-input-bg-normal read-only:focus:border-transparent read-only:focus:bg-components-input-bg-normal read-only:focus:shadow-none read-only:focus-visible:ring-2 read-only:focus-visible:ring-state-accent-solid',+ 'disabled:cursor-not-allowed disabled:border-transparent disabled:bg-components-input-bg-disabled disabled:text-components-input-text-filled-disabled',+ 'disabled:hover:border-transparent disabled:hover:bg-components-input-bg-disabled',+ 'motion-reduce:transition-none',+ ],+ className,+ )}+ {...props}+ />+ )}export { Input }diff --git a/packages/dify-ui/src/number-field/__tests__/index.spec.tsx b/packages/dify-ui/src/number-field/__tests__/index.spec.tsxindex d81ea972be7..a0c6955a9e1 100644--- a/packages/dify-ui/src/number-field/__tests__/index.spec.tsx+++ b/packages/dify-ui/src/number-field/__tests__/index.spec.tsx@@ -7,6 +7,7 @@ import type {NumberFieldUnitProps,} from '../index'import * as React from 'react'+import { userEvent } from 'vite-plus/test/browser'import { render } from 'vitest-browser-react'import { Field, FieldLabel } from '../../field'import {@@ -62,6 +63,20 @@ const renderNumberField = ({describe('NumberField wrapper', () => {describe('Group and input', () => {+ it('should show the compound focus surface when keyboard users enter without Field', async () => {+ const screen = await renderNumberField()+ const group = screen.getByTestId('group')+ const input = screen.getByRole('textbox', { name: 'Amount' })+ const restingBoxShadow = getComputedStyle(group.element()).boxShadow++ await userEvent.keyboard('{Tab}')++ await expect.element(input).toHaveFocus()+ await expect+ .poll(() => getComputedStyle(group.element()).boxShadow)+ .not.toBe(restingBoxShadow)+ })+it('should merge custom className on the group', async () => {const screen = await renderNumberField({groupProps: {diff --git a/packages/dify-ui/src/number-field/index.tsx b/packages/dify-ui/src/number-field/index.tsxindex 350a5bb24e3..97a4c58beb2 100644--- a/packages/dify-ui/src/number-field/index.tsx+++ b/packages/dify-ui/src/number-field/index.tsx@@ -5,7 +5,7 @@ import type * as React from 'react'import { NumberField as BaseNumberField } from '@base-ui/react/number-field'import { cva } from 'class-variance-authority'import { cn } from '../cn'-import { textControlCompoundFocusClassName } from '../form-control-shared'+import { textControlCompoundInputFocusClassName } from '../form-control-shared'const NumberField = BaseNumberField.Roottype NumberFieldProps = BaseNumberField.Root.Props@@ -14,7 +14,7 @@ const numberFieldGroupVariants = cva(['group/number-field flex w-full min-w-0 items-stretch overflow-hidden border border-transparent bg-components-input-bg-normal text-components-input-text-filled shadow-none outline-hidden transition-[background-color,border-color,box-shadow]','hover:border-components-input-border-hover hover:bg-components-input-bg-hover',- textControlCompoundFocusClassName,+ textControlCompoundInputFocusClassName,'data-focused:border-components-input-border-active data-focused:bg-components-input-bg-active data-focused:shadow-xs','data-invalid:border-components-input-border-destructive data-invalid:bg-components-input-bg-destructive','data-disabled:cursor-not-allowed data-disabled:border-transparent data-disabled:bg-components-input-bg-disabled data-disabled:text-components-input-text-filled-disabled',diff --git a/web/AGENTS.md b/web/AGENTS.mdindex d10bace7ece..44e702f2ef9 100644--- a/web/AGENTS.md+++ b/web/AGENTS.md@@ -9,6 +9,7 @@- User-facing strings must use `web/i18n/en-US/` keys. When adding or renaming a key, update every supported locale with the correct localized value.- For new backend calls and migrated surfaces, use generated `consoleQuery` / `consoleClient` APIs from `@/service/client`. Do not add handwritten REST helpers or DTO mirrors, mock-backed app state, or direct edits to generated contracts.- Prefer `@langgenius/dify-ui/*` primitives, data attributes, and design tokens. Preserve a visible focus indicator on the final focusable element.+- Use Dify UI `Input` for a standalone text control and `InputGroup` when a prefix, suffix, or action shares its visual surface. Reuse the Web `SearchInput` composite for its standard search, clear, and IME behavior instead of rebuilding it. See the canonical [form and input composition contract].- Use `Button` for actions with visible text and `IconButton` for icon-only actions. Every `IconButton` needs an `aria-label` or `aria-labelledby`, and its decorative glyph must be `aria-hidden`. Compose Menu, Popover, Toggle, and Collapsible through `render` so those primitives keep ownership of their state. See the canonical [IconButton contract].- Follow `docs/overlay.md` for overlay selection. Do not introduce a generic web wrapper that recreates Dify UI portal, backdrop, positioning, or z-index behavior.- For custom SVG icons, follow `../packages/iconify-collections/README.md`; do not add generated React icons under `app/components/base/icons/src/`.@@ -25,3 +26,4 @@ This block is written and re-added by `next dev` — verify at `node_modules/nex<!-- END:nextjs-agent-rules -->[IconButton contract]: ../packages/dify-ui/README.md#icon-button-contract+[form and input composition contract]: ../packages/dify-ui/README.md#form-contractdiff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsxindex 0884b6fb0c7..5bd56a71024 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,7 +1,10 @@'use client'import { Button } from '@langgenius/dify-ui/button'-import { Field, FieldControl, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'+import { IconButton } from '@langgenius/dify-ui/icon-button'+import { Input } from '@langgenius/dify-ui/input'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'import { toast } from '@langgenius/dify-ui/toast'import { useEffect, useState } from 'react'import { useTranslation } from 'react-i18next'@@ -111,7 +114,7 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAut{t(($) => $.email, { ns: 'login' })}</FieldLabel><div className="mt-1">- <FieldControl+ <Inputvalue={email}onValueChange={setEmail}id="email"@@ -137,8 +140,8 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAut{t(($) => $.forget, { ns: 'login' })}</Link></div>- <div className="relative mt-1">- <FieldControl+ <InputGroup className="mt-1">+ <InputGroupInputvalue={password}onValueChange={setPassword}id="password"@@ -147,9 +150,9 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAutspellCheck={false}placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}/>- <div className="absolute inset-y-0 right-0 flex items-center">- <Button- type="button"+ <InputGroupAddon align="inline-end">+ <IconButton+ size="lg"variant="ghost"aria-label={t(($) => $[showPassword ? 'hidePassword' : 'showPassword'], {ns: 'login',@@ -157,9 +160,9 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAutonClick={() => setShowPassword(!showPassword)}><span aria-hidden="true">{showPassword ? '👀' : '😝'}</span>- </Button>- </div>- </div>+ </IconButton>+ </InputGroupAddon>+ </InputGroup></Field><div className="mb-2">diff --git a/web/app/account/(commonLayout)/account-page/index.tsx b/web/app/account/(commonLayout)/account-page/index.tsxindex 01f9e9ddf2a..2c21ef117c5 100644--- a/web/app/account/(commonLayout)/account-page/index.tsx+++ b/web/app/account/(commonLayout)/account-page/index.tsx@@ -4,10 +4,13 @@ import type { IItem } from '@/app/components/header/account-setting/collapse'import { zIconType } from '@dify/contracts/api/console/apps/zod.gen'import { Button } from '@langgenius/dify-ui/button'import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'+import { IconButton } from '@langgenius/dify-ui/icon-button'import { Input } from '@langgenius/dify-ui/input'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'import { toast } from '@langgenius/dify-ui/toast'import { useQuery, useQueryClient, useSuspenseQuery } from '@tanstack/react-query'-import { useState } from 'react'+import { useId, useState } from 'react'import { useTranslation } from 'react-i18next'import AppIcon from '@/app/components/base/app-icon'import PremiumBadge from '@/app/components/base/premium-badge'@@ -32,6 +35,7 @@ type AccountAppItem = AppPartial & IItemexport default function AccountPage() {const { t } = useTranslation()+ const editNameInputId = useId()const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())const { data: appList } = useQuery(consoleQuery.apps.get.queryOptions({@@ -266,8 +270,15 @@ export default function AccountPage() {<div className="mb-6 title-2xl-semi-bold text-text-primary">{t(($) => $['account.editName'], { ns: 'common' })}</div>- <div className={titleClassName}>{t(($) => $['account.name'], { ns: 'common' })}</div>- <Input className="mt-2" value={editName} onChange={(e) => setEditName(e.target.value)} />+ <label htmlFor={editNameInputId} className={`block ${titleClassName}`}>+ {t(($) => $['account.name'], { ns: 'common' })}+ </label>+ <Input+ id={editNameInputId}+ className="mt-2"+ value={editName}+ onChange={(e) => setEditName(e.target.value)}+ /><div className="mt-10 flex justify-end"><Button className="mr-2" onClick={() => setEditNameModalVisible(false)}>{t(($) => $['operation.cancel'], { ns: 'common' })}@@ -289,64 +300,84 @@ export default function AccountPage() {: t(($) => $['account.setPassword'], { ns: 'common' })}</div>{userProfile.is_password_set && (- <>- <div className={titleClassName}>+ <Field name="current-password" className="gap-0">+ <FieldLabel className="py-0 system-sm-semibold text-text-secondary">{t(($) => $['account.currentPassword'], { ns: 'common' })}- </div>- <div className="relative mt-2">- <Input+ </FieldLabel>+ <InputGroup className="mt-2">+ <InputGroupInputtype={showCurrentPassword ? 'text' : 'password'}value={currentPassword}- onChange={(e) => setCurrentPassword(e.target.value)}+ onValueChange={setCurrentPassword}+ autoComplete="current-password"+ spellCheck={false}/>- <div className="absolute inset-y-0 right-0 flex items-center">- <Button- type="button"- variant="ghost"+ <InputGroupAddon align="inline-end">+ <IconButton+ size="lg"+ aria-label={t(($) => $[showCurrentPassword ? 'hidePassword' : 'showPassword'], {+ ns: 'login',+ })}onClick={() => setShowCurrentPassword(!showCurrentPassword)}>- {showCurrentPassword ? '👀' : '😝'}- </Button>- </div>- </div>- </>+ <span aria-hidden="true">{showCurrentPassword ? '👀' : '😝'}</span>+ </IconButton>+ </InputGroupAddon>+ </InputGroup>+ </Field>)}- <div className="mt-8 system-sm-semibold text-text-secondary">- {userProfile.is_password_set- ? t(($) => $['account.newPassword'], { ns: 'common' })- : t(($) => $['account.password'], { ns: 'common' })}- </div>- <div className="relative mt-2">- <Input- type={showPassword ? 'text' : 'password'}- value={password}- onChange={(e) => setPassword(e.target.value)}- />- <div className="absolute inset-y-0 right-0 flex items-center">- <Button type="button" variant="ghost" onClick={() => setShowPassword(!showPassword)}>- {showPassword ? '👀' : '😝'}- </Button>- </div>- </div>- <div className="mt-8 system-sm-semibold text-text-secondary">- {t(($) => $['account.confirmPassword'], { ns: 'common' })}- </div>- <div className="relative mt-2">- <Input- type={showConfirmPassword ? 'text' : 'password'}- value={confirmPassword}- onChange={(e) => setConfirmPassword(e.target.value)}- />- <div className="absolute inset-y-0 right-0 flex items-center">- <Button- type="button"- variant="ghost"- onClick={() => setShowConfirmPassword(!showConfirmPassword)}- >- {showConfirmPassword ? '👀' : '😝'}- </Button>- </div>- </div>+ <Field name="new-password" className="mt-8 gap-0">+ <FieldLabel className="py-0 system-sm-semibold text-text-secondary">+ {userProfile.is_password_set+ ? t(($) => $['account.newPassword'], { ns: 'common' })+ : t(($) => $['account.password'], { ns: 'common' })}+ </FieldLabel>+ <InputGroup className="mt-2">+ <InputGroupInput+ type={showPassword ? 'text' : 'password'}+ value={password}+ onValueChange={setPassword}+ autoComplete="new-password"+ spellCheck={false}+ />+ <InputGroupAddon align="inline-end">+ <IconButton+ size="lg"+ aria-label={t(($) => $[showPassword ? 'hidePassword' : 'showPassword'], {+ ns: 'login',+ })}+ onClick={() => setShowPassword(!showPassword)}+ >+ <span aria-hidden="true">{showPassword ? '👀' : '😝'}</span>+ </IconButton>+ </InputGroupAddon>+ </InputGroup>+ </Field>+ <Field name="confirm-password" className="mt-8 gap-0">+ <FieldLabel className="py-0 system-sm-semibold text-text-secondary">+ {t(($) => $['account.confirmPassword'], { ns: 'common' })}+ </FieldLabel>+ <InputGroup className="mt-2">+ <InputGroupInput+ type={showConfirmPassword ? 'text' : 'password'}+ value={confirmPassword}+ onValueChange={setConfirmPassword}+ autoComplete="new-password"+ spellCheck={false}+ />+ <InputGroupAddon align="inline-end">+ <IconButton+ size="lg"+ aria-label={t(($) => $[showConfirmPassword ? 'hidePassword' : 'showPassword'], {+ ns: 'login',+ })}+ onClick={() => setShowConfirmPassword(!showConfirmPassword)}+ >+ <span aria-hidden="true">{showConfirmPassword ? '👀' : '😝'}</span>+ </IconButton>+ </InputGroupAddon>+ </InputGroup>+ </Field><div className="mt-10 flex justify-end"><ButtonclassName="mr-2"diff --git a/web/app/account/(commonLayout)/delete-account/components/check-email.tsx b/web/app/account/(commonLayout)/delete-account/components/check-email.tsxindex 63d07d562de..fb555d32f79 100644--- a/web/app/account/(commonLayout)/delete-account/components/check-email.tsx+++ b/web/app/account/(commonLayout)/delete-account/components/check-email.tsx@@ -44,10 +44,14 @@ export default function CheckEmail(props: DeleteAccountProps) {{t(($) => $['account.deletePrivacyLink'], { ns: 'common' })}</Link></div>- <label className="mt-3 mb-1 flex h-6 items-center system-sm-semibold text-text-secondary">+ <label+ htmlFor="delete-account-email"+ className="mt-3 mb-1 flex h-6 items-center system-sm-semibold text-text-secondary"+ >{t(($) => $['account.deleteLabel'], { ns: 'common' })}</label><Input+ id="delete-account-email"placeholder={t(($) => $['account.deletePlaceholder'], { ns: 'common' }) as string}onChange={(e) => {setUserInputEmail(e.target.value)diff --git a/web/app/components/access-rules-editor/add-access-subject-popover.tsx b/web/app/components/access-rules-editor/add-access-subject-popover.tsxindex 965f7744dac..c86e2ee4692 100644--- a/web/app/components/access-rules-editor/add-access-subject-popover.tsx+++ b/web/app/components/access-rules-editor/add-access-subject-popover.tsx@@ -5,7 +5,7 @@ import type { Member } from '@/models/common'import { Avatar } from '@langgenius/dify-ui/avatar'import { Button } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'-import { Input } from '@langgenius/dify-ui/input'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover'import { memo, useCallback, useMemo, useState } from 'react'import { useTranslation } from 'react-i18next'@@ -83,22 +83,24 @@ function AddAccessSubjectPopover({}}><div className="p-2 pb-1">- <div className="relative">- <span- className="pointer-events-none absolute top-1/2 left-2 i-ri-search-line size-4 -translate-y-1/2 text-components-input-text-placeholder"- aria-hidden="true"- />- <Input+ <InputGroup>+ <InputGroupInputtype="search"aria-label={t(($) => $['operation.search'], { ns: 'common' })}value={searchValue}placeholder={t(($) => $['placeholder.search'], { ns: 'common' })}- className="h-8 ps-7 [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none"+ className="[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none"onValueChange={setSearchValue}autoComplete="off"enterKeyHint="search"/>- </div>+ <InputGroupAddon className="ps-1.75 pe-1.25">+ <span+ className="i-ri-search-line size-4 text-components-input-text-placeholder"+ aria-hidden="true"+ />+ </InputGroupAddon>+ </InputGroup></div>{isLoading ? (<div className="flex h-20 items-center justify-center p-1">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.tsxindex 94d28a856be..24678f42aff 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@@ -12,7 +12,9 @@ import {AlertDialogDescription,AlertDialogTitle,} from '@langgenius/dify-ui/alert-dialog'-import { Input } from '@langgenius/dify-ui/input'+import { Button } from '@langgenius/dify-ui/button'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'import * as React from 'react'import { useCallback, useState } from 'react'import { Trans, useTranslation } from 'react-i18next'@@ -64,7 +66,6 @@ const AppInfoModals = ({const { t } = useTranslation()const [confirmDeleteInput, setConfirmDeleteInput] = useState('')const [isSecretExporting, setIsSecretExporting] = useState(false)- const confirmDeleteInputId = React.useId()const isDeleteConfirmDisabled = confirmDeleteInput !== appDetail.nameconst exportDialogMode =secretEnvList.length > 0 ? 'secret' : activeModal === 'exportWarning' ? 'warning' : null@@ -147,11 +148,8 @@ const AppInfoModals = ({<AlertDialogDescription className="w-full system-md-regular wrap-break-word whitespace-pre-wrap text-text-tertiary">{t(($) => $.deleteAppConfirmContent, { ns: 'app' })}</AlertDialogDescription>- <div className="mt-2">- <label- htmlFor={confirmDeleteInputId}- className="mb-1 block system-sm-regular text-text-secondary"- >+ <Field name="confirm-app-name" className="mt-2 gap-0">+ <FieldLabel className="mb-1 block py-0 system-sm-regular text-text-secondary"><Transi18nKey={($) => $.deleteAppConfirmInputLabel}ns="app"@@ -162,27 +160,28 @@ const AppInfoModals = ({),}}/>- </label>- <div className="relative">- <Input- id={confirmDeleteInputId}+ </FieldLabel>+ <InputGroup>+ <InputGroupInputtype="text"autoComplete="off"spellCheck={false}placeholder={t(($) => $.deleteAppConfirmInputPlaceholder, { ns: 'app' })}value={confirmDeleteInput}- onChange={(e) => setConfirmDeleteInput(e.target.value)}- className="pr-20"+ onValueChange={setConfirmDeleteInput}/>- <button- type="button"- onClick={() => setConfirmDeleteInput(appDetail.name)}- className="absolute top-1/2 right-2 -translate-y-1/2 rounded-full bg-black/6 px-2.5 py-1 system-xs-medium text-text-secondary hover:bg-black/10"- >- {t(($) => $['operation.fill'], { ns: 'common' })}- </button>- </div>- </div>+ <InputGroupAddon align="inline-end" className="min-w-20 justify-end pe-1.75">+ <Button+ variant="tertiary"+ size="small"+ onClick={() => setConfirmDeleteInput(appDetail.name)}+ className="rounded-full px-2.5"+ >+ {t(($) => $['operation.fill'], { ns: 'common' })}+ </Button>+ </InputGroupAddon>+ </InputGroup>+ </Field></div><AlertDialogActions><AlertDialogCancelButton type="button">diff --git a/web/app/components/app/app-publisher/version-info-modal.tsx b/web/app/components/app/app-publisher/version-info-modal.tsxindex d693c64efea..2a5deb45ed9 100644--- a/web/app/components/app/app-publisher/version-info-modal.tsx+++ b/web/app/components/app/app-publisher/version-info-modal.tsx@@ -2,7 +2,8 @@ import type { WorkflowResponse } from '@dify/contracts/api/console/apps/types.geimport type { FC } from 'react'import { Button } from '@langgenius/dify-ui/button'import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'-import { Field, FieldControl, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'+import { Input } from '@langgenius/dify-ui/input'import { Textarea } from '@langgenius/dify-ui/textarea'import { toast } from '@langgenius/dify-ui/toast'import { useCallback, useState } from 'react'@@ -93,7 +94,7 @@ const VersionInfoModal: FC<VersionInfoModalProps> = ({<FieldLabel className="flex h-6 items-center py-0 system-sm-semibold text-text-secondary">{t(($) => $['versionHistory.editField.title'], { ns: 'workflow' })}</FieldLabel>- <FieldControl+ <Inputvalue={title}placeholder={`${t(($) => $['versionHistory.nameThisVersion'], { ns: 'workflow' })}${t(($) => $['panel.optional'], { ns: 'workflow' })}`}onValueChange={setTitle}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.tsxindex 359152b59ca..b20ae9bf355 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@@ -59,6 +59,7 @@ const Apps = ({ onSuccess, onCreateFromBlank }: AppsProps) => {const [keywords, setKeywords] = useState('')const [searchKeywords, setSearchKeywords] = useState('')+ const searchInputRef = React.useRef<HTMLInputElement>(null)const { run: handleSearch } = useDebounceFn(() => {@@ -195,7 +196,13 @@ const Apps = ({ onSuccess, onCreateFromBlank }: AppsProps) => {</div><div className="relative w-full flex-1"><Input- className="w-full border-transparent bg-transparent pr-7 hover:border-transparent hover:bg-transparent focus:border-transparent focus:bg-transparent focus:shadow-none"+ ref={searchInputRef}+ type="search"+ name="query"+ autoComplete="off"+ enterKeyHint="search"+ aria-label={t(($) => $['newAppFromTemplate.searchAllTemplate'], { ns: 'app' })}+ className="w-full border-transparent bg-transparent pr-7 hover:border-transparent hover:bg-transparent focus:border-transparent focus:bg-transparent focus:shadow-none [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none"placeholder={t(($) => $['newAppFromTemplate.searchAllTemplate'], { ns: 'app' })}value={keywords}onChange={(e) => handleKeywordsChange(e.target.value)}@@ -204,8 +211,11 @@ const Apps = ({ onSuccess, onCreateFromBlank }: AppsProps) => {<buttontype="button"aria-label={t(($) => $['operation.clear'], { ns: 'common' })}- className="group absolute top-1/2 right-2 -translate-y-1/2 border-none bg-transparent p-px"- onClick={() => handleKeywordsChange('')}+ className="group absolute top-1/2 right-2 -translate-y-1/2 rounded-sm border-none bg-transparent p-px outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid"+ onClick={() => {+ handleKeywordsChange('')+ searchInputRef.current?.focus()+ }}><spanaria-hiddendiff --git a/web/app/components/app/create-app-modal/index.tsx b/web/app/components/app/create-app-modal/index.tsxindex b31a5037320..fd0ad9311b6 100644--- a/web/app/components/app/create-app-modal/index.tsx+++ b/web/app/components/app/create-app-modal/index.tsx@@ -13,7 +13,7 @@ import { formatForDisplay, useHotkey } from '@tanstack/react-hotkeys'import { useMutation, useSuspenseQuery } from '@tanstack/react-query'import { useDebounceFn } from 'ahooks'import { useAtomValue } from 'jotai'-import { useCallback, useRef, useState } from 'react'+import { useCallback, useId, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'import AppIcon from '@/app/components/base/app-icon'import Divider from '@/app/components/base/divider'@@ -53,6 +53,7 @@ const shouldExpandBeginnerAppTypes = (appMode?: AppModeEnum) => {function CreateApp({ onClose, onSuccess, onCreateFromTemplate, defaultAppMode }: CreateAppProps) {const { t } = useTranslation()const { push } = useRouter()+ const nameInputId = useId()const [appMode, setAppMode] = useState<AppModeEnum>(defaultAppMode || AppModeEnum.ADVANCED_CHAT)const [appIcon, setAppIcon] = useState<AppIconSelection>({@@ -290,11 +291,12 @@ function CreateApp({ onClose, onSuccess, onCreateFromTemplate, defaultAppMode }:<div className="flex items-center space-x-3"><div className="flex-1"><div className="mb-1 flex h-6 items-center">- <label className="system-sm-semibold text-text-secondary">+ <label htmlFor={nameInputId} className="system-sm-semibold text-text-secondary">{t(($) => $['newApp.captionName'], { ns: 'app' })}</label></div><Input+ id={nameInputId}value={name}onChange={(e) => setName(e.target.value)}placeholder={t(($) => $['newApp.appNamePlaceholder'], { ns: 'app' }) || ''}diff --git a/web/app/components/app/create-from-dsl-modal/index.tsx b/web/app/components/app/create-from-dsl-modal/index.tsxindex fb386c4e794..792fcea8c91 100644--- a/web/app/components/app/create-from-dsl-modal/index.tsx+++ b/web/app/components/app/create-from-dsl-modal/index.tsx@@ -11,9 +11,10 @@ import {DialogPortal,DialogTitle,} from '@langgenius/dify-ui/dialog'-import { Field, FieldControl, FieldError, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'import { IconButton } from '@langgenius/dify-ui/icon-button'+import { Input } from '@langgenius/dify-ui/input'import { Kbd, KbdGroup } from '@langgenius/dify-ui/kbd'import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'import { toast } from '@langgenius/dify-ui/toast'@@ -309,7 +310,7 @@ function CreateFromDSLModal({><Field name="dslUrl"><FieldLabel>{t(($) => $.importFromDSLUrl, { ns: 'app' })}</FieldLabel>- <FieldControl+ <Inputtype="url"inputMode="url"autoComplete="off"diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsxindex 61ea0ff3f5f..b8bbfc28407 100644--- a/web/app/components/app/overview/settings/index.tsx+++ b/web/app/components/app/overview/settings/index.tsx@@ -5,7 +5,7 @@ import type { AppIconType, Language, SiteConfig } from '@/types/app'import { Button } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'import { Dialog, DialogCloseButton, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'-import { Field, FieldControl, FieldDescription, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldDescription, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'import { Input } from '@langgenius/dify-ui/input'import {@@ -411,7 +411,7 @@ const SettingsModal: FC<ISettingsModalProps> = ({<FieldLabel>{t(($) => $[`${prefixSettings}.webName`], { ns: 'appOverview' })}</FieldLabel>- <FieldControl+ <Inputvalue={inputInfo.title}onValueChange={(value) =>setInputInfo((item) => ({ ...item, title: value }))@@ -510,7 +510,10 @@ const SettingsModal: FC<ISettingsModalProps> = ({</div></div><Field name="chat_color_theme" className="w-50 shrink-0">- <FieldControl+ <Input+ aria-label={t(($) => $[`${prefixSettings}.chatColorTheme`], {+ ns: 'appOverview',+ })}className="mb-1"value={inputInfo.chatColorTheme ?? ''}onValueChange={(value) =>diff --git a/web/app/components/app/switch-app-modal/index.tsx b/web/app/components/app/switch-app-modal/index.tsxindex d3f8b29d85f..821513f2e8f 100644--- a/web/app/components/app/switch-app-modal/index.tsx+++ b/web/app/components/app/switch-app-modal/index.tsx@@ -18,7 +18,7 @@ import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'import { Input } from '@langgenius/dify-ui/input'import { toast } from '@langgenius/dify-ui/toast'import { useMutation, useSuspenseQuery } from '@tanstack/react-query'-import { useState } from 'react'+import { useId, useState } from 'react'import { useTranslation } from 'react-i18next'import { useStore as useAppStore } from '@/app/components/app/store'import AppIcon from '@/app/components/base/app-icon'@@ -43,6 +43,7 @@ type SwitchAppModalProps = {const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onClose }: SwitchAppModalProps) => {const { push, replace } = useRouter()+ const nameInputId = useId()const { t } = useTranslation()const setAppDetail = useAppStore((s) => s.setAppDetail)const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())@@ -149,9 +150,12 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onClose }: Switc<span>{t(($) => $.switchTipEnd, { ns: 'app' })}</span></div><div className="pb-4">- <div className="py-2 text-sm leading-5 font-medium text-text-primary">+ <label+ htmlFor={nameInputId}+ className="block py-2 text-sm leading-5 font-medium text-text-primary"+ >{t(($) => $.switchLabel, { ns: 'app' })}- </div>+ </label><div className="flex items-center justify-between space-x-2"><AppIconsize="large"@@ -165,6 +169,7 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onClose }: SwitcimageUrl={appIcon.type === 'image' ? appIcon.url : undefined}/><Input+ id={nameInputId}value={name}onChange={(e) => setName(e.target.value)}placeholder={t(($) => $['newApp.appNamePlaceholder'], { ns: 'app' }) || ''}diff --git a/web/app/components/apps/__tests__/creators-filter.spec.tsx b/web/app/components/apps/__tests__/creators-filter.spec.tsxindex c7b53bfefdd..9d905f39e38 100644--- a/web/app/components/apps/__tests__/creators-filter.spec.tsx+++ b/web/app/components/apps/__tests__/creators-filter.spec.tsx@@ -61,7 +61,9 @@ describe('CreatorsFilter', () => {fireEvent.click(screen.getByRole('button', { name: 'common.operation.clear' }))- expect(screen.getByPlaceholderText('app.studio.filters.searchCreators')).toHaveValue('')+ const searchInput = screen.getByPlaceholderText('app.studio.filters.searchCreators')+ expect(searchInput).toHaveValue('')+ expect(searchInput).toHaveFocus()fireEvent.click(screen.getByRole('button', { name: /Bob/ }))diff --git a/web/app/components/apps/app-card/action-bar/index.tsx b/web/app/components/apps/app-card/action-bar/index.tsxindex 157744975c5..f4af4986aab 100644--- a/web/app/components/apps/app-card/action-bar/index.tsx+++ b/web/app/components/apps/app-card/action-bar/index.tsx@@ -17,14 +17,16 @@ import {AlertDialogDescription,AlertDialogTitle,} from '@langgenius/dify-ui/alert-dialog'+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 { Field, FieldControl, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'import { IconButton } from '@langgenius/dify-ui/icon-button'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'import { toast } from '@langgenius/dify-ui/toast'import { Toggle } from '@langgenius/dify-ui/toggle'import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'@@ -517,24 +519,26 @@ export const AppCardActionBar = memo(}}/></FieldLabel>- <div className="relative">- <FieldControl+ <InputGroup className="border-components-input-border-hover">+ <InputGroupInputtype="text"autoComplete="off"spellCheck={false}placeholder={t(($) => $.deleteAppConfirmInputPlaceholder, { ns: 'app' })}value={confirmDeleteInput}onValueChange={setConfirmDeleteInput}- className="border-components-input-border-hover bg-components-input-bg-normal pr-20 focus:border-components-input-border-active focus:bg-components-input-bg-active"/>- <button- type="button"- onClick={() => setConfirmDeleteInput(app.name)}- className="absolute top-1/2 right-2 -translate-y-1/2 rounded-full bg-black/6 px-2.5 py-1 system-xs-medium text-text-secondary hover:bg-black/10 focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"- >- {t(($) => $['operation.fill'], { ns: 'common' })}- </button>- </div>+ <InputGroupAddon align="inline-end" className="min-w-20 justify-end pe-1.75">+ <Button+ variant="tertiary"+ size="small"+ onClick={() => setConfirmDeleteInput(app.name)}+ className="rounded-full px-2.5"+ >+ {t(($) => $['operation.fill'], { ns: 'common' })}+ </Button>+ </InputGroupAddon>+ </InputGroup></Field></div><AlertDialogActions>diff --git a/web/app/components/apps/creators-filter.tsx b/web/app/components/apps/creators-filter.tsxindex b1f0bd95ef9..be6c2b9981e 100644--- a/web/app/components/apps/creators-filter.tsx+++ b/web/app/components/apps/creators-filter.tsx@@ -10,7 +10,7 @@ import {} from '@langgenius/dify-ui/dropdown-menu'import { Input } from '@langgenius/dify-ui/input'import { useSuspenseQuery } from '@tanstack/react-query'-import { useCallback, useMemo, useState } from 'react'+import { useCallback, useMemo, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'import { userProfileQueryOptions } from '@/features/account-profile/client'import { useMembers } from '@/service/use-common'@@ -38,6 +38,7 @@ const CreatorsFilter = ({ value, onChange }: CreatorsFilterProps) => {})const { data: membersData } = useMembers()const [keywords, setKeywords] = useState('')+ const searchInputRef = useRef<HTMLInputElement>(null)const creatorOptions = useMemo<CreatorOption[]>(() => {const members = membersData?.accounts ?? []@@ -168,7 +169,16 @@ const CreatorsFilter = ({ value, onChange }: CreatorsFilterProps) => {className="pointer-events-none absolute top-1/2 left-2 i-ri-search-line size-4 -translate-y-1/2 text-components-input-text-placeholder"/><Input- className={cn('pl-6.5', keywords && 'pr-6.5')}+ ref={searchInputRef}+ type="search"+ name="creator-query"+ autoComplete="off"+ enterKeyHint="search"+ aria-label={t(($) => $['studio.filters.searchCreators'], { ns: 'app' })}+ className={cn(+ 'pl-6.5 [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none',+ keywords && 'pr-6.5',+ )}value={keywords}onChange={(e) => setKeywords(e.target.value)}placeholder={t(($) => $['studio.filters.searchCreators'], { ns: 'app' })}@@ -177,8 +187,11 @@ const CreatorsFilter = ({ value, onChange }: CreatorsFilterProps) => {<buttontype="button"aria-label={t(($) => $['operation.clear'], { ns: 'common' })}- className="absolute top-1/2 right-2 flex size-4 -translate-y-1/2 items-center justify-center text-components-input-text-placeholder hover:text-components-input-text-filled"- onClick={() => setKeywords('')}+ className="absolute top-1/2 right-2 flex size-4 -translate-y-1/2 items-center justify-center rounded-sm text-components-input-text-placeholder outline-hidden hover:text-components-input-text-filled focus-visible:ring-2 focus-visible:ring-state-accent-solid"+ onClick={() => {+ setKeywords('')+ searchInputRef.current?.focus()+ }}><span aria-hidden className="i-ri-close-circle-fill size-4" /></button>diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsxindex 2f1c2b250d6..f3e51fce7d7 100644--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx@@ -48,6 +48,7 @@ const InputField: React.FC<InputFieldProps> = ({onChange,onCancel,}) => {+ const outputVariableNameInputId = React.useId()const { t } = useTranslation()const [tempPayload, setTempPayload] = useState<FormInputItem>(() => payload || createDefaultParagraphFormInput(),@@ -235,17 +236,22 @@ const InputField: React.FC<InputFieldProps> = ({</div></div><div className="mt-3">- <div className="system-xs-medium text-text-secondary">+ <label+ htmlFor={outputVariableNameInputId}+ className="block system-xs-medium text-text-secondary"+ >{t(($) => $[`${i18nPrefix}.saveResponseAs`], { ns: 'workflow' })}<span className="relative system-xs-regular text-text-destructive-secondary">*</span>- </div>+ </label><Input+ id={outputVariableNameInputId}className="mt-1.5"placeholder={t(($) => $[`${i18nPrefix}.saveResponseAsPlaceholder`], { ns: 'workflow' })}value={tempPayload.output_variable_name}onChange={(e) => {setTempPayload((prev) => ({ ...prev, output_variable_name: e.target.value }))}}+ // oxlint-disable-next-line jsx-a11y/no-autofocus -- The field appears in a dialog opened by an explicit edit action and is the primary editing target.autoFocus/>{tempPayload.output_variable_name && variableNameError && (diff --git a/web/app/components/base/search-input/__tests__/index.spec.tsx b/web/app/components/base/search-input/__tests__/index.spec.tsxindex 8c2a8bca144..445819f89b4 100644--- a/web/app/components/base/search-input/__tests__/index.spec.tsx+++ b/web/app/components/base/search-input/__tests__/index.spec.tsx@@ -1,4 +1,5 @@import { fireEvent, render, screen } from '@testing-library/react'+import userEvent from '@testing-library/user-event'import { createRef, useState } from 'react'import { SearchInput } from '..'@@ -26,6 +27,11 @@ describe('SearchInput', () => {expect(screen.getByRole('searchbox', { name: 'Search providers' })).toBeInTheDocument()})+ it('uses a custom form name', () => {+ render(<SearchInput name="provider-query" value="" onValueChange={() => {}} />)+ expect(screen.getByRole('searchbox')).toHaveAttribute('name', 'provider-query')+ })+it('exposes the input element through its ref', () => {const ref = createRef<HTMLInputElement>()render(<SearchInput ref={ref} value="" onValueChange={() => {}} />)@@ -157,20 +163,23 @@ describe('SearchInput', () => {expect(onValueChange).toHaveBeenCalledWith('')})- it('calls onValueChange with empty string when clear button is clicked', () => {- const onValueChange = vi.fn()- render(<SearchInput value="has value" onValueChange={onValueChange} />)+ it('clears the value and returns focus to the searchbox', async () => {+ const user = userEvent.setup()++ function ControlledSearchInput() {+ const [value, setValue] = useState('has value')++ return <SearchInput value={value} onValueChange={setValue} />+ }++ render(<ControlledSearchInput />)const clearButton = screen.getByLabelText('common.operation.clear')- fireEvent.click(clearButton)- expect(onValueChange).toHaveBeenCalledWith('')- })+ await user.click(clearButton)- it('uses dify-ui input spacing for the search adornment', () => {- render(<SearchInput value="" onValueChange={() => {}} />)- const input = screen.getByRole('searchbox', { name: 'common.operation.search' })- expect(input).toHaveClass('ps-7')- expect(input).not.toHaveClass('h-[18px]')+ const searchbox = screen.getByRole('searchbox', { name: 'common.operation.search' })+ expect(searchbox).toHaveValue('')+ expect(searchbox).toHaveFocus()})})})diff --git a/web/app/components/base/search-input/index.tsx b/web/app/components/base/search-input/index.tsxindex 47772425a3e..6a50f304ac5 100644--- a/web/app/components/base/search-input/index.tsx+++ b/web/app/components/base/search-input/index.tsx@@ -1,7 +1,7 @@-import type { InputProps } from '@langgenius/dify-ui/input'+import type { InputGroupInputProps } from '@langgenius/dify-ui/input-group'import type { Ref } from 'react'-import { cn } from '@langgenius/dify-ui/cn'-import { Input } from '@langgenius/dify-ui/input'+import { IconButton } from '@langgenius/dify-ui/icon-button'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'import { useImperativeHandle, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'@@ -11,7 +11,10 @@ type SearchInputProps = {onValueChange: (value: string) => voidplaceholder?: stringclassName?: string-} & Pick<InputProps, 'aria-describedby' | 'aria-label' | 'autoFocus' | 'disabled'>+} & Pick<+ InputGroupInputProps,+ 'aria-describedby' | 'aria-label' | 'autoFocus' | 'disabled' | 'name'+>export function SearchInput({ref,@@ -19,6 +22,7 @@ export function SearchInput({className,value,onValueChange,+ name = 'query',autoFocus,disabled,'aria-describedby': ariaDescribedBy,@@ -41,22 +45,14 @@ export function SearchInput({}return (- <div className={cn('relative', className)}>- <span- className="pointer-events-none absolute top-1/2 left-2 i-ri-search-line size-4 -translate-y-1/2 text-components-input-text-placeholder"- aria-hidden="true"- />- <Input+ <InputGroup className={className}>+ <InputGroupInputref={inputRef}type="search"- name="query"+ name={name}aria-describedby={ariaDescribedBy}aria-label={ariaLabel ?? t(($) => $['operation.search'], { ns: 'common' })}- className={cn(- 'ps-7',- !!inputValue && 'pe-7',- '[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none',- )}+ className="[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none"placeholder={placeholder ?? t(($) => $['operation.search'], { ns: 'common' })}value={inputValue}disabled={disabled}@@ -94,19 +90,24 @@ export function SearchInput({autoFocus={autoFocus}enterKeyHint="search"/>+ <InputGroupAddon className="ps-1.75 pe-1.25">+ <span+ className="i-ri-search-line size-4 text-components-input-text-placeholder"+ aria-hidden="true"+ />+ </InputGroupAddon>{!!inputValue && !disabled && (- <button- type="button"- aria-label={t(($) => $['operation.clear'], { ns: 'common' })}- className="group/clear absolute top-1/2 right-1.5 flex size-5 -translate-y-1/2 cursor-pointer touch-manipulation items-center justify-center rounded-md border-none bg-transparent p-0 outline-hidden focus-visible:bg-components-input-bg-hover focus-visible:inset-ring-2 focus-visible:inset-ring-state-accent-solid"- onClick={handleClear}- >- <span- className="i-ri-close-circle-fill size-4 text-text-quaternary group-hover/clear:text-text-tertiary"- aria-hidden="true"- />- </button>+ <InputGroupAddon align="inline-end" className="ps-0.75 pe-1.25">+ <IconButton+ size="sm"+ aria-label={t(($) => $['operation.clear'], { ns: 'common' })}+ className="text-text-quaternary hover:bg-transparent hover:text-text-tertiary focus-visible:bg-components-input-bg-hover focus-visible:ring-inset"+ onClick={handleClear}+ >+ <span className="i-ri-close-circle-fill size-4" aria-hidden="true" />+ </IconButton>+ </InputGroupAddon>)}- </div>+ </InputGroup>)}diff --git a/web/app/components/datasets/settings/permission-selector/__tests__/index.spec.tsx b/web/app/components/datasets/settings/permission-selector/__tests__/index.spec.tsxindex 80ac4e7aa97..6a7d578500b 100644--- a/web/app/components/datasets/settings/permission-selector/__tests__/index.spec.tsx+++ b/web/app/components/datasets/settings/permission-selector/__tests__/index.spec.tsx@@ -206,7 +206,7 @@ describe('PermissionSelector', () => {renderSelector({ permission: DatasetPermission.partialMembers })await user.click(screen.getByRole('button', { name: /Current User/ }))- const search = screen.getByRole('textbox', { name: /operation.search/ })+ const search = screen.getByRole('searchbox', { name: /operation.search/ })await user.type(search, 'Jane')await waitFor(() => {@@ -226,7 +226,7 @@ describe('PermissionSelector', () => {renderSelector({ permission: DatasetPermission.partialMembers })await user.click(screen.getByRole('button', { name: /Current User/ }))- await user.type(screen.getByRole('textbox', { name: /operation.search/ }), 'Nobody')+ await user.type(screen.getByRole('searchbox', { name: /operation.search/ }), 'Nobody')expect(await screen.findByText(/form.onSearchResults/)).toBeInTheDocument()})diff --git a/web/app/components/datasets/settings/permission-selector/index.tsx b/web/app/components/datasets/settings/permission-selector/index.tsxindex dfd41376f5a..0cbdc8b21a5 100644--- a/web/app/components/datasets/settings/permission-selector/index.tsx+++ b/web/app/components/datasets/settings/permission-selector/index.tsx@@ -1,13 +1,13 @@import type { Member } from '@/models/common'import { Avatar } from '@langgenius/dify-ui/avatar'import { cn } from '@langgenius/dify-ui/cn'-import { Input } from '@langgenius/dify-ui/input'import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '@langgenius/dify-ui/popover'import { RadioGroup } from '@langgenius/dify-ui/radio'import { useSuspenseQuery } from '@tanstack/react-query'import { useDebounceFn } from 'ahooks'import { useMemo, useState } from 'react'import { useTranslation } from 'react-i18next'+import { SearchInput } from '@/app/components/base/search-input'import { userProfileQueryOptions } from '@/features/account-profile/client'import { systemFeaturesQueryOptions } from '@/features/system-features/client'import { DatasetPermission } from '@/models/datasets'@@ -229,34 +229,12 @@ const PermissionSelector = ({{isPartialMembers && (<div className="max-h-90 overflow-y-auto border-t border-divider-regular pr-1 pb-1 pl-1"><div className="sticky top-0 left-0 z-10 bg-components-panel-on-panel-item-bg p-2 pb-1">- <div className="relative w-full">- <span- aria-hidden="true"- className="absolute top-1/2 left-2 i-ri-search-line size-4 -translate-y-1/2 text-components-input-text-placeholder"- />- <Input- aria-label={t(($) => $['operation.search'], { ns: 'common' })}- name="member-search"- autoComplete="off"- className={cn('w-full pl-6.5', keywords && 'pr-6.5')}- value={keywords}- placeholder={t(($) => $['operation.search'], { ns: 'common' }) || ''}- onChange={(event) => handleKeywordsChange(event.target.value)}- />- {!!keywords && (- <button- type="button"- aria-label={t(($) => $['operation.clear'], { ns: 'common' })}- className="group absolute top-1/2 right-2 -translate-y-1/2 cursor-pointer touch-manipulation border-none bg-transparent p-px focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"- onClick={() => handleKeywordsChange('')}- >- <span- aria-hidden="true"- className="i-ri-close-circle-fill size-3.5 text-text-quaternary group-hover:text-text-tertiary"- />- </button>- )}- </div>+ <SearchInput+ name="member-search"+ value={keywords}+ placeholder={t(($) => $['operation.search'], { ns: 'common' }) || ''}+ onValueChange={handleKeywordsChange}+ /></div><div className="flex flex-col p-1">{showMe && (diff --git a/web/app/components/explore/create-app-modal/index.tsx b/web/app/components/explore/create-app-modal/index.tsxindex af365d97469..69524b83812 100644--- a/web/app/components/explore/create-app-modal/index.tsx+++ b/web/app/components/explore/create-app-modal/index.tsx@@ -64,6 +64,9 @@ const CreateAppModal = ({confirmDisabled,onHide,}: CreateAppModalProps) => {+ const nameInputId = React.useId()+ const descriptionInputId = React.useId()+ const maxActiveRequestsInputId = React.useId()const { t } = useTranslation()const [name, setName] = React.useState(appName)@@ -149,9 +152,12 @@ const CreateAppModal = ({<div className="mb-9">{/* icon & name */}<div className="pt-2">- <div className="py-2 text-sm leading-5 font-medium text-text-primary">+ <label+ htmlFor={nameInputId}+ className="block py-2 text-sm leading-5 font-medium text-text-primary"+ >{t(($) => $['newApp.captionName'], { ns: 'app' })}- </div>+ </label><div className="flex items-center justify-between space-x-2"><AppIconsize="large"@@ -165,6 +171,7 @@ const CreateAppModal = ({imageUrl={appIcon.type === 'image' ? appIcon.url : undefined}/><Input+ id={nameInputId}value={name}onChange={(e) => setName(e.target.value)}placeholder={t(($) => $['newApp.appNamePlaceholder'], { ns: 'app' }) || ''}@@ -174,11 +181,14 @@ const CreateAppModal = ({</div>{/* description */}<div className="pt-2">- <div className="py-2 text-sm leading-5 font-medium text-text-primary">+ <label+ htmlFor={descriptionInputId}+ className="block py-2 text-sm leading-5 font-medium text-text-primary"+ >{t(($) => $['newApp.captionDescription'], { ns: 'app' })}- </div>+ </label><Textarea- aria-label={t(($) => $['newApp.captionDescription'], { ns: 'app' })}+ id={descriptionInputId}className="resize-none"placeholder={t(($) => $['newApp.appDescriptionPlaceholder'], { ns: 'app' }) || ''}value={description}@@ -207,10 +217,14 @@ const CreateAppModal = ({)}{isEditModal && (<div className="pt-2">- <div className="mt-2 mb-2 text-sm leading-5 font-medium text-text-primary">+ <label+ htmlFor={maxActiveRequestsInputId}+ className="mt-2 mb-2 block text-sm leading-5 font-medium text-text-primary"+ >{t(($) => $.maxActiveRequests, { ns: 'app' })}- </div>+ </label><Input+ id={maxActiveRequestsInputId}type="number"min={1}placeholder={t(($) => $.maxActiveRequestsPlaceholder, { ns: 'app' })}diff --git a/web/app/components/header/account-setting/__tests__/workspace-role-checkbox-list.spec.tsx b/web/app/components/header/account-setting/__tests__/workspace-role-checkbox-list.spec.tsxindex 146398085b1..af070e07730 100644--- a/web/app/components/header/account-setting/__tests__/workspace-role-checkbox-list.spec.tsx+++ b/web/app/components/header/account-setting/__tests__/workspace-role-checkbox-list.spec.tsx@@ -1,5 +1,6 @@import type { Role } from '@/models/access-control'import { render, screen } from '@testing-library/react'+import userEvent from '@testing-library/user-event'import { useWorkspaceRoleList } from '@/service/access-control/use-workspace-roles'import WorkspaceRoleCheckboxList from '../workspace-role-checkbox-list'@@ -79,6 +80,27 @@ describe('WorkspaceRoleCheckboxList', () => {expect(screen.queryByRole('checkbox', { name: /First role/i })).not.toBeInTheDocument()})+ it('should clear the role search and return focus to the search input', async () => {+ const user = userEvent.setup()++ render(+ <WorkspaceRoleCheckboxList+ selectedRoleIds={[]}+ selectedRoles={[]}+ onSelectedRolesChange={vi.fn()}+ />,+ )++ const searchInput = screen.getByRole('searchbox', {+ name: 'permission.role.searchPlaceholder',+ })+ await user.type(searchInput, 'First')+ await user.click(screen.getByRole('button', { name: 'common.operation.clear' }))++ expect(searchInput).toHaveValue('')+ expect(searchInput).toHaveFocus()+ })+it('should expose disabled state on single-role options', () => {render(<WorkspaceRoleCheckboxListdiff --git a/web/app/components/header/account-setting/api-based-extension-page/modal.tsx b/web/app/components/header/account-setting/api-based-extension-page/modal.tsxindex a2ad08f2ca7..81c856ca904 100644--- a/web/app/components/header/account-setting/api-based-extension-page/modal.tsx+++ b/web/app/components/header/account-setting/api-based-extension-page/modal.tsx@@ -4,14 +4,9 @@ import type {} from '@dify/contracts/api/console/api-based-extension/types.gen'import { Button } from '@langgenius/dify-ui/button'import { Dialog, DialogCloseButton, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'-import {- Field,- FieldControl,- FieldDescription,- FieldError,- FieldLabel,-} from '@langgenius/dify-ui/field'+import { Field, FieldDescription, FieldError, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'+import { Input } from '@langgenius/dify-ui/input'import { toast } from '@langgenius/dify-ui/toast'import { useMutation } from '@tanstack/react-query'import { useTranslation } from 'react-i18next'@@ -106,7 +101,7 @@ export function ApiBasedExtensionModal(props: ApiBasedExtensionModalProps) {<Form<ApiBasedExtensionPayload> className="grid gap-4 pt-2" onFormSubmit={handleSubmit}><Field name="name"><FieldLabel>{nameLabel}</FieldLabel>- <FieldControl+ <InputrequireddefaultValue={editingApiBasedExtension?.name || ''}placeholder={@@ -120,7 +115,7 @@ export function ApiBasedExtensionModal(props: ApiBasedExtensionModalProps) {<Field name="api_endpoint"><FieldLabel>{apiEndpointLabel}</FieldLabel>- <FieldControl+ <InputrequireddefaultValue={editingApiBasedExtension?.api_endpoint || ''}placeholder={@@ -157,7 +152,7 @@ export function ApiBasedExtensionModal(props: ApiBasedExtensionModalProps) {}}><FieldLabel>{apiKeyLabel}</FieldLabel>- <FieldControl+ <InputrequireddefaultValue={editingApiBasedExtension?.api_key || ''}placeholder={diff --git a/web/app/components/header/account-setting/data-source-page-new/item.tsx b/web/app/components/header/account-setting/data-source-page-new/item.tsxindex b18aead3054..f420704553e 100644--- a/web/app/components/header/account-setting/data-source-page-new/item.tsx+++ b/web/app/components/header/account-setting/data-source-page-new/item.tsx@@ -31,6 +31,7 @@ const Item = ({{renaming && (<div className="flex w-full items-center space-x-1"><Input+ aria-label={`${t(($) => $['operation.rename'], { ns: 'common' })} ${credentialItem.name}`}className="h-6 min-w-0 grow"value={renameValue}onChange={(e) => setRenameValue(e.target.value)}diff --git a/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx b/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsxindex 5429ac6f5a3..0fe487893b7 100644--- a/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx+++ b/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx@@ -3,13 +3,8 @@import type { KeyboardEvent } from 'react'import type { EmailRecipient } from './email-recipients'import { cn } from '@langgenius/dify-ui/cn'-import {- Field,- FieldControl,- FieldDescription,- FieldError,- FieldLabel,-} from '@langgenius/dify-ui/field'+import { Field, FieldDescription, FieldError, FieldLabel } from '@langgenius/dify-ui/field'+import { Input } from '@langgenius/dify-ui/input'import { useEffect, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'import { hasEmailDelimiter, mergeEmailRecipients } from './email-recipients'@@ -249,7 +244,7 @@ export function EmailRecipientsField({})}</ul>)}- <FieldControl+ <Inputref={internalInputRef}type="text"disabled={disabled}diff --git a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsxindex a1a858d4ce7..fb883a14695 100644--- a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx+++ b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx@@ -29,6 +29,7 @@ const getErrorMessage = (error: unknown) => {const TransferOwnershipModal = ({ onClose, show }: Props) => {const { t } = useTranslation()+ const verificationCodeInputId = React.useId()const currentWorkspace = useAtomValue(currentWorkspaceAtom)const { data: userProfile } = useSuspenseQuery({...userProfileQueryOptions(),@@ -174,10 +175,17 @@ const TransferOwnershipModal = ({ onClose, show }: Props) => {</div></div><div className="pt-3">- <div className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary">+ <label+ htmlFor={verificationCodeInputId}+ className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"+ >{t(($) => $['members.transferModal.codeLabel'], { ns: 'common' })}- </div>+ </label><Input+ id={verificationCodeInputId}+ name="verification-code"+ inputMode="numeric"+ autoComplete="one-time-code"className="w-full!"placeholder={t(($) => $['members.transferModal.codePlaceholder'], { ns: 'common' })}value={code}diff --git a/web/app/components/header/account-setting/workspace-role-checkbox-list.tsx b/web/app/components/header/account-setting/workspace-role-checkbox-list.tsxindex 98e292dfcb8..db87d678376 100644--- a/web/app/components/header/account-setting/workspace-role-checkbox-list.tsx+++ b/web/app/components/header/account-setting/workspace-role-checkbox-list.tsx@@ -3,7 +3,6 @@import type { Role } from '@/models/access-control'import { Checkbox } from '@langgenius/dify-ui/checkbox'import { cn } from '@langgenius/dify-ui/cn'-import { Input } from '@langgenius/dify-ui/input'import { RadioControl, RadioGroup, RadioItem } from '@langgenius/dify-ui/radio'import {ScrollArea,@@ -14,6 +13,7 @@ import {} from '@langgenius/dify-ui/scroll-area'import { useCallback, useEffect, useMemo, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'+import { SearchInput } from '@/app/components/base/search-input'import { useLocale } from '@/context/i18n'import { getAccessControlTemplateLanguage } from '@/i18n-config/language'import { useWorkspaceRoleList } from '@/service/access-control/use-workspace-roles'@@ -209,28 +209,13 @@ const WorkspaceRoleCheckboxList = ({return (<><div className="shrink-0 px-6 pt-3 pb-2">- <div className="relative">- <span- aria-hidden- className="pointer-events-none absolute top-1/2 left-3 i-ri-search-line size-4 -translate-y-1/2 text-text-tertiary"- />- <Input- value={keyword}- onChange={(e) => setKeyword(e.target.value)}- placeholder={t(($) => $['role.searchPlaceholder'], { ns: 'permission' })}- className="pr-8 pl-8"- />- {keyword && (- <button- type="button"- className="absolute top-1/2 right-2 flex size-5 -translate-y-1/2 items-center justify-center rounded-md text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-components-input-border-active"- aria-label={t(($) => $['operation.clear'], { ns: 'common' })}- onClick={() => setKeyword('')}- >- <span aria-hidden className="i-ri-close-line size-4" />- </button>- )}- </div>+ <SearchInput+ name="workspace-role-query"+ value={keyword}+ onValueChange={setKeyword}+ placeholder={t(($) => $['role.searchPlaceholder'], { ns: 'permission' })}+ aria-label={t(($) => $['role.searchPlaceholder'], { ns: 'permission' })}+ /></div><ScrollArea className="min-h-0 flex-1">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.tsxindex 55cc15b96d9..94f5aba96c1 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@@ -5,8 +5,9 @@ import type { InstallState } from '@/app/components/plugins/types'import { Button } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'import { Dialog, DialogCloseButton, DialogContent } from '@langgenius/dify-ui/dialog'-import { Field, FieldControl, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'+import { Input } from '@langgenius/dify-ui/input'import { toast } from '@langgenius/dify-ui/toast'import * as React from 'react'import { useCallback, useState } from 'react'@@ -231,10 +232,13 @@ const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({{t(($) => $['installFromGitHub.gitHubRepo'], { ns: 'plugin' })}</span></FieldLabel>- <FieldControl+ <Input+ // oxlint-disable-next-line jsx-a11y/no-autofocus -- The dialog opens from an explicit install command, and the repository URL is its primary field.autoFocustype="text"inputMode="url"+ autoComplete="off"+ spellCheck={false}value={state.repoUrl}onValueChange={(value) =>setState((prevState) => ({ ...prevState, repoUrl: value }))diff --git a/web/app/components/plugins/marketplace/search-box/tags-filter.tsx b/web/app/components/plugins/marketplace/search-box/tags-filter.tsxindex 9c422cf0288..5fdd9808bc3 100644--- a/web/app/components/plugins/marketplace/search-box/tags-filter.tsx+++ b/web/app/components/plugins/marketplace/search-box/tags-filter.tsx@@ -2,7 +2,7 @@import { Checkbox } from '@langgenius/dify-ui/checkbox'import { CheckboxGroup } from '@langgenius/dify-ui/checkbox-group'-import { Input } from '@langgenius/dify-ui/input'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'import { Popover, PopoverContent } from '@langgenius/dify-ui/popover'import { useState } from 'react'import { useTranslation } from '#i18n'@@ -51,22 +51,25 @@ function TagsFilter({ tags, onTagsChange, usedInMarketplace = false }: TagsFilte><div className="w-60 rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg backdrop-blur-xs"><div className="p-2 pb-1">- <div className="relative">- <span- aria-hidden- className="absolute top-1/2 left-2 i-ri-search-line size-4 -translate-y-1/2 text-components-input-text-placeholder"- />- <Input+ <InputGroup>+ <InputGroupInputtype="search"name="tag-query"autoComplete="off"+ enterKeyHint="search"aria-label={t(($) => $.searchTags, { ns: 'pluginTags' }) || ''}- className="pl-6.5"+ className="[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none"value={searchText}- onChange={(e) => setSearchText(e.target.value)}+ onValueChange={setSearchText}placeholder={t(($) => $.searchTags, { ns: 'pluginTags' }) || ''}/>- </div>+ <InputGroupAddon className="ps-1.75 pe-0.75">+ <span+ aria-hidden+ className="i-ri-search-line size-4 text-components-input-text-placeholder"+ />+ </InputGroupAddon>+ </InputGroup></div><CheckboxGrouparia-label={t(($) => $.allTags, { ns: 'pluginTags' })}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.tsxindex a5031c8963d..ca82b5575c5 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@@ -243,6 +243,7 @@ const ReasoningConfigForm: React.FC<Props> = ({)}{isNumber && isConstant && (<Input+ aria-label={fieldTitle}className="h-8 grow"type="number"value={(varInput?.value as string | number) || ''}diff --git a/web/app/components/snippet-list/__tests__/index.spec.tsx b/web/app/components/snippet-list/__tests__/index.spec.tsxindex 54f49a76d32..2715097d514 100644--- a/web/app/components/snippet-list/__tests__/index.spec.tsx+++ b/web/app/components/snippet-list/__tests__/index.spec.tsx@@ -1,4 +1,5 @@import { fireEvent, screen } from '@testing-library/react'+import userEvent from '@testing-library/user-event'import * as React from 'react'import { createConsoleQueryWrapper } from '@/test/console/query-data'import { renderWithNuqs } from '@/test/nuqs-testing'@@ -369,19 +370,22 @@ describe('SnippetList', () => {it('updates the search query state from the search input', () => {renderList()- fireEvent.change(screen.getByRole('textbox'), { target: { value: 'summary' } })+ fireEvent.change(screen.getByRole('searchbox'), { target: { value: 'summary' } })expect(mockSetKeywords).toHaveBeenCalledWith('summary')})- it('clears the search query state', () => {+ it('clears the search query state and returns focus to the search input', async () => {+ const user = userEvent.setup()mockQueryState.keywords = 'summary'renderList()- fireEvent.click(screen.getByRole('button', { name: 'common.operation.clear' }))+ const searchInput = screen.getByRole('searchbox', { name: 'workflow.tabs.searchSnippets' })+ await user.click(screen.getByRole('button', { name: 'common.operation.clear' }))expect(mockSetKeywords).toHaveBeenCalledWith('')+ expect(searchInput).toHaveFocus()})it('updates the creator query state as a multi creator filter', () => {diff --git a/web/app/components/snippet-list/index.tsx b/web/app/components/snippet-list/index.tsxindex ebd6cff431a..b51c432df39 100644--- a/web/app/components/snippet-list/index.tsx+++ b/web/app/components/snippet-list/index.tsx@@ -3,11 +3,11 @@import type { SnippetPublishStatus } from './components/snippet-publish-status-filter'import type { SnippetListItem } from '@/types/snippet'import { cn } from '@langgenius/dify-ui/cn'-import { Input } from '@langgenius/dify-ui/input'import { useDebounce } from 'ahooks'import { useAtomValue } from 'jotai'import { useEffect, useMemo, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'+import { SearchInput } from '@/app/components/base/search-input'import { workspacePermissionKeysAtom } from '@/context/permission-state'import { currentWorkspaceLoadingAtom } from '@/context/workspace-state'import { TagFilter } from '@/features/tag-management/components/tag-filter'@@ -182,28 +182,14 @@ const SnippetList = () => {onChange={setTagIDs}onOpenTagManagement={() => setShowTagManagementModal(true)}/>- <div className="relative w-50">- <span- aria-hidden- className="pointer-events-none absolute top-1/2 left-2 i-ri-search-line size-4 -translate-y-1/2 text-components-input-text-placeholder"- />- <Input- className={cn('pl-6.5', keywords && 'pr-6.5')}- value={keywords}- onChange={(e) => setKeywords(e.target.value)}- placeholder={t(($) => $['tabs.searchSnippets'], { ns: 'workflow' })}- />- {!!keywords && (- <button- type="button"- aria-label={t(($) => $['operation.clear'], { ns: 'common' })}- className="absolute top-1/2 right-2 flex size-4 -translate-y-1/2 items-center justify-center text-components-input-text-placeholder hover:text-components-input-text-filled"- onClick={() => setKeywords('')}- >- <span aria-hidden className="i-ri-close-circle-fill size-4" />- </button>- )}- </div>+ <SearchInput+ name="snippet-query"+ className="w-50"+ value={keywords}+ onValueChange={setKeywords}+ placeholder={t(($) => $['tabs.searchSnippets'], { ns: 'workflow' })}+ aria-label={t(($) => $['tabs.searchSnippets'], { ns: 'workflow' })}+ /></div><SnippetCreateButton /></div>diff --git a/web/app/components/snippets/__tests__/create-snippet-dialog.spec.tsx b/web/app/components/snippets/__tests__/create-snippet-dialog.spec.tsxindex f71d84cf05b..88bd5b3533a 100644--- a/web/app/components/snippets/__tests__/create-snippet-dialog.spec.tsx+++ b/web/app/components/snippets/__tests__/create-snippet-dialog.spec.tsx@@ -79,10 +79,13 @@ describe('CreateSnippetDialog', () => {/>,)- await user.type(- screen.getByPlaceholderText('workflow.snippet.namePlaceholder'),- ' Support snippet ',- )+ const nameInput = screen.getByRole('textbox', { name: 'workflow.snippet.nameLabel' })++ await waitFor(() => {+ expect(nameInput).toHaveFocus()+ })++ await user.type(nameInput, ' Support snippet ')await user.type(screen.getByPlaceholderText('workflow.snippet.descriptionPlaceholder'),' Helps agents ',diff --git a/web/app/components/snippets/create-snippet-dialog.tsx b/web/app/components/snippets/create-snippet-dialog.tsxindex af5f1bcf03d..2bcc6eb90d3 100644--- a/web/app/components/snippets/create-snippet-dialog.tsx+++ b/web/app/components/snippets/create-snippet-dialog.tsx@@ -14,7 +14,7 @@ import {import { Input } from '@langgenius/dify-ui/input'import { Textarea } from '@langgenius/dify-ui/textarea'import { useHotkey } from '@tanstack/react-hotkeys'-import { useRef, useState } from 'react'+import { useId, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'const CREATE_SNIPPET_HOTKEY = 'Mod+Enter' satisfies Hotkey@@ -60,8 +60,11 @@ export function CreateSnippetDialog({confirmText,initialValue,}: CreateSnippetDialogProps) {+ const nameInputId = useId()+ const descriptionInputId = useId()const { t } = useTranslation()const popupRef = useRef<HTMLDivElement>(null)+ const nameInputRef = useRef<HTMLInputElement>(null)const [name, setName] = useState(initialValue?.name ?? '')const [description, setDescription] = useState(initialValue?.description ?? '')@@ -106,6 +109,7 @@ export function CreateSnippetDialog({<DialogBackdrop /><DialogPopupref={popupRef}+ initialFocus={nameInputRef}className="fixed top-1/2 left-1/2 max-h-[80dvh] w-120 max-w-120 -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain p-0"><DialogCloseButton />@@ -118,23 +122,31 @@ export function CreateSnippetDialog({<div className="space-y-4 px-6 py-2"><div>- <div className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary">+ <label+ htmlFor={nameInputId}+ className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"+ >{t(($) => $['snippet.nameLabel'], { ns: 'workflow' })}- </div>+ </label><Input+ ref={nameInputRef}+ id={nameInputId}value={name}onChange={(e) => setName(e.target.value)}placeholder={t(($) => $['snippet.namePlaceholder'], { ns: 'workflow' }) || ''}disabled={isSubmitting}- autoFocus/></div><div>- <div className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary">+ <label+ htmlFor={descriptionInputId}+ className="mb-1 flex h-6 items-center system-sm-medium text-text-secondary"+ >{t(($) => $['snippet.descriptionLabel'], { ns: 'workflow' })}- </div>+ </label><Textarea+ id={descriptionInputId}className="resize-none"value={description}onValueChange={(value) => setDescription(value)}diff --git a/web/app/components/snippets/import-snippet-dsl-dialog.tsx b/web/app/components/snippets/import-snippet-dsl-dialog.tsxindex 5994a2e481e..693a8720683 100644--- a/web/app/components/snippets/import-snippet-dsl-dialog.tsx+++ b/web/app/components/snippets/import-snippet-dsl-dialog.tsx@@ -17,7 +17,7 @@ import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'import { Input } from '@langgenius/dify-ui/input'import { toast } from '@langgenius/dify-ui/toast'import { useAtomValue } from 'jotai'-import { useCallback, useMemo, useState } from 'react'+import { useCallback, useId, useMemo, useState } from 'react'import { useTranslation } from 'react-i18next'import { Uploader } from '@/app/components/app/create-from-dsl-modal/uploader'import { workspacePermissionKeysAtom } from '@/context/permission-state'@@ -106,6 +106,7 @@ function SnippetDSLConfirmDialog({}function ImportSnippetDSLDialog({ isOpen, onClose }: ImportSnippetDSLDialogProps) {+ const dslUrlInputId = useId()const { t } = useTranslation()const { push } = useRouter()const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)@@ -270,8 +271,14 @@ function ImportSnippetDSLDialog({ isOpen, onClose }: ImportSnippetDSLDialogProps)}{currentTab === ImportSnippetDSLDialogTab.FromUrl && (<div>- <div className="mb-1 system-md-semibold text-text-secondary">DSL URL</div>+ <label+ htmlFor={dslUrlInputId}+ className="mb-1 block system-md-semibold text-text-secondary"+ >+ DSL URL+ </label><Input+ id={dslUrlInputId}placeholder={t(($) => $.importFromDSLUrlPlaceholder, { ns: 'snippet' }) || ''}value={dslUrl}onChange={(event) => setDslUrl(event.target.value)}diff --git a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsxindex bbc9444f7ec..17f6eae1448 100644--- a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx+++ b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx@@ -23,7 +23,7 @@ import {ScrollAreaThumb,ScrollAreaViewport,} from '@langgenius/dify-ui/scroll-area'-import { useState } from 'react'+import { useId, useState } from 'react'import { useTranslation } from 'react-i18next'import { Infotip } from '@/app/components/base/infotip'import { AuthHeaderPrefix, AuthType } from '@/app/components/tools/types'@@ -61,6 +61,10 @@ function SelectItem<Value = string>({ text, value, isChecked }: ItemProps<Value>export default function ConfigCredential({ positionCenter, credential, onChange, onHide }: Props) {const { t } = useTranslation()+ const apiKeyHeaderInputId = useId()+ const apiKeyHeaderValueInputId = useId()+ const apiKeyQueryInputId = useId()+ const apiKeyQueryValueInputId = useId()const [tempCredential, setTempCredential] = useState<Credential>(credential)const handleAuthTypeChange = (value: AuthType) => {if (value === AuthType.none) {@@ -206,7 +210,9 @@ export default function ConfigCredential({ positionCenter, credential, onChange,</Field><div><div className="flex items-center py-2 system-sm-medium text-text-primary">- {t(($) => $['createTool.authMethod.key'], { ns: 'tools' })}+ <label htmlFor={apiKeyHeaderInputId}>+ {t(($) => $['createTool.authMethod.key'], { ns: 'tools' })}+ </label><Infotiparia-label={t(($) => $['createTool.authMethod.keyTooltip'], {ns: 'tools',@@ -218,6 +224,7 @@ export default function ConfigCredential({ positionCenter, credential, onChange,</Infotip></div><Input+ id={apiKeyHeaderInputId}value={tempCredential.api_key_header}onChange={(e) =>setTempCredential({@@ -234,10 +241,14 @@ export default function ConfigCredential({ positionCenter, credential, onChange,/></div><div>- <div className="py-2 system-sm-medium text-text-primary">+ <label+ htmlFor={apiKeyHeaderValueInputId}+ className="block py-2 system-sm-medium text-text-primary"+ >{t(($) => $['createTool.authMethod.value'], { ns: 'tools' })}- </div>+ </label><Input+ id={apiKeyHeaderValueInputId}value={tempCredential.api_key_value}onChange={(e) =>setTempCredential({@@ -259,7 +270,9 @@ export default function ConfigCredential({ positionCenter, credential, onChange,<><div><div className="flex items-center py-2 system-sm-medium text-text-primary">- {t(($) => $['createTool.authMethod.queryParam'], { ns: 'tools' })}+ <label htmlFor={apiKeyQueryInputId}>+ {t(($) => $['createTool.authMethod.queryParam'], { ns: 'tools' })}+ </label><Infotiparia-label={t(($) => $['createTool.authMethod.queryParamTooltip'], {ns: 'tools',@@ -273,6 +286,7 @@ export default function ConfigCredential({ positionCenter, credential, onChange,</Infotip></div><Input+ id={apiKeyQueryInputId}value={tempCredential.api_key_query_param}onChange={(e) =>setTempCredential({@@ -289,10 +303,14 @@ export default function ConfigCredential({ positionCenter, credential, onChange,/></div><div>- <div className="py-2 system-sm-medium text-text-primary">+ <label+ htmlFor={apiKeyQueryValueInputId}+ className="block py-2 system-sm-medium text-text-primary"+ >{t(($) => $['createTool.authMethod.value'], { ns: 'tools' })}- </div>+ </label><Input+ id={apiKeyQueryValueInputId}value={tempCredential.api_key_value}onChange={(e) =>setTempCredential({diff --git a/web/app/components/tools/edit-custom-collection-modal/index.tsx b/web/app/components/tools/edit-custom-collection-modal/index.tsxindex 6008defc427..134854d3557 100644--- a/web/app/components/tools/edit-custom-collection-modal/index.tsx+++ b/web/app/components/tools/edit-custom-collection-modal/index.tsx@@ -16,7 +16,6 @@ import {import { Input } from '@langgenius/dify-ui/input'import { Textarea } from '@langgenius/dify-ui/textarea'import { toast } from '@langgenius/dify-ui/toast'-import { RiSettings2Line } from '@remixicon/react'import { useDebounce, useGetState } from 'ahooks'import { produce } from 'immer'import * as React from 'react'@@ -51,6 +50,9 @@ const EditCustomCollectionModal: FC<Props> = ({onEdit,onRemove,}) => {+ const providerNameInputId = React.useId()+ const privacyPolicyInputId = React.useId()+ const customDisclaimerInputId = React.useId()const { t } = useTranslation()const isAdd = !payloadconst isEdit = !!payload@@ -240,10 +242,13 @@ const EditCustomCollectionModal: FC<Props> = ({<div className="flex h-full flex-col"><div className="h-0 grow space-y-4 overflow-y-auto px-6 py-3"><div>- <div className="py-2 system-sm-medium text-text-primary">+ <label+ htmlFor={providerNameInputId}+ className="block py-2 system-sm-medium text-text-primary"+ >{t(($) => $['createTool.name'], { ns: 'tools' })}{' '}<span className="ml-1 text-red-500">*</span>- </div>+ </label><div className="flex items-center justify-between gap-3"><AppIconsize="large"@@ -255,6 +260,7 @@ const EditCustomCollectionModal: FC<Props> = ({background={emoji.background}/><Input+ id={providerNameInputId}className="h-10 grow"placeholder={t(($) => $['createTool.toolNamePlaceHolder'], {ns: 'tools',@@ -372,8 +378,9 @@ const EditCustomCollectionModal: FC<Props> = ({<div className="py-2 system-sm-medium text-text-primary">{t(($) => $['createTool.authMethod.title'], { ns: 'tools' })}</div>- <div- className="flex h-9 cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal px-2.5"+ <button+ type="button"+ className="flex h-9 w-full cursor-pointer items-center justify-between rounded-lg border-0 bg-components-input-bg-normal px-2.5 text-left outline-hidden focus-visible:ring-1 focus-visible:ring-components-input-border-active"onClick={() => setCredentialsModalShow(true)}><div className="system-xs-regular text-text-primary">@@ -381,8 +388,11 @@ const EditCustomCollectionModal: FC<Props> = ({ns: 'tools',})}</div>- <RiSettings2Line className="size-4 text-text-secondary" />- </div>+ <span+ aria-hidden+ className="i-ri-settings-2-line size-4 text-text-secondary"+ />+ </button></div>{/* Labels */}@@ -395,10 +405,14 @@ const EditCustomCollectionModal: FC<Props> = ({{/* Privacy Policy */}<div>- <div className="py-2 system-sm-medium text-text-primary">+ <label+ htmlFor={privacyPolicyInputId}+ className="block py-2 system-sm-medium text-text-primary"+ >{t(($) => $['createTool.privacyPolicy'], { ns: 'tools' })}- </div>+ </label><Input+ id={privacyPolicyInputId}value={customCollection.privacy_policy}onChange={(e) => {const newCollection = produce(customCollection, (draft) => {@@ -415,10 +429,14 @@ const EditCustomCollectionModal: FC<Props> = ({</div><div>- <div className="py-2 system-sm-medium text-text-primary">+ <label+ htmlFor={customDisclaimerInputId}+ className="block py-2 system-sm-medium text-text-primary"+ >{t(($) => $['createTool.customDisclaimer'], { ns: 'tools' })}- </div>+ </label><Input+ id={customDisclaimerInputId}value={customCollection.custom_disclaimer}onChange={(e) => {const newCollection = produce(customCollection, (draft) => {diff --git a/web/app/components/tools/mcp/modal.tsx b/web/app/components/tools/mcp/modal.tsxindex 552d48ebea5..b25bcc86780 100644--- a/web/app/components/tools/mcp/modal.tsx+++ b/web/app/components/tools/mcp/modal.tsx@@ -12,6 +12,7 @@ import { Switch } from '@langgenius/dify-ui/switch'import { toast } from '@langgenius/dify-ui/toast'import { useSuspenseQuery } from '@tanstack/react-query'import { useHover } from 'ahooks'+import { useId } from 'react'import { useTranslation } from 'react-i18next'import AppIcon from '@/app/components/base/app-icon'import AppIconPicker from '@/app/components/base/app-icon-picker'@@ -63,6 +64,10 @@ type MCPModalContentProps = {const MCPModalContent: FC<MCPModalContentProps> = ({ data, onConfirm, onHide }) => {const { t } = useTranslation()+ const serverUrlInputId = useId()+ const nameInputId = useId()+ const serverIdentifierInputId = useId()+ const serverIdentifierDescriptionId = useId()const { isCreate, originalServerUrl, originalServerID, appIconRef, state, actions } =useMCPModalForm(data)@@ -158,11 +163,12 @@ const MCPModalContent: FC<MCPModalContentProps> = ({ data, onConfirm, onHide }){/* Server URL */}<div><div className="mb-1 flex h-6 items-center">- <span className="system-sm-medium text-text-secondary">+ <label htmlFor={serverUrlInputId} className="system-sm-medium text-text-secondary">{t(($) => $['mcp.modal.serverUrl'], { ns: 'tools' })}- </span>+ </label></div><Input+ id={serverUrlInputId}value={state.url}onChange={(e) => actions.setUrl(e.target.value)}onBlur={(e) => actions.handleUrlBlur(e.target.value.trim())}@@ -181,11 +187,12 @@ const MCPModalContent: FC<MCPModalContentProps> = ({ data, onConfirm, onHide })<div className="flex space-x-3"><div className="grow pb-1"><div className="mb-1 flex h-6 items-center">- <span className="system-sm-medium text-text-secondary">+ <label htmlFor={nameInputId} className="system-sm-medium text-text-secondary">{t(($) => $['mcp.modal.name'], { ns: 'tools' })}- </span>+ </label></div><Input+ id={nameInputId}value={state.name}onChange={(e) => actions.setName(e.target.value)}placeholder={t(($) => $['mcp.modal.namePlaceholder'], { ns: 'tools' })}@@ -228,14 +235,22 @@ const MCPModalContent: FC<MCPModalContentProps> = ({ data, onConfirm, onHide }){/* Server Identifier */}<div><div className="flex h-6 items-center">- <span className="system-sm-medium text-text-secondary">+ <label+ htmlFor={serverIdentifierInputId}+ className="system-sm-medium text-text-secondary"+ >{t(($) => $['mcp.modal.serverIdentifier'], { ns: 'tools' })}- </span>+ </label></div>- <div className="mb-1 body-xs-regular text-text-tertiary">+ <div+ id={serverIdentifierDescriptionId}+ className="mb-1 body-xs-regular text-text-tertiary"+ >{t(($) => $['mcp.modal.serverIdentifierTip'], { ns: 'tools' })}</div><Input+ id={serverIdentifierInputId}+ aria-describedby={serverIdentifierDescriptionId}value={state.serverIdentifier}onChange={(e) => actions.setServerIdentifier(e.target.value)}placeholder={t(($) => $['mcp.modal.serverIdentifierPlaceholder'], { ns: 'tools' })}diff --git a/web/app/components/tools/mcp/sections/authentication-section.tsx b/web/app/components/tools/mcp/sections/authentication-section.tsxindex c5357af87b1..4660f0a2f6a 100644--- a/web/app/components/tools/mcp/sections/authentication-section.tsx+++ b/web/app/components/tools/mcp/sections/authentication-section.tsx@@ -3,6 +3,7 @@ import type { FC } from 'react'import { cn } from '@langgenius/dify-ui/cn'import { Input } from '@langgenius/dify-ui/input'import { Switch } from '@langgenius/dify-ui/switch'+import { useId } from 'react'import { useTranslation } from 'react-i18next'import AlertTriangle from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback/AlertTriangle'import { API_PREFIX } from '@/config'@@ -25,17 +26,21 @@ const AuthenticationSection: FC<AuthenticationSectionProps> = ({onCredentialsChange,}) => {const { t } = useTranslation()+ const dynamicRegistrationLabelId = useId()+ const clientIdInputId = useId()+ const clientSecretInputId = useId()return (<><div><div className="mb-1 flex h-6 items-center"><Switch+ aria-labelledby={dynamicRegistrationLabelId}className="mr-2"checked={isDynamicRegistration}onCheckedChange={onDynamicRegistrationChange}/>- <span className="system-sm-medium text-text-secondary">+ <span id={dynamicRegistrationLabelId} className="system-sm-medium text-text-secondary">{t(($) => $['mcp.modal.useDynamicClientRegistration'], { ns: 'tools' })}</span></div>@@ -55,11 +60,12 @@ const AuthenticationSection: FC<AuthenticationSectionProps> = ({</div><div><div className={cn('mb-1 flex h-6 items-center', isDynamicRegistration && 'opacity-50')}>- <span className="system-sm-medium text-text-secondary">+ <label htmlFor={clientIdInputId} className="system-sm-medium text-text-secondary">{t(($) => $['mcp.modal.clientID'], { ns: 'tools' })}- </span>+ </label></div><Input+ id={clientIdInputId}value={clientID}onChange={(e) => onClientIDChange(e.target.value)}placeholder={t(($) => $['mcp.modal.clientID'], { ns: 'tools' })}@@ -68,11 +74,12 @@ const AuthenticationSection: FC<AuthenticationSectionProps> = ({</div><div><div className={cn('mb-1 flex h-6 items-center', isDynamicRegistration && 'opacity-50')}>- <span className="system-sm-medium text-text-secondary">+ <label htmlFor={clientSecretInputId} className="system-sm-medium text-text-secondary">{t(($) => $['mcp.modal.clientSecret'], { ns: 'tools' })}- </span>+ </label></div><Input+ id={clientSecretInputId}value={credentials}onChange={(e) => onCredentialsChange(e.target.value)}placeholder={t(($) => $['mcp.modal.clientSecretPlaceholder'], { ns: 'tools' })}diff --git a/web/app/components/tools/mcp/sections/configurations-section.tsx b/web/app/components/tools/mcp/sections/configurations-section.tsxindex 1e1b62c5a8c..75a410ac041 100644--- a/web/app/components/tools/mcp/sections/configurations-section.tsx+++ b/web/app/components/tools/mcp/sections/configurations-section.tsx@@ -1,6 +1,7 @@'use client'import type { FC } from 'react'import { NumberField, NumberFieldGroup, NumberFieldInput } from '@langgenius/dify-ui/number-field'+import { useId } from 'react'import { useTranslation } from 'react-i18next'type ConfigurationsSectionProps = {@@ -17,18 +18,21 @@ const ConfigurationsSection: FC<ConfigurationsSectionProps> = ({onSseReadTimeoutChange,}) => {const { t } = useTranslation()+ const timeoutInputId = useId()+ const sseReadTimeoutInputId = useId()return (<><div><div className="mb-1 flex h-6 items-center">- <span className="system-sm-medium text-text-secondary">+ <label htmlFor={timeoutInputId} className="system-sm-medium text-text-secondary">{t(($) => $['mcp.modal.timeout'], { ns: 'tools' })}- </span>+ </label></div><NumberField value={timeout} min={0} onValueChange={(value) => onTimeoutChange(value ?? 0)}><NumberFieldGroup><NumberFieldInput+ id={timeoutInputId}placeholder={t(($) => $['mcp.modal.timeoutPlaceholder'], { ns: 'tools' })}/></NumberFieldGroup>@@ -36,9 +40,9 @@ const ConfigurationsSection: FC<ConfigurationsSectionProps> = ({</div><div><div className="mb-1 flex h-6 items-center">- <span className="system-sm-medium text-text-secondary">+ <label htmlFor={sseReadTimeoutInputId} className="system-sm-medium text-text-secondary">{t(($) => $['mcp.modal.sseReadTimeout'], { ns: 'tools' })}- </span>+ </label></div><NumberFieldvalue={sseReadTimeout}@@ -47,6 +51,7 @@ const ConfigurationsSection: FC<ConfigurationsSectionProps> = ({><NumberFieldGroup><NumberFieldInput+ id={sseReadTimeoutInputId}placeholder={t(($) => $['mcp.modal.timeoutPlaceholder'], { ns: 'tools' })}/></NumberFieldGroup>diff --git a/web/app/components/workflow/block-selector/snippets/__tests__/snippet-tags-filter.spec.tsx b/web/app/components/workflow/block-selector/snippets/__tests__/snippet-tags-filter.spec.tsxindex 03fb0a0b144..f8ba189691f 100644--- a/web/app/components/workflow/block-selector/snippets/__tests__/snippet-tags-filter.spec.tsx+++ b/web/app/components/workflow/block-selector/snippets/__tests__/snippet-tags-filter.spec.tsx@@ -53,7 +53,7 @@ describe('SnippetTagsFilter', () => {const trigger = screen.getByRole('button', { name: 'common.tag.placeholder' })trigger.focus()await user.keyboard('{Enter}')- const search = screen.getByRole('textbox', { name: 'pluginTags.searchTags' })+ const search = screen.getByRole('searchbox', { name: 'pluginTags.searchTags' })await user.type(search, 'sup')expect(screen.getByText('Support')).toBeInTheDocument()@@ -73,7 +73,7 @@ describe('SnippetTagsFilter', () => {const trigger = screen.getByRole('button', { name: 'common.tag.placeholder' })await user.click(trigger)expect(screen.getByRole('dialog', { name: 'common.tag.placeholder' })).toBeInTheDocument()- await user.type(screen.getByRole('textbox', { name: 'pluginTags.searchTags' }), 'sup')+ await user.type(screen.getByRole('searchbox', { name: 'pluginTags.searchTags' }), 'sup')expect(screen.queryByText('Sales')).not.toBeInTheDocument()await user.keyboard('{Escape}')diff --git a/web/app/components/workflow/block-selector/snippets/snippet-tags-filter.tsx b/web/app/components/workflow/block-selector/snippets/snippet-tags-filter.tsxindex 7c80c7738e1..7d11693c465 100644--- a/web/app/components/workflow/block-selector/snippets/snippet-tags-filter.tsx+++ b/web/app/components/workflow/block-selector/snippets/snippet-tags-filter.tsx@@ -2,7 +2,7 @@ import { Button } from '@langgenius/dify-ui/button'import { Checkbox } from '@langgenius/dify-ui/checkbox'import { CheckboxGroup } from '@langgenius/dify-ui/checkbox-group'import { cn } from '@langgenius/dify-ui/cn'-import { Input } from '@langgenius/dify-ui/input'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '@langgenius/dify-ui/popover'import { useQuery } from '@tanstack/react-query'import { useMemo, useState } from 'react'@@ -93,20 +93,25 @@ const SnippetTagsFilter = ({ embedded = false, value, onChange }: SnippetTagsFil><PopoverTitle className="sr-only">{triggerLabel}</PopoverTitle><div className="p-2 pb-1">- <div className="relative">- <span- className="absolute top-1/2 left-2 i-ri-search-line size-4 -translate-y-1/2 text-components-input-text-placeholder"- aria-hidden="true"- />- <Input+ <InputGroup>+ <InputGroupInput+ type="search"+ name="tag-query"aria-label={t(($) => $.searchTags, { ns: 'pluginTags' }) || ''}autoComplete="off"- className="pl-6.5"+ enterKeyHint="search"+ className="[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none"value={searchText}- onChange={(event) => setSearchText(event.target.value)}+ onValueChange={setSearchText}placeholder={t(($) => $.searchTags, { ns: 'pluginTags' }) || ''}/>- </div>+ <InputGroupAddon className="ps-1.75 pe-0.75">+ <span+ className="i-ri-search-line size-4 text-components-input-text-placeholder"+ aria-hidden="true"+ />+ </InputGroupAddon>+ </InputGroup></div><CheckboxGrouparia-label={t(($) => $.allTags, { ns: 'pluginTags' })}diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsxindex f2ba102b4ac..79c90df31f2 100644--- a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx@@ -3,8 +3,9 @@ import type { Hotkey } from '@tanstack/react-hotkeys'import type { EditableOutputConfig, EditingState, OutputDraft } from './utils'import { Button } from '@langgenius/dify-ui/button'import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '@langgenius/dify-ui/collapsible'-import { Field, FieldControl, FieldError, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'+import { Input } from '@langgenius/dify-ui/input'import { Kbd, KbdGroup } from '@langgenius/dify-ui/kbd'import { Switch } from '@langgenius/dify-ui/switch'import { Textarea } from '@langgenius/dify-ui/textarea'@@ -93,18 +94,17 @@ export function OutputEditCard({<FieldLabel className="sr-only">{t(($) => $['nodes.agent.outputVars.nameLabel'], { ns: 'workflow' })}</FieldLabel>- <FieldControl+ <Inputaria-describedby={hasNameError ? nameErrorId : undefined}// oxlint-disable-next-line jsx-a11y/no-autofocus -- Inline editor opens from an explicit user action and should focus the first editable field.autoFocusrequiredpattern={OUTPUT_NAME_PATTERN_SOURCE}- size="small"value={draft.name}placeholder={t(($) => $['nodes.agent.outputVars.namePlaceholder'], {ns: 'workflow',})}- className="h-6 w-24 px-1.5 py-0 code-sm-semibold"+ className="h-6 w-24 rounded-md px-1.5 py-0 code-sm-semibold"onChange={(event) => updateDraft({ name: event.currentTarget.value })}/></Field>@@ -143,13 +143,12 @@ export function OutputEditCard({<FieldLabel className="sr-only">{t(($) => $['nodes.agent.outputVars.descriptionLabel'], { ns: 'workflow' })}</FieldLabel>- <FieldControl- size="small"+ <Inputvalue={draft.description}placeholder={t(($) => $['nodes.agent.outputVars.descriptionPlaceholder'], {ns: 'workflow',})}- className="mt-2 h-5 border-transparent bg-transparent px-1 py-0 system-xs-regular shadow-none hover:border-transparent hover:bg-transparent focus:bg-transparent"+ className="mt-2 h-5 rounded-md border-transparent bg-transparent px-1 py-0 system-xs-regular shadow-none hover:border-transparent hover:bg-transparent focus:bg-transparent"onChange={(event) => updateDraft({ description: event.currentTarget.value })}/></Field>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.tsxindex da28eae29ad..042d93f8881 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@@ -74,7 +74,10 @@ const UserActionItem: FC<UserActionItemProps> = ({ data, onChange, onDelete, rea<div className="flex items-center gap-1"><div className="shrink-0"><Input- className="w-[120px]"+ aria-label={t(($) => $[`${i18nPrefix}.userActions.actionNamePlaceholder`], {+ ns: 'workflow',+ })}+ className="w-30"value={data.id}placeholder={t(($) => $[`${i18nPrefix}.userActions.actionNamePlaceholder`], {ns: 'workflow',@@ -85,6 +88,9 @@ const UserActionItem: FC<UserActionItemProps> = ({ data, onChange, onDelete, rea</div><div className="grow"><Input+ aria-label={t(($) => $[`${i18nPrefix}.userActions.buttonTextPlaceholder`], {+ ns: 'workflow',+ })}value={data.title}placeholder={t(($) => $[`${i18nPrefix}.userActions.buttonTextPlaceholder`], {ns: 'workflow',diff --git a/web/app/signin/check-code/page.tsx b/web/app/signin/check-code/page.tsxindex d1ae285e181..a0e9cceee04 100644--- a/web/app/signin/check-code/page.tsx+++ b/web/app/signin/check-code/page.tsx@@ -154,6 +154,9 @@ export default function CheckCode() {<Inputref={codeInputRef}id="code"+ name="code"+ inputMode="numeric"+ autoComplete="one-time-code"value={code}onChange={(e) => setVerifyCode(e.target.value)}maxLength={6}diff --git a/web/app/signin/components/mail-and-code-auth.tsx b/web/app/signin/components/mail-and-code-auth.tsxindex 423c2ca831c..84742c066cd 100644--- a/web/app/signin/components/mail-and-code-auth.tsx+++ b/web/app/signin/components/mail-and-code-auth.tsx@@ -1,6 +1,7 @@import { Button } from '@langgenius/dify-ui/button'-import { Field, FieldControl, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'+import { Input } from '@langgenius/dify-ui/input'import { toast } from '@langgenius/dify-ui/toast'import { useSuspenseQuery } from '@tanstack/react-query'import { useState } from 'react'@@ -81,7 +82,7 @@ export default function MailAndCodeAuth({ isInvite }: MailAndCodeAuthProps) {<FieldLabel className="my-2 py-0 system-md-semibold text-text-secondary">{t(($) => $.email, { ns: 'login' })}</FieldLabel>- <FieldControl+ <Inputtype="email"autoComplete="email"spellCheck={false}diff --git a/web/app/signin/components/mail-and-password-auth.tsx b/web/app/signin/components/mail-and-password-auth.tsxindex 10363cbe1b5..5f490b4a857 100644--- a/web/app/signin/components/mail-and-password-auth.tsx+++ b/web/app/signin/components/mail-and-password-auth.tsx@@ -1,7 +1,9 @@import { Button } from '@langgenius/dify-ui/button'-import { Field, FieldControl, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'import { IconButton } from '@langgenius/dify-ui/icon-button'+import { Input } from '@langgenius/dify-ui/input'+import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'import { toast } from '@langgenius/dify-ui/toast'import { useQueryClient } from '@tanstack/react-query'import { useState } from 'react'@@ -115,7 +117,7 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup }: MailAndP<FieldLabel className="my-2 py-0 system-md-semibold text-text-secondary">{t(($) => $.email, { ns: 'login' })}</FieldLabel>- <FieldControl+ <Inputvalue={email}onValueChange={setEmail}disabled={isInvite}@@ -140,23 +142,21 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup }: MailAndP{t(($) => $.forget, { ns: 'login' })}</Link></div>- <div className="relative mt-1">- <FieldControl+ <InputGroup className="mt-1">+ <InputGroupInputvalue={password}onValueChange={setPassword}type={showPassword ? 'text' : 'password'}autoComplete="current-password"spellCheck={false}placeholder={t(($) => $.passwordPlaceholder, { ns: 'login' }) || ''}- className="pr-10"/>- <div className="absolute inset-y-0 right-0 flex items-center">+ <InputGroupAddon align="inline-end"><IconButtonsize="lg"aria-label={t(($) => $[showPassword ? 'hidePassword' : 'showPassword'], {ns: 'login',})}- className="mr-1"onClick={() => setShowPassword(!showPassword)}>{showPassword ? (@@ -165,8 +165,8 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup }: MailAndP<span className="i-ri-eye-line size-4" aria-hidden="true" />)}</IconButton>- </div>- </div>+ </InputGroupAddon>+ </InputGroup></Field><div className="mb-2">diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsxindex 6decbd2b67e..becb0eaa71a 100644--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx@@ -13,8 +13,9 @@ import {DialogDescription,DialogTitle,} from '@langgenius/dify-ui/dialog'-import { Field, FieldControl, FieldDescription, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldDescription, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'+import { Input } from '@langgenius/dify-ui/input'import { toast } from '@langgenius/dify-ui/toast'import { useCallback, useState } from 'react'import { useTranslation } from 'react-i18next'@@ -187,7 +188,7 @@ export function CliToolDialog({<FieldDescription>{t(($) => $['agentDetail.configure.tools.cliDialog.installCommand.description'])}</FieldDescription>- <FieldControl+ <InputautoComplete="off"onValueChange={setInstallCommand}placeholder={t(@@ -200,7 +201,7 @@ export function CliToolDialog({<FieldLabel>{t(($) => $['agentDetail.configure.tools.cliDialog.name.label'])}</FieldLabel>- <FieldControl+ <InputautoComplete="off"onValueChange={setToolName}placeholder={t(($) => $['agentDetail.configure.tools.cliDialog.name.placeholder'])}diff --git a/web/features/agent-v2/roster/components/agent-form-fields.tsx b/web/features/agent-v2/roster/components/agent-form-fields.tsxindex 14093f3c6ee..ff1b5caaf03 100644--- a/web/features/agent-v2/roster/components/agent-form-fields.tsx+++ b/web/features/agent-v2/roster/components/agent-form-fields.tsx@@ -1,5 +1,6 @@import type { AgentIconSelection } from './agent-form'-import { Field, FieldControl, FieldError, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldError, FieldLabel } from '@langgenius/dify-ui/field'+import { Input } from '@langgenius/dify-ui/input'import { Textarea } from '@langgenius/dify-ui/textarea'import { useTranslation } from 'react-i18next'import AppIcon from '@/app/components/base/app-icon'@@ -61,7 +62,7 @@ export function AgentFormFields({}}><FieldLabel>{t(($) => $['roster.createForm.nameLabel'])}</FieldLabel>- <FieldControl+ <InputautoComplete="off"// oxlint-disable-next-line jsx-a11y/no-autofocus -- Agent roster dialogs open from explicit commands, and the name field is the primary editable control.autoFocus@@ -85,7 +86,7 @@ export function AgentFormFields({{tCommon(($) => $['label.optional'])}</span></FieldLabel>- <FieldControl+ <InputautoComplete="off"maxLength={255}onValueChange={onRoleChange}diff --git a/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx b/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsxindex d8f376c505d..48130237ed3 100644--- a/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx+++ b/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx@@ -13,8 +13,9 @@ import {DialogDescription,DialogTitle,} from '@langgenius/dify-ui/dialog'-import { Field, FieldControl, FieldLabel } from '@langgenius/dify-ui/field'+import { Field, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'+import { Input } from '@langgenius/dify-ui/input'import { Textarea } from '@langgenius/dify-ui/textarea'import { toast } from '@langgenius/dify-ui/toast'import { useMutation, useQueryClient } from '@tanstack/react-query'@@ -176,7 +177,7 @@ export function DuplicateAgentDialog({{tCommon(($) => $['label.optional'])}</span></FieldLabel>- <FieldControl+ <InputautoComplete="off"// oxlint-disable-next-line jsx-a11y/no-autofocus -- The duplicate dialog opens from an explicit command, and naming the copy is the primary editable action.autoFocus@@ -193,7 +194,7 @@ export function DuplicateAgentDialog({{tCommon(($) => $['label.optional'])}</span></FieldLabel>- <FieldControl+ <InputautoComplete="off"maxLength={255}onValueChange={setRole}diff --git a/web/features/new-rag/create-knowledge-page.tsx b/web/features/new-rag/create-knowledge-page.tsxindex e174a872322..0c7a1e26463 100644--- a/web/features/new-rag/create-knowledge-page.tsx+++ b/web/features/new-rag/create-knowledge-page.tsx@@ -13,14 +13,9 @@ import {DialogPortal,DialogTitle,} from '@langgenius/dify-ui/dialog'-import {- Field,- FieldControl,- FieldDescription,- FieldError,- FieldLabel,-} from '@langgenius/dify-ui/field'+import { Field, FieldDescription, FieldError, FieldLabel } from '@langgenius/dify-ui/field'import { Form } from '@langgenius/dify-ui/form'+import { Input } from '@langgenius/dify-ui/input'import { RadioGroup } from '@langgenius/dify-ui/radio'import {Select,@@ -392,7 +387,7 @@ export function CreateKnowledgePage() {*</span></FieldLabel>- <FieldControl+ <InputautoComplete="off"disabled={submissionLocked}maxLength={NAME_MAX_LENGTH}