Skip to content

armgit / dify

Public Imported from GitHub
0

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

fix(web): refine control cursor policy and migrate native selection controls (#43994)

yyh1b4f6e63fb91
diff --git a/packages/dify-ui/src/internal/form-control.ts b/packages/dify-ui/src/internal/form-control.ts
index 936226056a0..29838f26690 100644
--- a/packages/dify-ui/src/internal/form-control.ts
+++ b/packages/dify-ui/src/internal/form-control.ts
@@ -1,3 +1,4 @@
+// Some labels render as divs, which do not get the native label's default arrow cursor.
export const formLabelClassName =
'w-fit cursor-default py-1 text-text-secondary system-sm-medium data-disabled:cursor-not-allowed'
diff --git a/packages/dify-ui/src/select/index.tsx b/packages/dify-ui/src/select/index.tsx
index a34bbe09b3b..c96a5749859 100644
--- a/packages/dify-ui/src/select/index.tsx
+++ b/packages/dify-ui/src/select/index.tsx
@@ -249,7 +249,7 @@ function SelectItem<Value = unknown>({ className, ...props }: SelectItemProps<Va
<BaseSelect.Item
className={(state) =>
cn(
- 'flex h-8 items-center rounded-lg px-2 system-sm-medium text-text-secondary outline-hidden',
+ 'flex h-8 items-center rounded-lg px-2 system-sm-medium text-text-secondary outline-hidden select-none',
'data-disabled:cursor-not-allowed data-disabled:opacity-50 data-highlighted:bg-state-base-hover',
resolveClassName(className, state),
)
diff --git a/web/app/components/app/annotation/add-annotation-modal/index.tsx b/web/app/components/app/annotation/add-annotation-modal/index.tsx
index 01b4c6dbc7e..19fbfe28a31 100644
--- a/web/app/components/app/annotation/add-annotation-modal/index.tsx
+++ b/web/app/components/app/annotation/add-annotation-modal/index.tsx
@@ -133,7 +133,7 @@ const AddAnnotationModal: FC<Props> = ({ isShow, onHide, onAdd }) => {
</div>
)}
<div className="flex h-16 items-center justify-between rounded-b-xl border-t border-divider-subtle bg-background-section-burn px-4 system-sm-medium text-text-tertiary">
- <label className="flex items-center space-x-2">
+ <label className="flex cursor-pointer items-center space-x-2">
<Checkbox checked={isCreateNext} onCheckedChange={setIsCreateNext} />
<span>{t(($) => $['addModal.createNext'], { ns: 'appAnnotation' })}</span>
</label>
diff --git a/web/app/components/app/configuration/config-var/config-modal/form-fields.tsx b/web/app/components/app/configuration/config-var/config-modal/form-fields.tsx
index 3fbf0fcd05e..00c30947ea0 100644
--- a/web/app/components/app/configuration/config-var/config-modal/form-fields.tsx
+++ b/web/app/components/app/configuration/config-var/config-modal/form-fields.tsx
@@ -384,7 +384,7 @@ const ConfigModalFormFields: FC<ConfigModalFormFieldsProps> = ({
</Field>
)}
- <label className="mt-5! flex h-6 items-center space-x-2">
+ <label className="mt-5! flex h-6 cursor-pointer items-center space-x-2 has-data-disabled:cursor-not-allowed">
<Checkbox
checked={tempPayload.required}
disabled={!isFileInput && tempPayload.hide}
@@ -397,7 +397,7 @@ const ConfigModalFormFields: FC<ConfigModalFormFieldsProps> = ({
{showHiddenField && !isFileInput && (
<div className="mt-5! flex h-6 items-center gap-2">
- <label className="flex items-center gap-2">
+ <label className="flex cursor-pointer items-center gap-2 has-data-disabled:cursor-not-allowed">
<Checkbox
checked={tempPayload.hide}
disabled={tempPayload.required}
diff --git a/web/app/components/app/overview/workflow-hidden-input-fields.tsx b/web/app/components/app/overview/workflow-hidden-input-fields.tsx
index f367c725eb0..e9f495afae9 100644
--- a/web/app/components/app/overview/workflow-hidden-input-fields.tsx
+++ b/web/app/components/app/overview/workflow-hidden-input-fields.tsx
@@ -1,5 +1,5 @@
-import type { ChangeEvent } from 'react'
import type { WorkflowHiddenStartVariable, WorkflowLaunchInputValue } from './app-card-utils'
+import { Checkbox } from '@langgenius/dify-ui/checkbox'
import { Input } from '@langgenius/dify-ui/input'
import {
Select,
@@ -52,14 +52,10 @@ const WorkflowHiddenInputFields = ({
if (variable.type === InputVarType.checkbox) {
return (
<label className="flex min-h-10 w-full cursor-pointer items-center gap-3 rounded-lg bg-components-input-bg-normal px-3 py-2">
- <input
+ <Checkbox
id={fieldId}
- type="checkbox"
checked={Boolean(fieldValue)}
- onChange={(event: ChangeEvent<HTMLInputElement>) =>
- onValueChange(variable.variable, event.target.checked)
- }
- className="size-4 rounded border-divider-subtle"
+ onCheckedChange={(checked) => onValueChange(variable.variable, checked)}
/>
<span className="system-sm-regular text-text-secondary">{label}</span>
</label>
diff --git a/web/app/components/base/form/components/base/base-field.tsx b/web/app/components/base/form/components/base/base-field.tsx
index 103829605cd..71afbde31ff 100644
--- a/web/app/components/base/form/components/base/base-field.tsx
+++ b/web/app/components/base/form/components/base/base-field.tsx
@@ -506,13 +506,13 @@ const BaseField = ({
>
<FieldsetLegend className="sr-only">{translatedLabel || name}</FieldsetLegend>
<FieldItem>
- <FieldLabel className="flex items-center gap-1.5 system-sm-regular text-text-secondary">
+ <FieldLabel className="flex cursor-pointer items-center gap-1.5 system-sm-regular text-text-secondary">
<Radio value={true} />
True
</FieldLabel>
</FieldItem>
<FieldItem>
- <FieldLabel className="flex items-center gap-1.5 system-sm-regular text-text-secondary">
+ <FieldLabel className="flex cursor-pointer items-center gap-1.5 system-sm-regular text-text-secondary">
<Radio value={false} />
False
</FieldLabel>
diff --git a/web/app/components/base/markdown-blocks/form.tsx b/web/app/components/base/markdown-blocks/form.tsx
index 3e0118c47ef..b3431c412ae 100644
--- a/web/app/components/base/markdown-blocks/form.tsx
+++ b/web/app/components/base/markdown-blocks/form.tsx
@@ -1,5 +1,6 @@
import { Button } from '@langgenius/dify-ui/button'
import { Checkbox } from '@langgenius/dify-ui/checkbox'
+import { cn } from '@langgenius/dify-ui/cn'
import { Input } from '@langgenius/dify-ui/input'
import { NumberField, NumberFieldGroup, NumberFieldInput } from '@langgenius/dify-ui/number-field'
import {
@@ -276,7 +277,12 @@ const MarkdownForm = ({ node }: { node: HastElement }) => {
<label
key={key}
htmlFor={`${formId}-${getLabelTarget(child)}`}
- className="my-2 system-md-semibold text-text-secondary"
+ className={cn(
+ 'my-2 system-md-semibold text-text-secondary',
+ target &&
+ str(target.properties.type) === SUPPORTED_TYPES.CHECKBOX &&
+ 'cursor-pointer',
+ )}
>
{getTextContent(child)}
</label>
diff --git a/web/app/components/billing/pricing/content.tsx b/web/app/components/billing/pricing/content.tsx
index 19358b0649e..aab94d6755f 100644
--- a/web/app/components/billing/pricing/content.tsx
+++ b/web/app/components/billing/pricing/content.tsx
@@ -94,7 +94,7 @@ export function PricingContent() {
</TabsList>
{isCloud && (
<Field>
- <FieldLabel className="flex items-center gap-x-3 px-2 pb-3 xl:justify-end xl:pr-5 xl:pb-0 xl:pl-0">
+ <FieldLabel className="flex cursor-pointer items-center gap-x-3 px-2 pb-3 xl:justify-end xl:pr-5 xl:pb-0 xl:pl-0">
<Switch
size="lg"
checked={billingInterval === 'year'}
diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx
index 54f979f11d4..c9519ee5eae 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx
@@ -426,13 +426,13 @@ function Form<
</FieldsetLegend>
<div className="flex items-center gap-3">
<FieldItem>
- <FieldLabel className="flex items-center gap-1.5 system-sm-regular text-text-secondary">
+ <FieldLabel className="flex cursor-pointer items-center gap-1.5 system-sm-regular text-text-secondary">
<Radio<boolean> value={true} />
True
</FieldLabel>
</FieldItem>
<FieldItem>
- <FieldLabel className="flex items-center gap-1.5 system-sm-regular text-text-secondary">
+ <FieldLabel className="flex cursor-pointer items-center gap-1.5 system-sm-regular text-text-secondary">
<Radio<boolean> value={false} />
False
</FieldLabel>
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx
index 2dde1efe104..0b93c219dca 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx
@@ -303,13 +303,13 @@ function ParameterItem({
>
<FieldsetLegend className="sr-only">{translatedLabel}</FieldsetLegend>
<FieldItem>
- <FieldLabel className="flex w-17.5 items-center gap-1.5 system-sm-regular text-text-secondary">
+ <FieldLabel className="flex w-17.5 cursor-pointer items-center gap-1.5 system-sm-regular text-text-secondary">
<Radio<boolean> value={true} />
True
</FieldLabel>
</FieldItem>
<FieldItem>
- <FieldLabel className="flex w-17.5 items-center gap-1.5 system-sm-regular text-text-secondary">
+ <FieldLabel className="flex w-17.5 cursor-pointer items-center gap-1.5 system-sm-regular text-text-secondary">
<Radio<boolean> value={false} />
False
</FieldLabel>
diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/bool-input.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/bool-input.tsx
index a0642f87800..3ab3b0979fa 100644
--- a/web/app/components/workflow/nodes/_base/components/before-run-form/bool-input.tsx
+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/bool-input.tsx
@@ -22,7 +22,7 @@ const BoolInput: FC<Props> = ({ value, onChange, name, required, readonly }) =>
[onChange],
)
return (
- <label className="flex h-6 items-center gap-2">
+ <label className="flex h-6 cursor-pointer items-center gap-2 has-data-disabled:cursor-not-allowed">
<Checkbox
className="size-4!"
checked={!!value}
diff --git a/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx b/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx
index 48105db4978..d0ff4f22761 100644
--- a/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx
+++ b/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx
@@ -66,7 +66,7 @@ const RetryOnPanel = ({ id, data }: RetryOnPanelProps) => {
<div className="flex h-10 items-center justify-between px-4 py-2">
<label
htmlFor={retryEnabledId}
- className="mr-0.5 system-sm-semibold-uppercase text-text-secondary"
+ className="mr-0.5 cursor-pointer system-sm-semibold-uppercase text-text-secondary"
>
{retryOnFailureLabel}
</label>
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.tsx
index cc8003b7c2c..e10cd152109 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
@@ -140,7 +140,7 @@ export function OutputEditCard({
</Field>
<OutputTypeSelect value={draft.type} onChange={(value) => updateDraft({ type: value })} />
<Field name="required" className="contents">
- <FieldLabel className="flex h-6 items-center gap-x-1 system-xs-regular text-text-tertiary">
+ <FieldLabel className="flex h-6 cursor-pointer items-center gap-x-1 system-xs-regular text-text-tertiary">
<Switch
size="xs"
checked={draft.required}
diff --git a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx b/web/app/components/workflow/nodes/http/components/edit-body/index.tsx
index 9733ceb9b8c..857f9f64d12 100644
--- a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx
+++ b/web/app/components/workflow/nodes/http/components/edit-body/index.tsx
@@ -3,10 +3,14 @@ import type { FC } from 'react'
import type { Body, BodyPayload, KeyValue as KeyValueType } from '../../types'
import type { ValueSelector, Var } from '@/app/components/workflow/types'
import { cn } from '@langgenius/dify-ui/cn'
+import { Field, FieldItem } from '@langgenius/dify-ui/field'
+import { Fieldset, FieldsetLegend } from '@langgenius/dify-ui/fieldset'
+import { Radio, RadioGroup } from '@langgenius/dify-ui/radio-group'
import { uniqueId } from 'es-toolkit/compat'
import { produce } from 'immer'
import * as React from 'react'
import { useCallback, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
import InputWithVar from '@/app/components/workflow/nodes/_base/components/prompt/editor'
import { VarType } from '@/app/components/workflow/types'
import VarReferencePicker from '../../../_base/components/variable/var-reference-picker'
@@ -42,6 +46,7 @@ const bodyTextMap = {
}
const EditBody: FC<Props> = ({ readonly, nodeId, payload, onChange }) => {
+ const { t: translate } = useTranslation(['workflowIntegrations'])
const keyValueBodyTypes: readonly BodyType[] = [BodyType.formData, BodyType.xWwwFormUrlencoded]
const { type, data } = payload
@@ -62,13 +67,12 @@ const EditBody: FC<Props> = ({ readonly, nodeId, payload, onChange }) => {
})
const handleTypeChange = useCallback(
- (e: React.ChangeEvent<HTMLInputElement>) => {
+ (newType: BodyType) => {
const keyValueBodyTypes: readonly BodyType[] = [
BodyType.formData,
BodyType.xWwwFormUrlencoded,
]
- const newType = e.target.value as BodyType
const hasKeyValue = keyValueBodyTypes.includes(newType)
onChange({
type: newType,
@@ -152,27 +156,34 @@ const EditBody: FC<Props> = ({ readonly, nodeId, payload, onChange }) => {
return (
<div>
{/* body type */}
- <div className="flex flex-wrap">
- {allTypes.map((t) => (
- <label
- key={t}
- htmlFor={`body-type-${t}`}
- className="mr-4 flex h-7 items-center space-x-2"
- >
- <input
- type="radio"
- id={`body-type-${t}`}
- value={t}
- checked={type === t}
- onChange={handleTypeChange}
+ <Field className="contents">
+ <Fieldset
+ render={
+ <RadioGroup<BodyType>
+ value={type}
+ onValueChange={handleTypeChange}
disabled={readonly}
+ className="block"
/>
- <div className="text-[13px] leading-4.5 font-normal text-text-secondary">
- {bodyTextMap[t]}
- </div>
- </label>
- ))}
- </div>
+ }
+ >
+ <FieldsetLegend className="sr-only">
+ {translate(($) => $['nodes.http.body'], { ns: 'workflowIntegrations' })}
+ </FieldsetLegend>
+ <div className="flex flex-wrap">
+ {allTypes.map((t) => (
+ <FieldItem key={t} className="contents">
+ <label className="mr-4 flex h-7 cursor-pointer items-center space-x-2 has-data-disabled:cursor-not-allowed">
+ <Radio value={t} />
+ <div className="text-[13px] leading-4.5 font-normal text-text-secondary">
+ {bodyTextMap[t]}
+ </div>
+ </label>
+ </FieldItem>
+ ))}
+ </div>
+ </Fieldset>
+ </Field>
{/* body value */}
<div className={cn(type !== BodyType.none && 'mt-1')}>
{type === BodyType.none && null}
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
index d9669c39905..5d3e3215502 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
@@ -168,7 +168,10 @@ const EmailConfigureModal = ({
<RiBugLine className="size-3.5 text-text-primary-on-surface" />
</div>
<div className="grow space-y-1">
- <label htmlFor={debugModeId} className="system-sm-medium text-text-secondary">
+ <label
+ htmlFor={debugModeId}
+ className="cursor-pointer system-sm-medium text-text-secondary"
+ >
{t(($) => $[`${i18nPrefix}.deliveryMethod.emailConfigure.debugMode`], {
ns: 'workflowHumanInput',
})}
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx
index 2f362b4e16d..1b7e86ebc04 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx
@@ -102,7 +102,7 @@ const Recipient = ({ data, onChange }: Props) => {
</div>
<label
htmlFor={wholeWorkspaceId}
- className={cn('grow system-sm-medium text-text-secondary')}
+ className={cn('grow cursor-pointer system-sm-medium text-text-secondary')}
>
{t(($) => $[`${i18nPrefix}.deliveryMethod.emailConfigure.allMembers`], {
workspaceName: currentWorkspace.name.replace(/'/g, '’'),
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx
index 7aea971f561..81ad8c64527 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx
@@ -283,7 +283,7 @@ export function SearchMethodOption({
{showRerankModelSelectorSwitch ? (
<Field name="reranking_model_enabled" className="mb-1 gap-0">
<div className="flex items-center">
- <FieldLabel className="flex min-w-0 items-center py-0 system-sm-semibold text-text-secondary">
+ <FieldLabel className="flex min-w-0 cursor-pointer items-center py-0 system-sm-semibold text-text-secondary has-data-disabled:cursor-not-allowed">
<Switch
className="mr-1"
checked={reranking.enabled ?? false}
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx
index 399c3101b86..ac12aae4508 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx
@@ -100,7 +100,7 @@ export function TopKAndScoreThreshold({
<FieldsetLegend className="sr-only">{scoreThresholdLabel}</FieldsetLegend>
<Field name="score_threshold_enabled" className="mb-0.5 gap-0">
<div className="flex h-6 items-center">
- <FieldLabel className="flex w-full min-w-0 grow items-center py-0 system-sm-medium text-text-secondary">
+ <FieldLabel className="flex w-full min-w-0 grow cursor-pointer items-center py-0 system-sm-medium text-text-secondary has-data-disabled:cursor-not-allowed">
<Switch
className="mr-2"
checked={scoreThresholdEnabled}
diff --git a/web/app/education/apply/application-form.tsx b/web/app/education/apply/application-form.tsx
index 9da116f6955..87eda8c28fe 100644
--- a/web/app/education/apply/application-form.tsx
+++ b/web/app/education/apply/application-form.tsx
@@ -244,19 +244,19 @@ const EducationApplyPage = ({ plan, token }: EducationApplyPageProps) => {
</FieldDescription>
<div className="py-2 system-md-regular text-text-primary">
<FieldItem>
- <FieldLabel className="mb-2 flex items-start gap-2 py-0">
+ <FieldLabel className="mb-2 flex cursor-pointer items-start gap-2 py-0">
<Checkbox value="age" />
{t(($) => $['form.terms.option.age'], { ns: 'education' })}
</FieldLabel>
</FieldItem>
<FieldItem>
- <FieldLabel className="mb-2 flex items-start gap-2 py-0">
+ <FieldLabel className="mb-2 flex cursor-pointer items-start gap-2 py-0">
<Checkbox value="inSchool" />
{t(($) => $['form.terms.option.inSchool'], { ns: 'education' })}
</FieldLabel>
</FieldItem>
<FieldItem>
- <FieldLabel className="flex items-start gap-2 py-0">
+ <FieldLabel className="flex cursor-pointer items-start gap-2 py-0">
<Checkbox value="personalUse" />
{t(($) => $['form.terms.option.personalUse'], { ns: 'education' })}
</FieldLabel>
diff --git a/web/app/styles/preflight.css b/web/app/styles/preflight.css
index e57ab4f97f5..cf8c841be87 100644
--- a/web/app/styles/preflight.css
+++ b/web/app/styles/preflight.css
@@ -350,8 +350,8 @@ textarea::placeholder {
}
/*
-Set the default cursor for buttons and for controls that act on a press.
-Dify UI leaves the enabled cursor to this rule, so a role its controls render belongs here.
+Use a pointer for buttons, selection controls, and tabs.
+Labels opt in at the call site: only labels that toggle a control should get a pointer.
*/
button,
@@ -359,23 +359,13 @@ button,
cursor: pointer;
}
-:is(
- [role='switch'],
- [role='checkbox'],
- [role='radio'],
- [role='tab'],
- [role='option'],
- [role='menuitem'],
- [role='menuitemcheckbox'],
- [role='menuitemradio']
-):not(:disabled, [aria-disabled='true'], [aria-readonly='true'], [data-disabled], [data-readonly]) {
- cursor: pointer;
-}
-
-/*
-An item laid out in a grid takes the gridcell role. A cell that holds its own button or link is not the control.
-*/
-[role='gridcell']:not(:has(button, a), [aria-disabled='true'], [data-disabled]) {
+:is([role='switch'], [role='checkbox'], [role='radio'], [role='tab']):not(
+ :disabled,
+ [aria-disabled='true'],
+ [aria-readonly='true'],
+ [data-disabled],
+ [data-readonly]
+) {
cursor: pointer;
}
diff --git a/web/features/new-rag/__tests__/add-source-page.spec.tsx b/web/features/new-rag/__tests__/add-source-page.spec.tsx
index 21c36628dc5..7363be5cd90 100644
--- a/web/features/new-rag/__tests__/add-source-page.spec.tsx
+++ b/web/features/new-rag/__tests__/add-source-page.spec.tsx
@@ -1033,14 +1033,14 @@ describe('AddSourcePage', () => {
expect(screen.getByRole('radio', { name: 'dataset.newKnowledge.onlineDrive' })).toBeEnabled()
expect(screen.getByRole('radio', { name: 'Jina Reader' })).toBeEnabled()
expect(
- screen.getByRole('group', { name: 'datasetCreation.stepOne.website.chooseProvider' }),
+ screen.getByRole('radiogroup', { name: 'datasetCreation.stepOne.website.chooseProvider' }),
).toBeInTheDocument()
expect(screen.getByRole('radio', { name: 'Firecrawl' })).toBeChecked()
await user.click(onlineDocuments)
expect(onlineDocuments).toBeChecked()
expect(
- screen.getByRole('group', { name: 'datasetCreation.stepOne.website.chooseProvider' }),
+ screen.getByRole('radiogroup', { name: 'datasetCreation.stepOne.website.chooseProvider' }),
).toBeVisible()
expect(screen.getByRole('textbox', { name: 'dataset.newKnowledge.sourceName' })).toBeEnabled()
expect(screen.getByRole('combobox', { name: 'dataset.newKnowledge.syncPolicy' })).toBeEnabled()
diff --git a/web/features/new-rag/add-source-page.tsx b/web/features/new-rag/add-source-page.tsx
index b68ec6af27a..460438b2062 100644
--- a/web/features/new-rag/add-source-page.tsx
+++ b/web/features/new-rag/add-source-page.tsx
@@ -11,6 +11,9 @@ import type {
} from './routes'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
+import { Field, FieldItem } from '@langgenius/dify-ui/field'
+import { Fieldset, FieldsetLegend } from '@langgenius/dify-ui/fieldset'
+import { Radio, RadioGroup } from '@langgenius/dify-ui/radio-group'
import { useRefWithInit } from '@langgenius/dify-ui/use-ref-with-init'
import { useInfiniteQuery, useQuery, useQueryClient } from '@tanstack/react-query'
import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
@@ -133,35 +136,40 @@ function SourceTypeSelector({
]
return (
- <fieldset>
- <legend className="mb-1.5 system-xs-medium text-text-secondary">
- {t(($) => $['newKnowledge.sourceTypeLabel'])}
- </legend>
- <div className="grid grid-cols-1 gap-0.5 rounded-lg bg-background-section p-0.5 sm:grid-cols-3">
- {options.map((option) => (
- <label
- key={option.key}
- className={cn(
- 'relative flex h-8 items-center justify-center gap-1.5 rounded-md system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
- value === option.key
- ? 'bg-background-default text-text-primary shadow-xs'
- : 'cursor-pointer text-text-tertiary hover:text-text-secondary',
- )}
- >
- <input
- type="radio"
- name="source-type"
- value={option.key}
- checked={value === option.key}
- onChange={() => onChange(option.key)}
- className="sr-only"
- />
- <span aria-hidden className={`${option.icon} size-4`} />
- {t(($) => $[`newKnowledge.${option.key}`])}
- </label>
- ))}
- </div>
- </fieldset>
+ <Field className="contents">
+ <Fieldset
+ render={
+ <RadioGroup<SourceType>
+ name="source-type"
+ value={value}
+ onValueChange={onChange}
+ className="block"
+ />
+ }
+ >
+ <FieldsetLegend className="mb-1.5 py-0 system-xs-medium text-text-secondary">
+ {t(($) => $['newKnowledge.sourceTypeLabel'])}
+ </FieldsetLegend>
+ <div className="grid grid-cols-1 gap-0.5 rounded-lg bg-background-section p-0.5 sm:grid-cols-3">
+ {options.map((option) => (
+ <FieldItem key={option.key} className="contents">
+ <label
+ className={cn(
+ 'relative flex h-8 items-center justify-center gap-1.5 rounded-md system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
+ value === option.key
+ ? 'bg-background-default text-text-primary shadow-xs'
+ : 'cursor-pointer text-text-tertiary hover:text-text-secondary',
+ )}
+ >
+ <Radio value={option.key} className="sr-only" />
+ <span aria-hidden className={`${option.icon} size-4`} />
+ {t(($) => $[`newKnowledge.${option.key}`])}
+ </label>
+ </FieldItem>
+ ))}
+ </div>
+ </Fieldset>
+ </Field>
)
}
@@ -175,35 +183,40 @@ function ProviderSelector({
const { t } = useTranslation(['datasetCreation'])
return (
- <fieldset>
- <legend className="mb-1.5 system-xs-medium text-text-secondary">
- {t(($) => $['stepOne.website.chooseProvider'])}
- </legend>
- <div className="grid grid-cols-2 gap-2 sm:grid-cols-4">
- {WEBSITE_PROVIDER_OPTIONS.map((option) => (
- <label
- key={option.value}
- className={cn(
- 'relative flex min-h-9 items-center justify-center gap-2 rounded-lg border px-3 system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
- provider === option.value
- ? 'border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary'
- : 'cursor-pointer border-divider-subtle text-text-secondary hover:bg-state-base-hover',
- )}
- >
- <input
- type="radio"
- name="source-provider"
- value={option.value}
- checked={provider === option.value}
- onChange={() => onChange(option.value)}
- className="sr-only"
- />
- <span aria-hidden className={`${option.icon} size-4`} />
- {option.value}
- </label>
- ))}
- </div>
- </fieldset>
+ <Field className="contents">
+ <Fieldset
+ render={
+ <RadioGroup<NewKnowledgeWebsiteProvider>
+ name="source-provider"
+ value={provider}
+ onValueChange={onChange}
+ className="block"
+ />
+ }
+ >
+ <FieldsetLegend className="mb-1.5 py-0 system-xs-medium text-text-secondary">
+ {t(($) => $['stepOne.website.chooseProvider'])}
+ </FieldsetLegend>
+ <div className="grid grid-cols-2 gap-2 sm:grid-cols-4">
+ {WEBSITE_PROVIDER_OPTIONS.map((option) => (
+ <FieldItem key={option.value} className="contents">
+ <label
+ className={cn(
+ 'relative flex min-h-9 items-center justify-center gap-2 rounded-lg border px-3 system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
+ provider === option.value
+ ? 'border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary'
+ : 'cursor-pointer border-divider-subtle text-text-secondary hover:bg-state-base-hover',
+ )}
+ >
+ <Radio value={option.value} className="sr-only" />
+ <span aria-hidden className={`${option.icon} size-4`} />
+ {option.value}
+ </label>
+ </FieldItem>
+ ))}
+ </div>
+ </Fieldset>
+ </Field>
)
}
@@ -378,28 +391,33 @@ function ConnectionForm({
return (
<form className="rounded-xl bg-background-section p-4" onSubmit={handleSubmit}>
{supportedAuthKinds.length > 1 && (
- <fieldset className="mb-4">
- <legend className="mb-1.5 system-xs-medium text-text-secondary">
- {t(($) => $['newKnowledge.authenticationMethod'])}
- </legend>
- <div className="flex gap-2">
- {supportedAuthKinds.map((kind) => (
- <label
- key={kind}
- className="flex items-center gap-1.5 system-xs-regular text-text-secondary"
- >
- <input
- type="radio"
- name="auth-kind"
- value={kind}
- checked={authKind === kind}
- onChange={() => changeAuthKind(kind)}
- />
- {t(($) => $[`newKnowledge.authKind.${kind}`])}
- </label>
- ))}
- </div>
- </fieldset>
+ <Field className="contents">
+ <Fieldset
+ className="mb-4"
+ render={
+ <RadioGroup<ConnectionAuthKind>
+ name="auth-kind"
+ value={authKind}
+ onValueChange={changeAuthKind}
+ className="block"
+ />
+ }
+ >
+ <FieldsetLegend className="mb-1.5 py-0 system-xs-medium text-text-secondary">
+ {t(($) => $['newKnowledge.authenticationMethod'])}
+ </FieldsetLegend>
+ <div className="flex gap-2">
+ {supportedAuthKinds.map((kind) => (
+ <FieldItem key={kind} className="contents">
+ <label className="flex cursor-pointer items-center gap-1.5 system-xs-regular text-text-secondary">
+ <Radio value={kind} />
+ {t(($) => $[`newKnowledge.authKind.${kind}`])}
+ </label>
+ </FieldItem>
+ ))}
+ </div>
+ </Fieldset>
+ </Field>
)}
<div className="space-y-3">
{visibleFields.map((field) => (
diff --git a/web/features/new-rag/add-source-placeholder.tsx b/web/features/new-rag/add-source-placeholder.tsx
index 30fa9b16a6c..a26d926467e 100644
--- a/web/features/new-rag/add-source-placeholder.tsx
+++ b/web/features/new-rag/add-source-placeholder.tsx
@@ -9,7 +9,11 @@ import type {
NewKnowledgeWebsiteSourceDraft,
} from './routes'
import { Button } from '@langgenius/dify-ui/button'
+import { Checkbox } from '@langgenius/dify-ui/checkbox'
import { cn } from '@langgenius/dify-ui/cn'
+import { Field, FieldItem } from '@langgenius/dify-ui/field'
+import { Fieldset, FieldsetLegend } from '@langgenius/dify-ui/fieldset'
+import { Radio, RadioGroup } from '@langgenius/dify-ui/radio-group'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
@@ -101,14 +105,11 @@ export function PendingWebsiteSetup({
)}
</button>
{optionsExpanded && (
- <fieldset className="grid grid-cols-1 gap-3 px-3 pb-3 sm:grid-cols-2">
- <label className="flex items-center gap-2 system-xs-regular text-text-secondary">
- <input
- type="checkbox"
+ <Fieldset className="grid grid-cols-1 gap-3 px-3 pb-3 sm:grid-cols-2">
+ <label className="flex cursor-pointer items-center gap-2 system-xs-regular text-text-secondary">
+ <Checkbox
checked={draft.includeSubpages}
- onChange={(event) =>
- updateDraft({ ...draft, includeSubpages: event.target.checked })
- }
+ onCheckedChange={(checked) => updateDraft({ ...draft, includeSubpages: checked })}
/>
{t(($) => $['newKnowledge.includeSubpages'])}
</label>
@@ -125,7 +126,7 @@ export function PendingWebsiteSetup({
}
/>
</label>
- </fieldset>
+ </Fieldset>
)}
</div>
<Button
@@ -180,35 +181,40 @@ export function UnavailableConnectedSourceSetup({
return (
<div className="space-y-4">
- <fieldset>
- <legend className="mb-1.5 system-xs-medium text-text-secondary">
- {tCreation(($) => $['stepOne.website.chooseProvider'])}
- </legend>
- <div className="grid grid-cols-1 gap-2 sm:grid-cols-3">
- {providers.map((option) => (
- <label
- key={option.label}
- className={cn(
- 'flex min-h-9 cursor-pointer items-center justify-center gap-2 rounded-lg border px-3 system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
- activeProvider === option.label
- ? 'border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary'
- : 'border-divider-subtle text-text-secondary hover:bg-state-base-hover',
- )}
- >
- <input
- type="radio"
- name={`${sourceType}-provider`}
- value={option.label}
- checked={activeProvider === option.label}
- onChange={() => selectProvider(option.label)}
- className="sr-only"
- />
- <span aria-hidden className={`${option.icon} size-4 shrink-0`} />
- <span className="truncate">{option.label}</span>
- </label>
- ))}
- </div>
- </fieldset>
+ <Field className="contents">
+ <Fieldset
+ render={
+ <RadioGroup
+ name={`${sourceType}-provider`}
+ value={activeProvider}
+ onValueChange={selectProvider}
+ className="block"
+ />
+ }
+ >
+ <FieldsetLegend className="mb-1.5 py-0 system-xs-medium text-text-secondary">
+ {tCreation(($) => $['stepOne.website.chooseProvider'])}
+ </FieldsetLegend>
+ <div className="grid grid-cols-1 gap-2 sm:grid-cols-3">
+ {providers.map((option) => (
+ <FieldItem key={option.label} className="contents">
+ <label
+ className={cn(
+ 'flex min-h-9 cursor-pointer items-center justify-center gap-2 rounded-lg border px-3 system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
+ activeProvider === option.label
+ ? 'border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary'
+ : 'border-divider-subtle text-text-secondary hover:bg-state-base-hover',
+ )}
+ >
+ <Radio value={option.label} className="sr-only" />
+ <span aria-hidden className={`${option.icon} size-4 shrink-0`} />
+ <span className="truncate">{option.label}</span>
+ </label>
+ </FieldItem>
+ ))}
+ </div>
+ </Fieldset>
+ </Field>
{sourceType === 'onlineDrive' && (
<section
diff --git a/web/features/new-rag/crawl-selection-form.tsx b/web/features/new-rag/crawl-selection-form.tsx
index 0010eb04517..d26ad164009 100644
--- a/web/features/new-rag/crawl-selection-form.tsx
+++ b/web/features/new-rag/crawl-selection-form.tsx
@@ -420,7 +420,7 @@ function ReadyCrawlSelectionForm({
</Button>
</div>
<div className="mt-3 overflow-hidden rounded-xl border border-divider-regular">
- <label className="flex cursor-pointer items-center gap-2.5 border-b border-divider-subtle bg-background-section px-3 py-2.5 system-xs-medium text-text-secondary">
+ <label className="flex cursor-pointer items-center gap-2.5 border-b border-divider-subtle bg-background-section px-3 py-2.5 system-xs-medium text-text-secondary has-data-disabled:cursor-not-allowed">
<Checkbox
checked={allSelected}
indeterminate={someSelected && !allSelected}
@@ -440,7 +440,7 @@ function ReadyCrawlSelectionForm({
const reasonId = `${pageDescriptionPrefixId}-reason-${index}`
return (
<li key={page.pageId}>
- <label className="flex cursor-pointer items-center gap-2.5 px-3 py-2.5">
+ <label className="flex cursor-pointer items-center gap-2.5 px-3 py-2.5 has-data-disabled:cursor-not-allowed">
<Checkbox
checked={selectedPageIds.has(page.pageId)}
disabled={!selectable || selectionLimitReached || selectionLocked}
diff --git a/web/features/new-rag/create-source-setup.tsx b/web/features/new-rag/create-source-setup.tsx
index eea265364bb..6225f1b2e21 100644
--- a/web/features/new-rag/create-source-setup.tsx
+++ b/web/features/new-rag/create-source-setup.tsx
@@ -7,7 +7,11 @@ import type {
NewKnowledgeWebsiteProvider,
} from './routes'
import { Button } from '@langgenius/dify-ui/button'
+import { Checkbox } from '@langgenius/dify-ui/checkbox'
import { cn } from '@langgenius/dify-ui/cn'
+import { Field, FieldItem } from '@langgenius/dify-ui/field'
+import { Fieldset, FieldsetLegend } from '@langgenius/dify-ui/fieldset'
+import { Radio, RadioGroup } from '@langgenius/dify-ui/radio-group'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
@@ -132,84 +136,97 @@ export function CreateSourceSetup({
return (
<div className="mx-4 mb-4 space-y-4 border-t border-divider-subtle pt-4">
- <fieldset disabled={disabled}>
- <legend className="mb-1.5 system-xs-medium text-text-secondary">
- {t(($) => $['newKnowledge.sourceTypeLabel'])}
- </legend>
- <div className="grid grid-cols-1 gap-0.5 rounded-lg bg-background-default p-0.5 sm:grid-cols-3">
- {sourceTypes.map((option) => (
- <label
- key={option.value}
- className={cn(
- 'relative flex min-h-8 items-center justify-center gap-1.5 rounded-md px-2 system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
- sourceType === option.value
- ? 'bg-components-option-card-option-selected-bg text-text-primary shadow-xs'
- : 'cursor-pointer text-text-tertiary hover:text-text-secondary',
- disabled && 'cursor-not-allowed opacity-60',
- )}
- >
- <input
- type="radio"
- name="create-source-type"
- value={option.value}
- checked={sourceType === option.value}
- onChange={() => {
- setBackendBoundaryVisible(false)
- onSourceTypeChange(option.value)
- }}
- className="sr-only"
- />
- <span aria-hidden className={`${option.icon} size-4`} />
- {t(($) => $[`newKnowledge.${option.value}`])}
- </label>
- ))}
- </div>
- </fieldset>
+ <Field className="contents">
+ <Fieldset
+ render={
+ <RadioGroup<NewKnowledgeSourceDraft['sourceType']>
+ name="create-source-type"
+ value={sourceType}
+ disabled={disabled}
+ onValueChange={(value) => {
+ setBackendBoundaryVisible(false)
+ onSourceTypeChange(value)
+ }}
+ className="block"
+ />
+ }
+ >
+ <FieldsetLegend className="mb-1.5 py-0 system-xs-medium text-text-secondary">
+ {t(($) => $['newKnowledge.sourceTypeLabel'])}
+ </FieldsetLegend>
+ <div className="grid grid-cols-1 gap-0.5 rounded-lg bg-background-default p-0.5 sm:grid-cols-3">
+ {sourceTypes.map((option) => (
+ <FieldItem key={option.value} className="contents">
+ <label
+ className={cn(
+ 'relative flex min-h-8 items-center justify-center gap-1.5 rounded-md px-2 system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
+ sourceType === option.value
+ ? 'bg-components-option-card-option-selected-bg text-text-primary shadow-xs'
+ : 'cursor-pointer text-text-tertiary hover:text-text-secondary',
+ disabled && 'cursor-not-allowed opacity-60',
+ )}
+ >
+ <Radio value={option.value} className="sr-only" />
+ <span aria-hidden className={`${option.icon} size-4`} />
+ {t(($) => $[`newKnowledge.${option.value}`])}
+ </label>
+ </FieldItem>
+ ))}
+ </div>
+ </Fieldset>
+ </Field>
- <fieldset disabled={disabled}>
- <legend className="sr-only">{tCreation(($) => $['stepOne.website.chooseProvider'])}</legend>
- <div className="mb-1.5 flex items-center justify-between gap-3">
- <span className="system-xs-medium text-text-secondary">
+ <Field className="contents">
+ <Fieldset
+ render={
+ <RadioGroup
+ name="create-source-provider"
+ value={activeProvider}
+ disabled={disabled}
+ onValueChange={selectProvider}
+ className="block"
+ />
+ }
+ >
+ <FieldsetLegend className="sr-only">
{tCreation(($) => $['stepOne.website.chooseProvider'])}
- </span>
- <button
- type="button"
- disabled={disabled}
- className="rounded-sm system-xs-medium text-text-accent outline-hidden hover:text-text-accent-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid disabled:cursor-not-allowed disabled:text-text-disabled"
- onClick={showBackendBoundary}
- >
- {t(($) => $['newKnowledge.moreProviders'])}
- </button>
- </div>
- <div className={cn('grid grid-cols-2 gap-2', 'sm:grid-cols-3')}>
- {providers[sourceType].map((provider) => {
- return (
- <label
- key={provider.label}
- className={cn(
- 'flex min-h-10 items-center gap-2 rounded-lg border bg-background-default px-3 system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
- activeProvider === provider.label
- ? 'border-components-option-card-option-selected-border text-text-primary'
- : 'cursor-pointer border-divider-subtle text-text-secondary hover:bg-state-base-hover',
- disabled && 'cursor-not-allowed opacity-60',
- )}
- >
- <input
- type="radio"
- name="create-source-provider"
- value={provider.label}
- checked={activeProvider === provider.label}
- disabled={disabled}
- onChange={() => selectProvider(provider.label)}
- className="sr-only"
- />
- <span aria-hidden className={`${provider.icon} size-4 shrink-0`} />
- <span className="truncate">{provider.label}</span>
- </label>
- )
- })}
- </div>
- </fieldset>
+ </FieldsetLegend>
+ <div className="mb-1.5 flex items-center justify-between gap-3">
+ <span className="system-xs-medium text-text-secondary">
+ {tCreation(($) => $['stepOne.website.chooseProvider'])}
+ </span>
+ <button
+ type="button"
+ disabled={disabled}
+ className="rounded-sm system-xs-medium text-text-accent outline-hidden hover:text-text-accent-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid disabled:cursor-not-allowed disabled:text-text-disabled"
+ onClick={showBackendBoundary}
+ >
+ {t(($) => $['newKnowledge.moreProviders'])}
+ </button>
+ </div>
+ <div className={cn('grid grid-cols-2 gap-2', 'sm:grid-cols-3')}>
+ {providers[sourceType].map((provider) => {
+ return (
+ <FieldItem key={provider.label} className="contents">
+ <label
+ className={cn(
+ 'flex min-h-10 items-center gap-2 rounded-lg border bg-background-default px-3 system-xs-medium outline-hidden has-focus-visible:ring-2 has-focus-visible:ring-state-accent-solid',
+ activeProvider === provider.label
+ ? 'border-components-option-card-option-selected-border text-text-primary'
+ : 'cursor-pointer border-divider-subtle text-text-secondary hover:bg-state-base-hover',
+ disabled && 'cursor-not-allowed opacity-60',
+ )}
+ >
+ <Radio value={provider.label} className="sr-only" />
+ <span aria-hidden className={`${provider.icon} size-4 shrink-0`} />
+ <span className="truncate">{provider.label}</span>
+ </label>
+ </FieldItem>
+ )
+ })}
+ </div>
+ </Fieldset>
+ </Field>
{draft.sourceType === 'websiteCrawl' && (
<div className="space-y-4">
@@ -278,17 +295,17 @@ export function CreateSourceSetup({
)}
</button>
{optionsExpanded && (
- <fieldset
+ <Fieldset
disabled={disabled}
className="grid grid-cols-1 gap-3 px-3 pb-3 sm:grid-cols-2"
>
- <label className="flex items-center gap-2 system-xs-regular text-text-secondary">
- <input
- type="checkbox"
+ <label className="flex cursor-pointer items-center gap-2 system-xs-regular text-text-secondary has-data-disabled:cursor-not-allowed">
+ <Checkbox
name="includeSubpages"
checked={draft.includeSubpages}
- onChange={(event) =>
- updateDraft({ ...draft, includeSubpages: event.target.checked })
+ disabled={disabled}
+ onCheckedChange={(checked) =>
+ updateDraft({ ...draft, includeSubpages: checked })
}
/>
{t(($) => $['newKnowledge.includeSubpages'])}
@@ -310,7 +327,7 @@ export function CreateSourceSetup({
}}
/>
</label>
- </fieldset>
+ </Fieldset>
)}
</div>
<Button
diff --git a/web/features/new-rag/website-crawl-preview.tsx b/web/features/new-rag/website-crawl-preview.tsx
index 0e1d21a14ff..5cf611e065c 100644
--- a/web/features/new-rag/website-crawl-preview.tsx
+++ b/web/features/new-rag/website-crawl-preview.tsx
@@ -17,7 +17,9 @@ import {
AlertDialogTitle,
} from '@langgenius/dify-ui/alert-dialog'
import { Button } from '@langgenius/dify-ui/button'
+import { Checkbox } from '@langgenius/dify-ui/checkbox'
import { cn } from '@langgenius/dify-ui/cn'
+import { Fieldset } from '@langgenius/dify-ui/fieldset'
import { useRefWithInit } from '@langgenius/dify-ui/use-ref-with-init'
import { memo, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -220,12 +222,7 @@ const CrawlPageList = memo(
key={page.pageId}
className="flex items-start gap-2.5 px-4 py-2.5 [contain-intrinsic-size:auto_40px] [content-visibility:auto]"
>
- <input
- type="checkbox"
- disabled
- aria-label={page.title || page.sourceUrl}
- className="mt-0.5 size-4"
- />
+ <Checkbox disabled aria-label={page.title || page.sourceUrl} className="mt-0.5" />
<span className="min-w-0">
<span className="block truncate system-xs-medium text-text-primary">
{page.title || page.sourceUrl}
@@ -1037,7 +1034,7 @@ export function WebsiteCrawlPreview({
{t(($) => $['newKnowledge.providerConnected'], { provider: providerName })}
</p>
<form onSubmit={handleSubmit}>
- <fieldset disabled={locked} className="mt-4 space-y-4 disabled:opacity-70">
+ <Fieldset disabled={locked} className="mt-4 space-y-4 disabled:opacity-70">
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
<label className="block">
<span className="system-xs-medium text-text-secondary">
@@ -1111,11 +1108,11 @@ export function WebsiteCrawlPreview({
</button>
{optionsExpanded && (
<div className="grid grid-cols-1 gap-3 border-t border-divider-subtle p-3 sm:grid-cols-2">
- <label className="flex h-9 items-center gap-2 system-xs-regular text-text-secondary">
- <input
- type="checkbox"
+ <label className="flex h-9 cursor-pointer items-center gap-2 system-xs-regular text-text-secondary has-data-disabled:cursor-not-allowed">
+ <Checkbox
checked={includeSubpages}
- onChange={(event) => setIncludeSubpages(event.target.checked)}
+ disabled={locked}
+ onCheckedChange={setIncludeSubpages}
/>
{t(($) => $['newKnowledge.includeSubpages'])}
</label>
@@ -1147,7 +1144,7 @@ export function WebsiteCrawlPreview({
</div>
)}
</div>
- </fieldset>
+ </Fieldset>
{!showSuccess && (
<Button