diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/starter/input-format.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/starter/input-format.tsx index 8502854b75d..c23c18ba66c 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/starter/input-format.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/starter/input-format.tsx @@ -3,18 +3,17 @@ import { Badge, Button, Code, + CollapsibleCard, Combobox, type ComboboxOption, calculateGutterWidth, cn, - Expandable, - ExpandableContent, getCodeEditorProps, - handleKeyboardActivation, highlight, Input, Label, languages, + OverflowText, Tooltip, } from '@sim/emcn' import { ArrowLeftRight, Plus, Trash } from '@sim/emcn/icons' @@ -388,52 +387,6 @@ export function FieldFormat({ ) } - /** - * Renders the field header with name, type badge, and action buttons - */ - const renderFieldHeader = (field: Field, index: number) => ( -
toggleCollapse(field.id)} - onKeyDown={(event) => { - if (event.target !== event.currentTarget) return - handleKeyboardActivation(event, () => toggleCollapse(field.id)) - }} - > -
- - {field.name || `${title} ${index + 1}`} - - {field.name && showType && ( - - {field.type} - - )} -
-
e.stopPropagation()} - > - - -
-
- ) - /** * Renders the value input field based on the field type */ @@ -670,113 +623,145 @@ export function FieldFormat({ return (
{fields.map((field, index) => ( -
+ + {field.name && showType && ( + + {field.type} + + )} + + } + collapsed={!!field.collapsed} + onToggleCollapse={() => toggleCollapse(field.id)} + animated + actions={ + <> + + + + } > - {renderFieldHeader(field, index)} - - - -
-
- {renderFieldLabel('Name')} -
{renderNameInput(field)}
-
+
+ {renderFieldLabel('Name')} +
{renderNameInput(field)}
+
+ + {showType && ( +
+ {renderFieldLabel('Type')} + updateField(field.id, 'type', value)} + disabled={isReadOnly} + /> +
+ )} - {showType && ( -
- {renderFieldLabel('Type')} - updateField(field.id, 'type', value)} - disabled={isReadOnly} - /> -
- )} - - {showDescription && ( -
- {renderFieldLabel('Description')} -
- { - if (el) descriptionInputRefs.current[field.id] = el - }} - value={field.description ?? ''} - onChange={(e) => updateField(field.id, 'description', e.target.value)} - onScroll={(e) => - syncDescriptionOverlayScroll(field.id, e.currentTarget.scrollLeft) - } - onPaste={() => - setTimeout(() => { - const input = descriptionInputRefs.current[field.id] - input && syncDescriptionOverlayScroll(field.id, input.scrollLeft) - }, 0) - } - placeholder={descriptionPlaceholder} - disabled={isReadOnly} - autoComplete='off' - className='allow-scroll w-full overflow-x-auto overflow-y-hidden text-transparent caret-foreground [letter-spacing:inherit] placeholder:text-muted-foreground/50' - /> -
{ - if (el) descriptionOverlayRefs.current[field.id] = el - }} - style={{ scrollbarWidth: 'none' }} - className={cn( - 'pointer-events-none absolute inset-0 flex items-center overflow-x-auto bg-transparent px-2 py-1.5 font-sans text-sm', - isReadOnly && 'opacity-50' - )} - > - - {formatDisplayText( - field.description ?? '', - accessiblePrefixes - ? { - accessiblePrefixes, - workflowSearchHighlight: getActiveWorkflowSearchHighlight({ - activeSearchTarget, - blockId, - subBlockId, - valuePath: [index, 'description'], - }), - } - : { - highlightAll: true, - workflowSearchHighlight: getActiveWorkflowSearchHighlight({ - activeSearchTarget, - blockId, - subBlockId, - valuePath: [index, 'description'], - }), - } - )} - -
-
-
- )} - - {showValue && ( -
- {isFileFieldType(field.type) ? ( -
- {renderFieldLabel('Value')} - {renderFileModeToggle(field)} -
- ) : ( - renderFieldLabel('Value') + {showDescription && ( +
+ {renderFieldLabel('Description')} +
+ { + if (el) descriptionInputRefs.current[field.id] = el + }} + value={field.description ?? ''} + onChange={(e) => updateField(field.id, 'description', e.target.value)} + onScroll={(e) => + syncDescriptionOverlayScroll(field.id, e.currentTarget.scrollLeft) + } + onPaste={() => + setTimeout(() => { + const input = descriptionInputRefs.current[field.id] + input && syncDescriptionOverlayScroll(field.id, input.scrollLeft) + }, 0) + } + placeholder={descriptionPlaceholder} + disabled={isReadOnly} + autoComplete='off' + className='allow-scroll w-full overflow-x-auto overflow-y-hidden text-transparent caret-foreground [letter-spacing:inherit] placeholder:text-muted-foreground/50' + /> +
{ + if (el) descriptionOverlayRefs.current[field.id] = el + }} + style={{ scrollbarWidth: 'none' }} + className={cn( + 'pointer-events-none absolute inset-0 flex items-center overflow-x-auto bg-transparent px-2 py-1.5 font-sans text-sm', + isReadOnly && 'opacity-50' + )} + > + + {formatDisplayText( + field.description ?? '', + accessiblePrefixes + ? { + accessiblePrefixes, + workflowSearchHighlight: getActiveWorkflowSearchHighlight({ + activeSearchTarget, + blockId, + subBlockId, + valuePath: [index, 'description'], + }), + } + : { + highlightAll: true, + workflowSearchHighlight: getActiveWorkflowSearchHighlight({ + activeSearchTarget, + blockId, + subBlockId, + valuePath: [index, 'description'], + }), + } )} -
{renderValueInput(field)}
-
- )} + +
- - -
+
+ )} + + {showValue && ( +
+ {isFileFieldType(field.type) ? ( +
+ {renderFieldLabel('Value')} + {renderFileModeToggle(field)} +
+ ) : ( + renderFieldLabel('Value') + )} +
{renderValueInput(field)}
+
+ )} + ))}
) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input/variables-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input/variables-input.tsx index 5ce53f38f50..85da29e76f4 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input/variables-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input/variables-input.tsx @@ -2,12 +2,13 @@ import { useEffect, useRef, useState } from 'react' import { Badge, Button, + CollapsibleCard, Combobox, type ComboboxOption, cn, - handleKeyboardActivation, Input, Label, + OverflowText, Textarea, Tooltip, } from '@sim/emcn' @@ -382,39 +383,32 @@ export function VariablesInput({ }) return ( -
-
toggleCollapse(assignment.id)} - onKeyDown={(event) => { - if (event.target !== event.currentTarget) return - handleKeyboardActivation(event, () => toggleCollapse(assignment.id)) - }} - > -
- + title={ + + {assignment.variableName ? formatDisplayText(assignment.variableName, { workflowSearchHighlight: variableLabelHighlight, }) : `Variable ${index + 1}`} - + {assignment.variableName && ( {assignment.type} )} -
-
+ + } + collapsed={collapsed} + onToggleCollapse={() => toggleCollapse(assignment.id)} + actions={ + <> -
+ + } + > +
+ + ({ label: v.name, value: v.id }))} + value={assignment.variableId || ''} + onChange={(value) => handleVariableSelect(assignment.id, value)} + placeholder='Select a variable...' + disabled={isReadOnly} + overlayContent={ + variableLabelHighlight ? ( + + {formatDisplayText(variableLabel, { + workflowSearchHighlight: variableLabelHighlight, + })} + + ) : undefined + } + />
- {!collapsed && ( -
-
- - ({ label: v.name, value: v.id }))} - value={assignment.variableId || ''} - onChange={(value) => handleVariableSelect(assignment.id, value)} - placeholder='Select a variable...' - disabled={isReadOnly} - overlayContent={ - variableLabelHighlight ? ( - - {formatDisplayText(variableLabel, { - workflowSearchHighlight: variableLabelHighlight, - })} - - ) : undefined +
+
+ + {assignment.type === 'boolean' && ( + + + + + +

{isManualBoolean ? 'Switch to selector' : 'Switch to manual value'}

+
+
+ )} +
+ {assignment.type === 'boolean' && !isManualBoolean ? ( + !isReadOnly && updateAssignment(assignment.id, { value: v })} + placeholder='Select value' + disabled={isReadOnly} + overlayContent={ + booleanLabelHighlight ? ( + + {formatDisplayText(assignment.value ?? '', { + workflowSearchHighlight: booleanLabelHighlight, + })} + + ) : undefined + } + /> + ) : assignment.type === 'object' || assignment.type === 'array' ? ( +
+