@landtrustinc/design-system 1.2.27-beta.3 → 1.2.27-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -3
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1343,11 +1343,10 @@ type ChatWidgetProps = {
|
|
|
1343
1343
|
};
|
|
1344
1344
|
type ChatWidgetRef = {
|
|
1345
1345
|
/**
|
|
1346
|
-
* Scroll to a specific message by index
|
|
1346
|
+
* Scroll to a specific message by index, positioning it at the top of the scroll container
|
|
1347
1347
|
* @param index - The index of the message in the messages array
|
|
1348
|
-
* @param position - Where to position the message in the viewport ('start' | 'center' | 'end')
|
|
1349
1348
|
*/
|
|
1350
|
-
scrollToMessageIndex: (index: number
|
|
1349
|
+
scrollToMessageIndex: (index: number) => void;
|
|
1351
1350
|
};
|
|
1352
1351
|
declare const ChatWidget: React__default.ForwardRefExoticComponent<ChatWidgetProps & React__default.RefAttributes<ChatWidgetRef>>;
|
|
1353
1352
|
|
package/dist/index.js
CHANGED
|
@@ -5955,14 +5955,16 @@ var ChatWidget = import_react30.default.forwardRef(
|
|
|
5955
5955
|
(0, import_react30.useImperativeHandle)(
|
|
5956
5956
|
ref,
|
|
5957
5957
|
() => ({
|
|
5958
|
-
scrollToMessageIndex: (index
|
|
5958
|
+
scrollToMessageIndex: (index) => {
|
|
5959
5959
|
const messageEl = messageRefs.current[index];
|
|
5960
|
-
|
|
5960
|
+
const container = scrollRef.current;
|
|
5961
|
+
if (messageEl && container && isExpanded) {
|
|
5961
5962
|
requestAnimationFrame(() => {
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5963
|
+
const containerRect = container.getBoundingClientRect();
|
|
5964
|
+
const messageRect = messageEl.getBoundingClientRect();
|
|
5965
|
+
const scrollAmount = container.scrollTop + (messageRect.top - containerRect.top);
|
|
5966
|
+
container.scrollTop = scrollAmount;
|
|
5967
|
+
savedScrollPosition.current = scrollAmount;
|
|
5966
5968
|
});
|
|
5967
5969
|
}
|
|
5968
5970
|
}
|