From 7e731a53a288abaa3c76a9fa636b52215deb5c6a Mon Sep 17 00:00:00 2001 From: Maifee Ul Asad Date: Sat, 14 Jun 2025 14:02:10 +0600 Subject: [PATCH 01/11] feat: reference in bubble #523 --- components/bubble/Bubble.tsx | 137 ++++++++++++++++++++++++++++------- 1 file changed, 109 insertions(+), 28 deletions(-) diff --git a/components/bubble/Bubble.tsx b/components/bubble/Bubble.tsx index 10adf1b41..d42cc4d4a 100644 --- a/components/bubble/Bubble.tsx +++ b/components/bubble/Bubble.tsx @@ -1,7 +1,8 @@ import classnames from 'classnames'; import React from 'react'; -import { Avatar } from 'antd'; +import { InfoCircleOutlined } from '@ant-design/icons'; +import { Avatar, Button, List, Modal, Popover } from 'antd'; import useXComponentConfig from '../_util/hooks/use-x-component-config'; import { useXProviderContext } from '../x-provider'; import useTypedEffect from './hooks/useTypedEffect'; @@ -40,8 +41,10 @@ const Bubble: React.ForwardRefRenderFunction = (props, r onTypingComplete, header, footer, + references, ...otherHtmlProps } = props; + console.log('Bubble', props); const { onUpdate } = React.useContext(BubbleContext); @@ -148,6 +151,79 @@ const Bubble: React.ForwardRefRenderFunction = (props, r ); + // =========================== Reference ============================ + + const referencesContent: React.ReactNode = React.useMemo(() => { + const ReferencesOverlay = () => { + const [isModalVisible, setIsModalVisible] = React.useState(false); + if (!references || references.length === 0) { + return null; + } + + const count = references.length; + + const button = ( + + ); + + return ( + <> + + + ); - const button = ( - - ); - - return ( - <> - - +
+
+
+ +
+
+
+
+ +
+ What a beautiful day! +
+ +
+
+
+ +
+
+
+
+
+ + + + + +
+
+ Hi, good morning, I'm fine! +
+
+
+ +
+ Thank you! +
+
+
+`; + +exports[`renders components/bubble/demo/reference.tsx extend context correctly 2`] = ` +[ + "Warning: [antd: Modal] \`destroyOnClose\` is deprecated. Please use \`destroyOnHidden\` instead.", +] +`; + exports[`renders components/bubble/demo/semantic-list-custom.tsx extend context correctly 1`] = `
`; +exports[`renders components/bubble/demo/reference.tsx correctly 1`] = ` +
+
+
+ + + + + +
+
+ Good morning, how are you? +
+ +
+
+ +
+ What a beautiful day! +
+ +
+
+
+ + + + + +
+
+ Hi, good morning, I'm fine! +
+
+
+ +
+ Thank you! +
+
+
+`; + exports[`renders components/bubble/demo/semantic-list-custom.tsx correctly 1`] = `
Date: Fri, 19 Sep 2025 20:32:57 +0600 Subject: [PATCH 11/11] fix: updated snap after merging from main --- .../__snapshots__/demo-extend.test.ts.snap | 315 +++++++++++++++++- .../__tests__/__snapshots__/demo.test.ts.snap | 193 ++++++++++- 2 files changed, 506 insertions(+), 2 deletions(-) diff --git a/components/bubble/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/bubble/__tests__/__snapshots__/demo-extend.test.ts.snap index 8d4c3542b..18f5a98f8 100644 --- a/components/bubble/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/bubble/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders components/bubble/demo/avatar-and-placement.tsx extend context correctly 1`] = `
+
+
+ + + + + +
+
+ Good morning, how are you? +
+ +
+
+
+ +
+
+
+
+ +
+ What a beautiful day! +
+ +
+
+
+ +
+
+
+
+
+ + + + + +
+
+ Hi, good morning, I'm fine! +
+
+
+ +
+ Thank you! +
+
+
+`; + +exports[`renders components/bubble/demo/reference.tsx extend context correctly 2`] = ` +[ + "Warning: [antd: Modal] \`destroyOnClose\` is deprecated. Please use \`destroyOnHidden\` instead.", +] +`; + exports[`renders components/bubble/demo/semantic-list-custom.tsx extend context correctly 1`] = `
`; +exports[`renders components/bubble/demo/reference.tsx correctly 1`] = ` +
+
+
+ + + + + +
+
+ Good morning, how are you? +
+ +
+
+ +
+ What a beautiful day! +
+ +
+
+
+ + + + + +
+
+ Hi, good morning, I'm fine! +
+
+
+ +
+ Thank you! +
+
+
+`; + exports[`renders components/bubble/demo/semantic-list-custom.tsx correctly 1`] = `