Skip to content

Commit 04096b6

Browse files
authored
fix(ui): align remaining editor dropdown styling (#8051)
1 parent 8b5109f commit 04096b6

5 files changed

Lines changed: 23 additions & 12 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.test.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function renderOutputSelect(
204204
selectedOutputs: string[],
205205
onOutputSelect = vi.fn(),
206206
valueMode: 'id' | 'label' | 'public' = 'id',
207-
props: { size?: 'sm' | 'md'; disablePortal?: boolean } = {}
207+
props: { size?: 'sm' | 'md'; variant?: 'default' | 'chip'; disablePortal?: boolean } = {}
208208
) {
209209
;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
210210
container = document.createElement('div')
@@ -266,8 +266,12 @@ describe('OutputSelect nested workflow menu', () => {
266266
expect(document.body.textContent).not.toContain('Summarizer')
267267
})
268268

269-
it('forwards inline dropdown rendering to the chip combobox', () => {
270-
renderOutputSelect([], vi.fn(), 'id', { size: 'md', disablePortal: true })
269+
it('forwards inline dropdown rendering to explicitly chip-styled forms', () => {
270+
renderOutputSelect([], vi.fn(), 'id', {
271+
size: 'md',
272+
variant: 'chip',
273+
disablePortal: true,
274+
})
271275

272276
expect(container.querySelector('[data-chip-combobox]')).toHaveAttribute(
273277
'data-disable-portal',
@@ -284,7 +288,7 @@ describe('OutputSelect nested workflow menu', () => {
284288
})
285289

286290
it('emits public dot selectors for trigger authoring', () => {
287-
const onOutputSelect = renderOutputSelect([], vi.fn(), 'public')
291+
const onOutputSelect = renderOutputSelect([], vi.fn(), 'public', { size: 'md' })
288292

289293
clickOption('content')
290294
expect(onOutputSelect).toHaveBeenCalledWith(['summarizer.content'])

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ interface OutputSelectProps {
5050
maxHeight?: number
5151
disablePortal?: boolean
5252
/**
53-
* Trigger chrome. `'sm'` is the compact pill used in inline toolbars;
54-
* `'md'` is the 30px chip field, for stacking with `ChipInput` in a form.
53+
* Trigger size. `'sm'` is compact for inline toolbars;
54+
* `'md'` matches the editor's full-size fields.
5555
* @default 'sm'
5656
*/
5757
size?: 'sm' | 'md'
58+
/** Use chip chrome when embedding the selector in a chip-styled form. */
59+
variant?: 'default' | 'chip'
5860
/** Additional class names to apply to the combobox trigger */
5961
className?: string
6062
}
@@ -71,6 +73,7 @@ interface OutputSelectMenuProps {
7173
maxHeight: number
7274
disablePortal: boolean
7375
size: 'sm' | 'md'
76+
variant: 'default' | 'chip'
7477
className?: string
7578
}
7679

@@ -129,6 +132,7 @@ function OutputSelectContent({
129132
maxHeight = 200,
130133
disablePortal = false,
131134
size = 'sm',
135+
variant = 'default',
132136
className,
133137
}: OutputSelectProps) {
134138
const blocks = useWorkflowStore((state) => state.blocks)
@@ -233,6 +237,7 @@ function OutputSelectContent({
233237
maxHeight={maxHeight}
234238
disablePortal={disablePortal}
235239
size={size}
240+
variant={variant}
236241
className={className}
237242
/>
238243
)
@@ -250,6 +255,7 @@ function OutputSelectMenu({
250255
maxHeight,
251256
disablePortal,
252257
size,
258+
variant,
253259
className,
254260
}: OutputSelectMenuProps) {
255261
const [menuPath, setMenuPath] = useState<string[]>([])
@@ -318,7 +324,7 @@ function OutputSelectMenu({
318324
...activeMenuNode.children.map(outputGroup),
319325
]
320326
: outputMenu.map(outputGroup)
321-
const Trigger = size === 'md' ? ChipCombobox : Combobox
327+
const Trigger = variant === 'chip' ? ChipCombobox : Combobox
322328

323329
return (
324330
<Trigger

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/chat/chat.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ export function ChatDeploy({
389389
placeholder='Select which block outputs to use'
390390
disabled={chatSubmitting}
391391
size='md'
392+
variant='chip'
392393
className='w-full'
393394
disablePortal
394395
/>

apps/sim/components/mcp/operation-policy-editor.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/** @vitest-environment node */
22
import type { ComponentProps } from 'react'
3-
import type { ChipDropdown, TagInput } from '@sim/emcn'
3+
import type { Combobox, TagInput } from '@sim/emcn'
44
import { renderToStaticMarkup } from 'react-dom/server'
55
import { beforeEach, describe, expect, it, vi } from 'vitest'
66

77
const { tagInput, dropdown } = vi.hoisted(() => ({
88
tagInput: vi.fn<(props: ComponentProps<typeof TagInput>) => null>(() => null),
9-
dropdown: vi.fn<(props: ComponentProps<typeof ChipDropdown>) => null>(() => null),
9+
dropdown: vi.fn<(props: ComponentProps<typeof Combobox>) => null>(() => null),
1010
}))
11-
vi.mock('@sim/emcn', () => ({ TagInput: tagInput, ChipDropdown: dropdown }))
11+
vi.mock('@sim/emcn', () => ({ TagInput: tagInput, Combobox: dropdown }))
1212

1313
import { McpOperationPolicyEditor } from '@/components/mcp/operation-policy-editor'
1414

apps/sim/components/mcp/operation-policy-editor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { useId, useState } from 'react'
4-
import { ChipDropdown, TagInput } from '@sim/emcn'
4+
import { Combobox, TagInput } from '@sim/emcn'
55
import { getErrorMessage } from '@sim/utils/errors'
66
import { type McpOperationPolicy, normalizeMcpOperationPolicy } from '@/lib/mcp/operation-policy'
77

@@ -41,7 +41,7 @@ export function McpOperationPolicyEditor({
4141

4242
return (
4343
<div className='flex flex-col gap-2'>
44-
<ChipDropdown
44+
<Combobox
4545
aria-label='Operations access'
4646
value={policy.mode}
4747
disabled={disabled}

0 commit comments

Comments
 (0)