UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines • 2.66 kB
{"version":3,"file":"ChatInputArea.mjs","names":[],"sources":["../../../src/chat/ChatInputArea/ChatInputArea.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { memo } from 'react';\n\nimport { DraggablePanel } from '@/base-ui/DraggablePanel';\n\nimport ChatInputAreaInner from './components/ChatInputAreaInner';\nimport { styles } from './style';\nimport type { ChatInputAreaProps } from './type';\n\nconst ChatInputArea = memo<ChatInputAreaProps>(\n ({\n ref,\n className,\n style,\n classNames,\n expand = true,\n setExpand,\n bottomAddons,\n topAddons,\n onSizeChange,\n heights,\n onSend,\n ...rest\n }) => {\n const content = (\n <section className={styles.container} style={{ minHeight: heights?.minHeight }}>\n {topAddons}\n <div className={styles.textareaContainer}>\n <ChatInputAreaInner\n className={styles.textarea}\n ref={ref}\n style={{\n paddingInline: 16,\n }}\n onSend={() => {\n onSend?.();\n setExpand?.(false);\n }}\n {...rest}\n />\n </div>\n {bottomAddons}\n </section>\n );\n\n if (expand)\n return (\n <div\n className={cx(styles.fullscreen, className)}\n style={{ insetBlockStart: heights?.headerHeight ?? 0, ...style }}\n >\n {content}\n </div>\n );\n\n return (\n <DraggablePanel\n className={className}\n classNames={classNames}\n maxHeight={heights?.maxHeight}\n minHeight={heights?.minHeight}\n placement=\"bottom\"\n size={{ height: heights?.inputHeight, width: '100%' }}\n style={{ zIndex: 10, ...style }}\n onSizeChange={onSizeChange}\n >\n {content}\n </DraggablePanel>\n );\n },\n);\n\nexport default ChatInputArea;\n"],"mappings":";;;;;;;;AAWA,MAAM,gBAAgB,MACnB,EACC,KACA,WACA,OACA,YACA,SAAS,MACT,WACA,cACA,WACA,cACA,SACA,QACA,GAAG,WACC;CACJ,MAAM,UACJ,qBAAC,WAAD;EAAS,WAAW,OAAO;EAAW,OAAO,EAAE,WAAW,SAAS,UAAU;EAA7E,UAAA;GACG;GACD,oBAAC,OAAD;IAAK,WAAW,OAAO;IACrB,UAAA,oBAAC,oBAAD;KACE,WAAW,OAAO;KACb;KACL,OAAO,EACL,eAAe,GACjB;KACA,cAAc;MACZ,SAAS;MACT,YAAY,KAAK;KACnB;KACA,GAAI;IACL,CAAA;GACE,CAAA;GACJ;EACM;;CAGX,IAAI,QACF,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,OAAO,YAAY,SAAS;EAC1C,OAAO;GAAE,iBAAiB,SAAS,gBAAgB;GAAG,GAAG;EAAM;EAE9D,UAAA;CACE,CAAA;CAGT,OACE,oBAAC,gBAAD;EACa;EACC;EACZ,WAAW,SAAS;EACpB,WAAW,SAAS;EACpB,WAAU;EACV,MAAM;GAAE,QAAQ,SAAS;GAAa,OAAO;EAAO;EACpD,OAAO;GAAE,QAAQ;GAAI,GAAG;EAAM;EAChB;EAEb,UAAA;CACa,CAAA;AAEpB,CACF"}