Skip to content

Commit 6199813

Browse files
committed
feat: emcn modal, help-modal; improvement(ui): emcn textarea, emcn combobox, messages-input
1 parent f385791 commit 6199813

File tree

5 files changed

+516
-255
lines changed

5 files changed

+516
-255
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/messages-input/messages-input.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/
1212
import type { SubBlockConfig } from '@/blocks/types'
1313

1414
const MIN_TEXTAREA_HEIGHT_PX = 80
15+
const MAX_TEXTAREA_HEIGHT_PX = 320
1516

1617
/**
1718
* Interface for individual message in the messages array
@@ -236,10 +237,12 @@ export function MessagesInput({
236237
return
237238
}
238239

239-
// Auto-resize to fit content only when user hasn't manually resized.
240240
textarea.style.height = 'auto'
241241
const naturalHeight = textarea.scrollHeight || MIN_TEXTAREA_HEIGHT_PX
242-
const nextHeight = Math.max(MIN_TEXTAREA_HEIGHT_PX, naturalHeight)
242+
const nextHeight = Math.min(
243+
MAX_TEXTAREA_HEIGHT_PX,
244+
Math.max(MIN_TEXTAREA_HEIGHT_PX, naturalHeight)
245+
)
243246
textarea.style.height = `${nextHeight}px`
244247

245248
if (overlay) {
@@ -453,7 +456,7 @@ export function MessagesInput({
453456
ref={(el) => {
454457
textareaRefs.current[fieldId] = el
455458
}}
456-
className='allow-scroll box-border min-h-[80px] w-full resize-none whitespace-pre-wrap break-words border-none bg-transparent px-[8px] py-[8px] font-[inherit] font-medium text-sm text-transparent leading-[inherit] caret-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)] focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed'
459+
className='allow-scroll box-border min-h-[80px] w-full resize-none whitespace-pre-wrap break-words border-none bg-transparent px-[8px] pt-[8px] font-[inherit] font-medium text-sm text-transparent leading-[inherit] caret-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)] focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed'
457460
rows={3}
458461
placeholder='Enter message content...'
459462
value={message.content}
@@ -496,7 +499,7 @@ export function MessagesInput({
496499
ref={(el) => {
497500
overlayRefs.current[fieldId] = el
498501
}}
499-
className='pointer-events-none absolute top-0 left-0 box-border w-full overflow-auto whitespace-pre-wrap break-words border-none bg-transparent px-[8px] py-[8px] font-[inherit] font-medium text-[var(--text-primary)] text-sm leading-[inherit]'
502+
className='scrollbar-none pointer-events-none absolute top-0 left-0 box-border w-full overflow-auto whitespace-pre-wrap break-words border-none bg-transparent px-[8px] pt-[8px] font-[inherit] font-medium text-[var(--text-primary)] text-sm leading-[inherit]'
500503
>
501504
{formatDisplayText(message.content, {
502505
accessiblePrefixes,

0 commit comments

Comments
 (0)