From 7b2c01f518f071f0593586d1a51aeb6ab0fac8fe Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sat, 19 Sep 2026 18:26:16 -0700 Subject: [PATCH] fix(ui): align remaining editor dropdown styling --- .../components/output-select/output-select.test.tsx | 12 ++++++++---- .../chat/components/output-select/output-select.tsx | 12 +++++++++--- .../components/deploy-modal/components/chat/chat.tsx | 1 + .../components/mcp/operation-policy-editor.test.tsx | 6 +++--- apps/sim/components/mcp/operation-policy-editor.tsx | 4 ++-- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.test.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.test.tsx index 144d5afe4df..e92e9c23b07 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.test.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.test.tsx @@ -204,7 +204,7 @@ function renderOutputSelect( selectedOutputs: string[], onOutputSelect = vi.fn(), valueMode: 'id' | 'label' | 'public' = 'id', - props: { size?: 'sm' | 'md'; disablePortal?: boolean } = {} + props: { size?: 'sm' | 'md'; variant?: 'default' | 'chip'; disablePortal?: boolean } = {} ) { ;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true container = document.createElement('div') @@ -266,8 +266,12 @@ describe('OutputSelect nested workflow menu', () => { expect(document.body.textContent).not.toContain('Summarizer') }) - it('forwards inline dropdown rendering to the chip combobox', () => { - renderOutputSelect([], vi.fn(), 'id', { size: 'md', disablePortal: true }) + it('forwards inline dropdown rendering to explicitly chip-styled forms', () => { + renderOutputSelect([], vi.fn(), 'id', { + size: 'md', + variant: 'chip', + disablePortal: true, + }) expect(container.querySelector('[data-chip-combobox]')).toHaveAttribute( 'data-disable-portal', @@ -284,7 +288,7 @@ describe('OutputSelect nested workflow menu', () => { }) it('emits public dot selectors for trigger authoring', () => { - const onOutputSelect = renderOutputSelect([], vi.fn(), 'public') + const onOutputSelect = renderOutputSelect([], vi.fn(), 'public', { size: 'md' }) clickOption('content') expect(onOutputSelect).toHaveBeenCalledWith(['summarizer.content']) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx index 62b09885d61..60b730175ab 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx @@ -50,11 +50,13 @@ interface OutputSelectProps { maxHeight?: number disablePortal?: boolean /** - * Trigger chrome. `'sm'` is the compact pill used in inline toolbars; - * `'md'` is the 30px chip field, for stacking with `ChipInput` in a form. + * Trigger size. `'sm'` is compact for inline toolbars; + * `'md'` matches the editor's full-size fields. * @default 'sm' */ size?: 'sm' | 'md' + /** Use chip chrome when embedding the selector in a chip-styled form. */ + variant?: 'default' | 'chip' /** Additional class names to apply to the combobox trigger */ className?: string } @@ -71,6 +73,7 @@ interface OutputSelectMenuProps { maxHeight: number disablePortal: boolean size: 'sm' | 'md' + variant: 'default' | 'chip' className?: string } @@ -129,6 +132,7 @@ function OutputSelectContent({ maxHeight = 200, disablePortal = false, size = 'sm', + variant = 'default', className, }: OutputSelectProps) { const blocks = useWorkflowStore((state) => state.blocks) @@ -233,6 +237,7 @@ function OutputSelectContent({ maxHeight={maxHeight} disablePortal={disablePortal} size={size} + variant={variant} className={className} /> ) @@ -250,6 +255,7 @@ function OutputSelectMenu({ maxHeight, disablePortal, size, + variant, className, }: OutputSelectMenuProps) { const [menuPath, setMenuPath] = useState([]) @@ -318,7 +324,7 @@ function OutputSelectMenu({ ...activeMenuNode.children.map(outputGroup), ] : outputMenu.map(outputGroup) - const Trigger = size === 'md' ? ChipCombobox : Combobox + const Trigger = variant === 'chip' ? ChipCombobox : Combobox return ( diff --git a/apps/sim/components/mcp/operation-policy-editor.test.tsx b/apps/sim/components/mcp/operation-policy-editor.test.tsx index 128a048160f..5752757e870 100644 --- a/apps/sim/components/mcp/operation-policy-editor.test.tsx +++ b/apps/sim/components/mcp/operation-policy-editor.test.tsx @@ -1,14 +1,14 @@ /** @vitest-environment node */ import type { ComponentProps } from 'react' -import type { ChipDropdown, TagInput } from '@sim/emcn' +import type { Combobox, TagInput } from '@sim/emcn' import { renderToStaticMarkup } from 'react-dom/server' import { beforeEach, describe, expect, it, vi } from 'vitest' const { tagInput, dropdown } = vi.hoisted(() => ({ tagInput: vi.fn<(props: ComponentProps) => null>(() => null), - dropdown: vi.fn<(props: ComponentProps) => null>(() => null), + dropdown: vi.fn<(props: ComponentProps) => null>(() => null), })) -vi.mock('@sim/emcn', () => ({ TagInput: tagInput, ChipDropdown: dropdown })) +vi.mock('@sim/emcn', () => ({ TagInput: tagInput, Combobox: dropdown })) import { McpOperationPolicyEditor } from '@/components/mcp/operation-policy-editor' diff --git a/apps/sim/components/mcp/operation-policy-editor.tsx b/apps/sim/components/mcp/operation-policy-editor.tsx index f58542926b9..1a4a21eb138 100644 --- a/apps/sim/components/mcp/operation-policy-editor.tsx +++ b/apps/sim/components/mcp/operation-policy-editor.tsx @@ -1,7 +1,7 @@ 'use client' import { useId, useState } from 'react' -import { ChipDropdown, TagInput } from '@sim/emcn' +import { Combobox, TagInput } from '@sim/emcn' import { getErrorMessage } from '@sim/utils/errors' import { type McpOperationPolicy, normalizeMcpOperationPolicy } from '@/lib/mcp/operation-policy' @@ -41,7 +41,7 @@ export function McpOperationPolicyEditor({ return (
-