From f734c35443951891a77aa0a2cd06b6ee82fba2d6 Mon Sep 17 00:00:00 2001 From: yyh Date: Thu, 16 Apr 2026 11:06:03 +0800 Subject: [PATCH] refactor(web): redesign SelectTrigger as pure re-export and migrate WorkplaceSelector to Select SelectTrigger was a heavily styled function coupling ARIA trigger behavior with form-input appearance (input bg, size variants, built-in chevron, clearable/loading). This made it unusable for non-form contexts like WorkplaceSelector and inconsistent with DropdownMenuTrigger which is a pure re-export. - SelectTrigger is now a pure re-export of BaseSelect.Trigger (aligned with DropdownMenuTrigger pattern) - Added SelectIcon re-export for composed triggers needing chevron state - Removed SelectPrimitiveTrigger, selectTriggerVariants, contentPadding, and SelectTriggerProps - 3 form callers migrated to inline composition with className - WorkplaceSelector migrated from @headlessui/react Menu to base-ui Select with correct listbox semantics, fixing the focus ring issue Made-with: Cursor --- .../config-var/config-modal/form-fields.tsx | 15 ++- .../components/base/markdown-blocks/form.tsx | 9 +- web/app/components/base/ui/select/index.tsx | 121 +++--------------- .../workplace-selector/index.tsx | 104 ++++++++------- .../model-parameter-modal/parameter-item.tsx | 9 +- 5 files changed, 103 insertions(+), 155 deletions(-) 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 fa318ae35d..b6a47f521e 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 @@ -11,6 +11,7 @@ import Textarea from '@/app/components/base/textarea' import { Select, SelectContent, + SelectIcon, SelectItem, SelectTrigger, SelectValue, @@ -134,8 +135,11 @@ const ConfigModalFormFields: FC = ({ {type === InputVarType.checkbox && ( ) } export default WorkplaceSelector 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 7732ba5a8c..ada3835642 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 @@ -10,7 +10,7 @@ import PromptEditor from '@/app/components/base/prompt-editor' import Radio from '@/app/components/base/radio' import Switch from '@/app/components/base/switch' import TagInput from '@/app/components/base/tag-input' -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/app/components/base/ui/select' +import { Select, SelectContent, SelectIcon, SelectItem, SelectTrigger, SelectValue } from '@/app/components/base/ui/select' import { Slider } from '@/app/components/base/ui/slider' import { Tooltip, TooltipContent, TooltipTrigger } from '@/app/components/base/ui/tooltip' import { BlockEnum } from '@/app/components/workflow/types' @@ -294,8 +294,11 @@ function ParameterItem({ value={renderValue as string} onValueChange={v => handleInputChange(v ?? undefined)} > - - + + + + + {parameterRule.options!.map(option => (