@elliemae/ds-chat-container 3.80.0-next.8 → 3.80.0-next.80
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/cjs/DSChatContainerDefinitions.js +7 -1
- package/dist/cjs/DSChatContainerDefinitions.js.map +2 -2
- package/dist/cjs/parts/chat-composer/ChatContainerComposer.js +0 -1
- package/dist/cjs/parts/chat-composer/ChatContainerComposer.js.map +2 -2
- package/dist/cjs/parts/chat-composer/styled.js +4 -0
- package/dist/cjs/parts/chat-composer/styled.js.map +2 -2
- package/dist/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +134 -69
- package/dist/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +2 -2
- package/dist/cjs/parts/chat-container-messages-list/styled.js +33 -35
- package/dist/cjs/parts/chat-container-messages-list/styled.js.map +2 -2
- package/dist/cjs/parts/chat-container-messages-list/useActionRef.js +2 -5
- package/dist/cjs/parts/chat-container-messages-list/useActionRef.js.map +2 -2
- package/dist/cjs/parts/chat-container-messages-list/useChatContainerMessageList.js +33 -20
- package/dist/cjs/parts/chat-container-messages-list/useChatContainerMessageList.js.map +2 -2
- package/dist/cjs/parts/chat-container-messages-list/useFocusAndScrollHelpers.js +38 -43
- package/dist/cjs/parts/chat-container-messages-list/useFocusAndScrollHelpers.js.map +2 -2
- package/dist/cjs/parts/chat-container-messages-list/useGlobalEventListener.js.map +1 -1
- package/dist/cjs/parts/chat-container-messages-list/useKeyboard.js +8 -15
- package/dist/cjs/parts/chat-container-messages-list/useKeyboard.js.map +2 -2
- package/dist/cjs/parts/chat-container-messages-list/useMessageFocusTracker.js +132 -0
- package/dist/cjs/parts/chat-container-messages-list/useMessageFocusTracker.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +39 -23
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-chat-container-valid.js +31 -0
- package/dist/cjs/typescript-testing/typescript-chat-container-valid.js.map +2 -2
- package/dist/esm/DSChatContainerDefinitions.js +7 -1
- package/dist/esm/DSChatContainerDefinitions.js.map +2 -2
- package/dist/esm/parts/chat-composer/ChatContainerComposer.js +0 -1
- package/dist/esm/parts/chat-composer/ChatContainerComposer.js.map +2 -2
- package/dist/esm/parts/chat-composer/styled.js +4 -0
- package/dist/esm/parts/chat-composer/styled.js.map +2 -2
- package/dist/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +135 -72
- package/dist/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +2 -2
- package/dist/esm/parts/chat-container-messages-list/styled.js +33 -35
- package/dist/esm/parts/chat-container-messages-list/styled.js.map +2 -2
- package/dist/esm/parts/chat-container-messages-list/useActionRef.js +2 -5
- package/dist/esm/parts/chat-container-messages-list/useActionRef.js.map +2 -2
- package/dist/esm/parts/chat-container-messages-list/useChatContainerMessageList.js +33 -20
- package/dist/esm/parts/chat-container-messages-list/useChatContainerMessageList.js.map +2 -2
- package/dist/esm/parts/chat-container-messages-list/useFocusAndScrollHelpers.js +39 -44
- package/dist/esm/parts/chat-container-messages-list/useFocusAndScrollHelpers.js.map +2 -2
- package/dist/esm/parts/chat-container-messages-list/useGlobalEventListener.js.map +1 -1
- package/dist/esm/parts/chat-container-messages-list/useKeyboard.js +8 -15
- package/dist/esm/parts/chat-container-messages-list/useKeyboard.js.map +2 -2
- package/dist/esm/parts/chat-container-messages-list/useMessageFocusTracker.js +102 -0
- package/dist/esm/parts/chat-container-messages-list/useMessageFocusTracker.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +40 -24
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-chat-container-valid.js +31 -0
- package/dist/esm/typescript-testing/typescript-chat-container-valid.js.map +2 -2
- package/dist/types/DSChatContainerDefinitions.d.ts +8 -0
- package/dist/types/parts/chat-container-messages-list/styled.d.ts +18 -5
- package/dist/types/parts/chat-container-messages-list/useActionRef.d.ts +4 -6
- package/dist/types/parts/chat-container-messages-list/useChatContainerMessageList.d.ts +7 -3
- package/dist/types/parts/chat-container-messages-list/useFocusAndScrollHelpers.d.ts +9 -6
- package/dist/types/parts/chat-container-messages-list/useGlobalEventListener.d.ts +1 -1
- package/dist/types/parts/chat-container-messages-list/useKeyboard.d.ts +7 -3
- package/dist/types/parts/chat-container-messages-list/useMessageFocusTracker.d.ts +52 -0
- package/dist/types/react-desc-prop-types.d.ts +800 -789
- package/package.json +17 -17
|
@@ -8,99 +8,162 @@ import { MessageDelimiter } from "@elliemae/ds-chat-message-delimeter";
|
|
|
8
8
|
import { SystemMessage } from "@elliemae/ds-chat-system-message";
|
|
9
9
|
import {
|
|
10
10
|
StyledWrapperListItem,
|
|
11
|
-
|
|
12
|
-
StyledChatContainerContentListScroll,
|
|
11
|
+
StyledFastList,
|
|
13
12
|
StyledWrapper,
|
|
14
13
|
StyledLoadMoreContainer,
|
|
15
|
-
ListItem,
|
|
16
14
|
StyledNewMessagesHiddenContainer
|
|
17
15
|
} from "./styled.js";
|
|
18
16
|
import { ChatContainerMessagesListPropTypes } from "../../react-desc-prop-types.js";
|
|
19
17
|
import { useGetNewMessages } from "./useGetNewMessages.js";
|
|
20
18
|
import { useChatContainerMessageList } from "./useChatContainerMessageList.js";
|
|
19
|
+
import { getMessageFocusId, getMessagePositionId } from "./useMessageFocusTracker.js";
|
|
21
20
|
import { ChatContainerDataTestIds } from "../../ChatContainerDataTestids.js";
|
|
21
|
+
const ESTIMATED_MESSAGE_HEIGHT = 80;
|
|
22
|
+
const estimateSize = () => ESTIMATED_MESSAGE_HEIGHT;
|
|
23
|
+
const WRAPPER_LIST_PROPS = { role: "none" };
|
|
24
|
+
const ItemRenderer = ({ index, extraItemProps }) => {
|
|
25
|
+
const { messages, sendingMessages, sendingText, focusRequest, focusCallbacks } = extraItemProps ?? {};
|
|
26
|
+
const row = messages?.[index];
|
|
27
|
+
const isFocusTarget = Boolean(
|
|
28
|
+
row && focusRequest && (focusRequest.messageId === getMessageFocusId(row, index) || focusRequest.messageId === getMessagePositionId(index))
|
|
29
|
+
);
|
|
30
|
+
const requestId = isFocusTarget && focusRequest ? focusRequest.requestId : 0;
|
|
31
|
+
const preventScroll = isFocusTarget && focusRequest ? focusRequest.preventScroll : false;
|
|
32
|
+
const focusRef = React2.useCallback(
|
|
33
|
+
(node) => {
|
|
34
|
+
if (!node || !isFocusTarget || !focusCallbacks) return;
|
|
35
|
+
const item = node.closest("[data-index]");
|
|
36
|
+
const takeFocus = focusCallbacks.mayTakeFocus(requestId, item);
|
|
37
|
+
if (!takeFocus) return;
|
|
38
|
+
item?.focus({ preventScroll: takeFocus === "restore" || preventScroll });
|
|
39
|
+
focusCallbacks.markFulfilled(requestId);
|
|
40
|
+
},
|
|
41
|
+
[isFocusTarget, requestId, preventScroll, focusCallbacks]
|
|
42
|
+
);
|
|
43
|
+
if (!row) return null;
|
|
44
|
+
const isSending = sendingMessages && sendingMessages.find((m) => m === row.dsId);
|
|
45
|
+
return /* @__PURE__ */ jsxs(StyledWrapperListItem, { type: row.type, innerRef: focusRef, children: [
|
|
46
|
+
row.type === BUBBLE_TYPES.SENDER || row.type === BUBBLE_TYPES.RECIPIENT ? /* @__PURE__ */ jsx(ChatBubble, { ...row, helpMessage: isSending ? sendingText : row.helpMessage }) : null,
|
|
47
|
+
row.type === BUBBLE_TYPES.DELIMITER ? /* @__PURE__ */ jsx(MessageDelimiter, { ...row }) : null,
|
|
48
|
+
row.type === BUBBLE_TYPES.SYSTEM ? /* @__PURE__ */ jsx(SystemMessage, { ...row }) : null
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
22
51
|
const ChatContainerMessagesList = (props) => {
|
|
23
52
|
const {
|
|
24
53
|
propsWithDefault,
|
|
25
54
|
globalAttributes,
|
|
26
|
-
|
|
55
|
+
fastListActionRef,
|
|
56
|
+
paddingStart,
|
|
57
|
+
paddingEnd,
|
|
27
58
|
handleKey,
|
|
28
59
|
handleListKey,
|
|
29
60
|
loadMoreRef,
|
|
30
|
-
virtualListRef
|
|
61
|
+
virtualListRef,
|
|
62
|
+
focusTracker
|
|
31
63
|
} = useChatContainerMessageList(props);
|
|
32
64
|
const { sendingText, sendingMessages, messages, getMoreMessages, hasMoreItems, isLoading } = propsWithDefault;
|
|
33
|
-
const { totalSize, virtualItems } = useVirtualHelpers;
|
|
34
65
|
const newMessages = useGetNewMessages(messages);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
innerRef: measureRef,
|
|
54
|
-
tabIndex: -1,
|
|
55
|
-
onKeyDown: handleKey,
|
|
56
|
-
role: "listitem",
|
|
57
|
-
children: /* @__PURE__ */ jsxs(StyledWrapperListItem, { type: row.type, children: [
|
|
58
|
-
row.type === BUBBLE_TYPES.SENDER || row.type === BUBBLE_TYPES.RECIPIENT ? /* @__PURE__ */ jsx(ChatBubble, { ...row, helpMessage: isSending ? sendingText : row.helpMessage }) : null,
|
|
59
|
-
row.type === BUBBLE_TYPES.DELIMITER ? /* @__PURE__ */ jsx(MessageDelimiter, { ...row }) : null,
|
|
60
|
-
row.type === BUBBLE_TYPES.SYSTEM ? /* @__PURE__ */ jsx(SystemMessage, { ...row }) : null
|
|
61
|
-
] })
|
|
62
|
-
},
|
|
63
|
-
`ds-chat-bubble-${index}-${row.dsId}-${row.type}`
|
|
64
|
-
);
|
|
65
|
-
}),
|
|
66
|
-
[virtualItems, messages, sendingMessages, handleKey, sendingText]
|
|
66
|
+
const getOwnerProps = React2.useCallback(() => propsWithDefault, [propsWithDefault]);
|
|
67
|
+
const getId = React2.useCallback(
|
|
68
|
+
(index) => `${index}-${messages[index].dsId}-${messages[index].type}`,
|
|
69
|
+
[messages]
|
|
70
|
+
);
|
|
71
|
+
const {
|
|
72
|
+
focusRequest,
|
|
73
|
+
mayTakeFocus,
|
|
74
|
+
markFulfilled,
|
|
75
|
+
trackFocusedMessage,
|
|
76
|
+
trackFocusResetter,
|
|
77
|
+
handleFocusOut,
|
|
78
|
+
listRootRef
|
|
79
|
+
} = focusTracker;
|
|
80
|
+
const focusCallbacks = React2.useMemo(() => ({ mayTakeFocus, markFulfilled }), [mayTakeFocus, markFulfilled]);
|
|
81
|
+
const extraItemProps = React2.useMemo(
|
|
82
|
+
() => ({ messages, sendingMessages, sendingText, focusRequest, focusCallbacks }),
|
|
83
|
+
[messages, sendingMessages, sendingText, focusRequest, focusCallbacks]
|
|
67
84
|
);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
85
|
+
const { onFocus: onFocusFromConsumer, onBlur: onBlurFromConsumer } = globalAttributes;
|
|
86
|
+
const handleFocusIn = React2.useCallback(
|
|
87
|
+
(e) => {
|
|
88
|
+
const item = e.target.closest('[data-element="chat-element-list-item"]');
|
|
89
|
+
const index = item?.dataset.index;
|
|
90
|
+
const position = Number(index);
|
|
91
|
+
const row = index !== void 0 ? messages[position] : void 0;
|
|
92
|
+
if (row) trackFocusedMessage(getMessageFocusId(row, position));
|
|
93
|
+
else trackFocusResetter();
|
|
94
|
+
onFocusFromConsumer?.(e);
|
|
95
|
+
},
|
|
96
|
+
[messages, trackFocusedMessage, trackFocusResetter, onFocusFromConsumer]
|
|
97
|
+
);
|
|
98
|
+
const handleFocusOutWithConsumer = React2.useCallback(
|
|
99
|
+
(e) => {
|
|
100
|
+
handleFocusOut(e);
|
|
101
|
+
onBlurFromConsumer?.(e);
|
|
102
|
+
},
|
|
103
|
+
[handleFocusOut, onBlurFromConsumer]
|
|
104
|
+
);
|
|
105
|
+
const itemProps = React2.useMemo(
|
|
106
|
+
() => ({ "data-element": "chat-element-list-item", tabIndex: -1, onKeyDown: handleKey }),
|
|
107
|
+
[handleKey]
|
|
108
|
+
);
|
|
109
|
+
const extraContent = React2.useMemo(
|
|
110
|
+
() => !isLoading && hasMoreItems ? /* @__PURE__ */ jsx(StyledLoadMoreContainer, { hasMoreItems, role: "listitem", children: /* @__PURE__ */ jsx(
|
|
111
|
+
DSButtonV2,
|
|
71
112
|
{
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
children: /* @__PURE__ */ jsxs(StyledChatContainerContentListScroll, { height: `${totalSize}px`, children: [
|
|
78
|
-
!isLoading && hasMoreItems ? /* @__PURE__ */ jsx(StyledLoadMoreContainer, { hasMoreItems, role: "listitem", children: /* @__PURE__ */ jsx(
|
|
79
|
-
DSButtonV2,
|
|
80
|
-
{
|
|
81
|
-
buttonType: "outline",
|
|
82
|
-
onClick: getMoreMessages,
|
|
83
|
-
"data-testid": ChatContainerDataTestIds.LOAD_MORE_BUTTON,
|
|
84
|
-
innerRef: loadMoreRef,
|
|
85
|
-
children: "Load More"
|
|
86
|
-
}
|
|
87
|
-
) }) : null,
|
|
88
|
-
render
|
|
89
|
-
] })
|
|
113
|
+
buttonType: "outline",
|
|
114
|
+
onClick: getMoreMessages,
|
|
115
|
+
"data-testid": ChatContainerDataTestIds.LOAD_MORE_BUTTON,
|
|
116
|
+
innerRef: loadMoreRef,
|
|
117
|
+
children: "Load More"
|
|
90
118
|
}
|
|
91
|
-
),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
119
|
+
) }) : null,
|
|
120
|
+
[isLoading, hasMoreItems, getMoreMessages, loadMoreRef]
|
|
121
|
+
);
|
|
122
|
+
return /* @__PURE__ */ jsxs(
|
|
123
|
+
StyledWrapper,
|
|
124
|
+
{
|
|
125
|
+
...globalAttributes,
|
|
126
|
+
innerRef: listRootRef,
|
|
127
|
+
onFocus: handleFocusIn,
|
|
128
|
+
onBlur: handleFocusOutWithConsumer,
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsx(
|
|
131
|
+
StyledFastList,
|
|
132
|
+
{
|
|
133
|
+
getOwnerProps,
|
|
134
|
+
"data-testid": ChatContainerDataTestIds.THREAD_CONTAINER,
|
|
135
|
+
role: "list",
|
|
136
|
+
tabIndex: 0,
|
|
137
|
+
onKeyDown: handleListKey,
|
|
138
|
+
innerRef: virtualListRef,
|
|
139
|
+
actionRef: fastListActionRef,
|
|
140
|
+
remountOnCountChange: false,
|
|
141
|
+
count: messages.length,
|
|
142
|
+
getId,
|
|
143
|
+
estimateSize,
|
|
144
|
+
paddingStart,
|
|
145
|
+
paddingEnd,
|
|
146
|
+
ItemRenderer,
|
|
147
|
+
extraItemProps,
|
|
148
|
+
extraContent,
|
|
149
|
+
dsFastlistWrapperList: WRAPPER_LIST_PROPS,
|
|
150
|
+
dsFastlistItem: itemProps
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx(StyledNewMessagesHiddenContainer, { "aria-live": "polite", "aria-hidden": "false", children: newMessages.map((newMessage) => /* @__PURE__ */ jsxs("p", { children: [
|
|
154
|
+
newMessage.title,
|
|
155
|
+
" ",
|
|
156
|
+
newMessage.time,
|
|
157
|
+
" ",
|
|
158
|
+
newMessage.body,
|
|
159
|
+
" ",
|
|
160
|
+
newMessage.errorMessage,
|
|
161
|
+
" ",
|
|
162
|
+
newMessage.helpMessage
|
|
163
|
+
] }, newMessage.dsId)) })
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
);
|
|
104
167
|
};
|
|
105
168
|
ChatContainerMessagesList.displayName = "ChatContainerMessagesList";
|
|
106
169
|
const ChatContainerMessagesListWithSchema = describe(ChatContainerMessagesList);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/chat-container-messages-list/ChatContainerMessagesList.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport type { CSSProperties, WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DSButtonV2, type DSButtonV2T } from '@elliemae/ds-button-v2';\nimport { ChatBubble, BUBBLE_TYPES } from '@elliemae/ds-chat-bubble';\nimport type { DSChatMessageDelimeterT } from '@elliemae/ds-chat-message-delimeter';\nimport { MessageDelimiter } from '@elliemae/ds-chat-message-delimeter';\nimport type { DSChatSystemMessageT } from '@elliemae/ds-chat-system-message';\nimport { SystemMessage } from '@elliemae/ds-chat-system-message';\nimport {\n StyledWrapperListItem,\n StyledChatContainerContentList,\n StyledChatContainerContentListScroll,\n StyledWrapper,\n StyledLoadMoreContainer,\n ListItem,\n StyledNewMessagesHiddenContainer,\n} from './styled.js';\nimport type { DSChatT } from '../../react-desc-prop-types.js';\nimport { ChatContainerMessagesListPropTypes } from '../../react-desc-prop-types.js';\nimport { useGetNewMessages } from './useGetNewMessages.js';\nimport { useChatContainerMessageList } from './useChatContainerMessageList.js';\nimport { ChatContainerDataTestIds } from '../../ChatContainerDataTestids.js';\n\ntype ButtonV2InnerRefT = DSButtonV2T.Props['innerRef'];\n\nconst ChatContainerMessagesList: React.ComponentType<DSChatT.MessagesListProps> = (props) => {\n const {\n propsWithDefault,\n globalAttributes,\n useVirtualHelpers,\n handleKey,\n handleListKey,\n loadMoreRef,\n virtualListRef,\n } = useChatContainerMessageList(props);\n\n const { sendingText, sendingMessages, messages, getMoreMessages, hasMoreItems, isLoading } = propsWithDefault;\n const { totalSize, virtualItems } = useVirtualHelpers;\n\n const newMessages = useGetNewMessages(messages);\n\n const render = React.useMemo(\n () =>\n virtualItems.map((virtualItem) => {\n const { index, measureRef, start } = virtualItem;\n const row = messages[index];\n const isSending = sendingMessages && sendingMessages.find((m) => m === row.dsId);\n const style: CSSProperties = {\n position: 'absolute',\n top: 0,\n left: 0,\n transform: `translateY(${start}px)`,\n width: '100%',\n };\n\n return (\n <ListItem\n data-element=\"chat-element-list-item\"\n data-index={index}\n key={`ds-chat-bubble-${index}-${row.dsId}-${row.type}`}\n style={style}\n innerRef={measureRef}\n tabIndex={-1}\n onKeyDown={handleKey}\n role=\"listitem\"\n >\n <StyledWrapperListItem type={row.type}>\n {row.type === BUBBLE_TYPES.SENDER || row.type === BUBBLE_TYPES.RECIPIENT ? (\n <ChatBubble {...row} helpMessage={isSending ? sendingText : row.helpMessage} />\n ) : null}\n {row.type === BUBBLE_TYPES.DELIMITER ? (\n <MessageDelimiter {...(row as unknown as DSChatMessageDelimeterT.Props)} />\n ) : null}\n {row.type === BUBBLE_TYPES.SYSTEM ? <SystemMessage {...(row as DSChatSystemMessageT.Props)} /> : null}\n </StyledWrapperListItem>\n </ListItem>\n );\n }),\n [virtualItems, messages, sendingMessages, handleKey, sendingText],\n );\n\n return (\n <StyledWrapper {...globalAttributes}>\n <StyledChatContainerContentList\n data-testid={ChatContainerDataTestIds.THREAD_CONTAINER}\n tabIndex={0}\n innerRef={virtualListRef as React.RefObject<HTMLDivElement>}\n role=\"list\"\n onKeyDown={handleListKey}\n >\n <StyledChatContainerContentListScroll height={`${totalSize}px`}>\n {!isLoading && hasMoreItems ? (\n <StyledLoadMoreContainer hasMoreItems={hasMoreItems} role=\"listitem\">\n <DSButtonV2\n buttonType=\"outline\"\n onClick={getMoreMessages}\n data-testid={ChatContainerDataTestIds.LOAD_MORE_BUTTON}\n innerRef={loadMoreRef as ButtonV2InnerRefT}\n >\n Load More\n </DSButtonV2>\n </StyledLoadMoreContainer>\n ) : null}\n {render}\n </StyledChatContainerContentListScroll>\n </StyledChatContainerContentList>\n {/* We repeat the render with the new available messages */}\n <StyledNewMessagesHiddenContainer aria-live=\"polite\" aria-hidden=\"false\">\n {newMessages.map((newMessage) => (\n <p key={newMessage.dsId}>\n {newMessage.title} {newMessage.time} {newMessage.body} {newMessage.errorMessage} {newMessage.helpMessage}\n </p>\n ))}\n </StyledNewMessagesHiddenContainer>\n </StyledWrapper>\n );\n};\n\nChatContainerMessagesList.displayName = 'ChatContainerMessagesList';\nconst ChatContainerMessagesListWithSchema = describe(ChatContainerMessagesList);\nChatContainerMessagesListWithSchema.propTypes = ChatContainerMessagesListPropTypes as WeakValidationMap<unknown>;\n\nexport { ChatContainerMessagesList, ChatContainerMessagesListWithSchema };\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DSButtonV2, type DSButtonV2T } from '@elliemae/ds-button-v2';\nimport { ChatBubble, BUBBLE_TYPES } from '@elliemae/ds-chat-bubble';\nimport type { DSChatMessageDelimeterT } from '@elliemae/ds-chat-message-delimeter';\nimport { MessageDelimiter } from '@elliemae/ds-chat-message-delimeter';\nimport type { DSChatSystemMessageT } from '@elliemae/ds-chat-system-message';\nimport { SystemMessage } from '@elliemae/ds-chat-system-message';\nimport {\n StyledWrapperListItem,\n StyledFastList,\n StyledWrapper,\n StyledLoadMoreContainer,\n StyledNewMessagesHiddenContainer,\n} from './styled.js';\nimport type { DSChatT } from '../../react-desc-prop-types.js';\nimport { ChatContainerMessagesListPropTypes } from '../../react-desc-prop-types.js';\nimport { useGetNewMessages } from './useGetNewMessages.js';\nimport { useChatContainerMessageList } from './useChatContainerMessageList.js';\nimport { getMessageFocusId, getMessagePositionId } from './useMessageFocusTracker.js';\nimport type { MessageFocusRequest, useMessageFocusTracker } from './useMessageFocusTracker.js';\nimport { ChatContainerDataTestIds } from '../../ChatContainerDataTestids.js';\n\ntype ButtonV2InnerRefT = DSButtonV2T.Props['innerRef'];\n\ntype FocusTracker = ReturnType<typeof useMessageFocusTracker>;\ntype ItemFocusCallbacks = Pick<FocusTracker, 'mayTakeFocus' | 'markFulfilled'>;\n\ntype ItemExtraProps = {\n messages: DSChatT.MessagesListProps['messages'];\n sendingMessages: DSChatT.MessagesListProps['sendingMessages'];\n sendingText: DSChatT.MessagesListProps['sendingText'];\n focusRequest: MessageFocusRequest | null;\n focusCallbacks: ItemFocusCallbacks;\n};\n\nconst ESTIMATED_MESSAGE_HEIGHT = 80;\nconst estimateSize = () => ESTIMATED_MESSAGE_HEIGHT;\n// the wrapper `ds-fast-list` renders is neutral: the scroll container owns the `list` role\nconst WRAPPER_LIST_PROPS = { role: 'none' };\n\n/**\n * Module-level on purpose: `DSFastList` renders it as a component, so its identity must be stable or\n * every item would remount on each render of the list.\n */\nconst ItemRenderer: React.ComponentType<{ index: number; extraItemProps?: object }> = ({ index, extraItemProps }) => {\n // `styled(DSFastList)` drops DSFastList's generic, so `extraItemProps` arrives typed as `object`\n const { messages, sendingMessages, sendingText, focusRequest, focusCallbacks } = (extraItemProps ??\n {}) as Partial<ItemExtraProps>;\n const row = messages?.[index];\n const isFocusTarget = Boolean(\n row &&\n focusRequest &&\n (focusRequest.messageId === getMessageFocusId(row, index) ||\n focusRequest.messageId === getMessagePositionId(index)),\n );\n const requestId = isFocusTarget && focusRequest ? focusRequest.requestId : 0;\n const preventScroll = isFocusTarget && focusRequest ? focusRequest.preventScroll : false;\n /**\n * The only place a message is focused. It runs once React has committed the message, so a target that is\n * not mounted yet (far away, or remounted after older messages were loaded) is focused when it mounts. The\n * focusable element is the item wrapper `ds-fast-list` renders around this component, the one carrying\n * `data-index` and QA's `data-element`, so it is reached with `closest` from this message's own node.\n */\n const focusRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n if (!node || !isFocusTarget || !focusCallbacks) return;\n const item = node.closest<HTMLElement>('[data-index]');\n const takeFocus = focusCallbacks.mayTakeFocus(requestId, item);\n if (!takeFocus) return;\n item?.focus({ preventScroll: takeFocus === 'restore' || preventScroll });\n focusCallbacks.markFulfilled(requestId);\n },\n [isFocusTarget, requestId, preventScroll, focusCallbacks],\n );\n if (!row) return null;\n const isSending = sendingMessages && sendingMessages.find((m) => m === row.dsId);\n return (\n <StyledWrapperListItem type={row.type} innerRef={focusRef}>\n {row.type === BUBBLE_TYPES.SENDER || row.type === BUBBLE_TYPES.RECIPIENT ? (\n <ChatBubble {...row} helpMessage={isSending ? sendingText : row.helpMessage} />\n ) : null}\n {row.type === BUBBLE_TYPES.DELIMITER ? (\n <MessageDelimiter {...(row as unknown as DSChatMessageDelimeterT.Props)} />\n ) : null}\n {row.type === BUBBLE_TYPES.SYSTEM ? <SystemMessage {...(row as DSChatSystemMessageT.Props)} /> : null}\n </StyledWrapperListItem>\n );\n};\n\nconst ChatContainerMessagesList: React.ComponentType<DSChatT.MessagesListProps> = (props) => {\n const {\n propsWithDefault,\n globalAttributes,\n fastListActionRef,\n paddingStart,\n paddingEnd,\n handleKey,\n handleListKey,\n loadMoreRef,\n virtualListRef,\n focusTracker,\n } = useChatContainerMessageList(props);\n\n const { sendingText, sendingMessages, messages, getMoreMessages, hasMoreItems, isLoading } = propsWithDefault;\n\n const newMessages = useGetNewMessages(messages);\n\n const getOwnerProps = React.useCallback(() => propsWithDefault, [propsWithDefault]);\n /**\n * The key must carry the index. `ds-fast-list` reuses an item's DOM node for as long as its key is the same,\n * but the virtualizer measures each node by its `data-index` and does not measure a node again when only its\n * index changes. With a key made only of `dsId`, loading older messages (which shifts every index) keeps the\n * nodes and leaves their measurements pointing at another position: items overlap or leave gaps, and the list\n * flickers while scrolling. An index-bearing key recreates the shifted items so they are measured at their\n * new index, as the list did before it was moved onto `ds-fast-list`.\n */\n const getId = React.useCallback(\n (index: number) => `${index}-${messages[index].dsId}-${messages[index].type}`,\n [messages],\n );\n const {\n focusRequest,\n mayTakeFocus,\n markFulfilled,\n trackFocusedMessage,\n trackFocusResetter,\n handleFocusOut,\n listRootRef,\n } = focusTracker;\n const focusCallbacks = React.useMemo(() => ({ mayTakeFocus, markFulfilled }), [mayTakeFocus, markFulfilled]);\n const extraItemProps = React.useMemo(\n () => ({ messages, sendingMessages, sendingText, focusRequest, focusCallbacks }),\n [messages, sendingMessages, sendingText, focusRequest, focusCallbacks],\n );\n const { onFocus: onFocusFromConsumer, onBlur: onBlurFromConsumer } = globalAttributes as {\n onFocus?: React.FocusEventHandler<HTMLElement>;\n onBlur?: React.FocusEventHandler<HTMLElement>;\n };\n /**\n * Keeps the focus intent equal to the message that actually got the focus (keyboard, mouse or API), also when\n * the focus is on a descendant of the message, and clears it when the focus moves to anything else in the list.\n */\n const handleFocusIn = React.useCallback(\n (e: React.FocusEvent<HTMLElement>) => {\n const item = (e.target as HTMLElement).closest<HTMLElement>('[data-element=\"chat-element-list-item\"]');\n const index = item?.dataset.index;\n const position = Number(index);\n const row = index !== undefined ? messages[position] : undefined;\n if (row) trackFocusedMessage(getMessageFocusId(row, position));\n else trackFocusResetter();\n onFocusFromConsumer?.(e);\n },\n [messages, trackFocusedMessage, trackFocusResetter, onFocusFromConsumer],\n );\n const handleFocusOutWithConsumer = React.useCallback(\n (e: React.FocusEvent<HTMLElement>) => {\n handleFocusOut(e);\n onBlurFromConsumer?.(e);\n },\n [handleFocusOut, onBlurFromConsumer],\n );\n const itemProps = React.useMemo(\n () => ({ 'data-element': 'chat-element-list-item', tabIndex: -1, onKeyDown: handleKey }),\n [handleKey],\n );\n const extraContent = React.useMemo(\n () =>\n !isLoading && hasMoreItems ? (\n <StyledLoadMoreContainer hasMoreItems={hasMoreItems} role=\"listitem\">\n <DSButtonV2\n buttonType=\"outline\"\n onClick={getMoreMessages}\n data-testid={ChatContainerDataTestIds.LOAD_MORE_BUTTON}\n innerRef={loadMoreRef as ButtonV2InnerRefT}\n >\n Load More\n </DSButtonV2>\n </StyledLoadMoreContainer>\n ) : null,\n [isLoading, hasMoreItems, getMoreMessages, loadMoreRef],\n );\n\n return (\n <StyledWrapper\n {...globalAttributes}\n innerRef={listRootRef}\n onFocus={handleFocusIn}\n onBlur={handleFocusOutWithConsumer}\n >\n <StyledFastList\n getOwnerProps={getOwnerProps}\n data-testid={ChatContainerDataTestIds.THREAD_CONTAINER}\n role=\"list\"\n tabIndex={0}\n onKeyDown={handleListKey}\n innerRef={virtualListRef}\n actionRef={fastListActionRef}\n remountOnCountChange={false}\n count={messages.length}\n getId={getId}\n estimateSize={estimateSize}\n paddingStart={paddingStart}\n paddingEnd={paddingEnd}\n ItemRenderer={ItemRenderer}\n extraItemProps={extraItemProps}\n extraContent={extraContent}\n dsFastlistWrapperList={WRAPPER_LIST_PROPS}\n dsFastlistItem={itemProps}\n />\n {/* We repeat the render with the new available messages */}\n <StyledNewMessagesHiddenContainer aria-live=\"polite\" aria-hidden=\"false\">\n {newMessages.map((newMessage) => (\n <p key={newMessage.dsId}>\n {newMessage.title} {newMessage.time} {newMessage.body} {newMessage.errorMessage} {newMessage.helpMessage}\n </p>\n ))}\n </StyledNewMessagesHiddenContainer>\n </StyledWrapper>\n );\n};\n\nChatContainerMessagesList.displayName = 'ChatContainerMessagesList';\nconst ChatContainerMessagesListWithSchema = describe(ChatContainerMessagesList);\nChatContainerMessagesListWithSchema.propTypes = ChatContainerMessagesListPropTypes as WeakValidationMap<unknown>;\n\nexport { ChatContainerMessagesList, ChatContainerMessagesListWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACkFnB,SAEI,KAFJ;AA9EJ,OAAOA,YAAW;AAClB,SAAS,gBAAgB;AACzB,SAAS,kBAAoC;AAC7C,SAAS,YAAY,oBAAoB;AAEzC,SAAS,wBAAwB;AAEjC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,0CAA0C;AACnD,SAAS,yBAAyB;AAClC,SAAS,mCAAmC;AAC5C,SAAS,mBAAmB,4BAA4B;AAExD,SAAS,gCAAgC;AAezC,MAAM,2BAA2B;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AAW;AAAA,UAAa;AAAA,UAAE,WAAW;AAAA,aADvF,WAAW,IAEnB,CACD,GACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,0BAA0B,cAAc;AACxC,MAAM,sCAAsC,SAAS,yBAAyB;AAC9E,oCAAoC,YAAY;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { styled } from "@elliemae/ds-system";
|
|
3
|
+
import { DSFastList } from "@elliemae/ds-fast-list";
|
|
3
4
|
import { BUBBLE_TYPES } from "@elliemae/ds-chat-bubble";
|
|
5
|
+
import { DSChatContainerSlotName, DSChatContainerSlots } from "../../DSChatContainerDefinitions.js";
|
|
4
6
|
const StyledWrapper = styled.div`
|
|
5
7
|
width: 100%;
|
|
6
8
|
height: 100%;
|
|
@@ -15,13 +17,36 @@ const StyledWrapperListItem = styled.div`
|
|
|
15
17
|
${(props) => props.type === BUBBLE_TYPES.SYSTEM && `padding: ${props.theme.space.xxs} 0px
|
|
16
18
|
`};
|
|
17
19
|
`;
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const StyledFastList = styled(DSFastList, {
|
|
21
|
+
name: DSChatContainerSlotName,
|
|
22
|
+
slot: DSChatContainerSlots.MESSAGES_LIST_SCROLL_AREA
|
|
23
|
+
})`
|
|
24
|
+
&& {
|
|
25
|
+
padding: 0 ${(props) => props.theme.space.xs} 0 ${(props) => props.theme.space.xs};
|
|
26
|
+
overflow-y: auto;
|
|
27
|
+
overflow-x: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[data-element='chat-element-list-item'] {
|
|
31
|
+
&:focus,
|
|
32
|
+
&:focus-visible {
|
|
33
|
+
outline: none;
|
|
34
|
+
&:after {
|
|
35
|
+
content: '';
|
|
36
|
+
display: block;
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 0;
|
|
39
|
+
left: -${(props) => props.theme.space.xxs};
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
border-radius: 2px;
|
|
42
|
+
background-color: #ebedf0;
|
|
43
|
+
width: calc(100% + 24px);
|
|
44
|
+
border: 2px solid #1e79c2;
|
|
45
|
+
height: 100%;
|
|
46
|
+
z-index: -1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
25
50
|
`;
|
|
26
51
|
const StyledNewMessagesHiddenContainer = styled.div`
|
|
27
52
|
position: absolute;
|
|
@@ -35,11 +60,6 @@ const StyledNewMessagesHiddenContainer = styled.div`
|
|
|
35
60
|
clip-path: inset(100%);
|
|
36
61
|
white-space: nowrap;
|
|
37
62
|
`;
|
|
38
|
-
const StyledChatContainerContentListScroll = styled.div`
|
|
39
|
-
width: 100%;
|
|
40
|
-
height: ${(props) => props.height};
|
|
41
|
-
position: relative;
|
|
42
|
-
`;
|
|
43
63
|
const StyledLoadMoreContainer = styled.div`
|
|
44
64
|
position: absolute;
|
|
45
65
|
width: calc(100% + ${(props) => props.theme.space.xxs});
|
|
@@ -52,30 +72,8 @@ const StyledLoadMoreContainer = styled.div`
|
|
|
52
72
|
${(props) => props.hasMoreItems === "top" ? "top: 0;" : ""}
|
|
53
73
|
${(props) => props.hasMoreItems === "bottom" ? "bottom: 0;" : ""}
|
|
54
74
|
`;
|
|
55
|
-
const ListItem = styled.div`
|
|
56
|
-
&:focus,
|
|
57
|
-
&:focus-visible {
|
|
58
|
-
outline: none;
|
|
59
|
-
&:after {
|
|
60
|
-
content: '';
|
|
61
|
-
display: block;
|
|
62
|
-
position: absolute;
|
|
63
|
-
top: 0;
|
|
64
|
-
left: -${(props) => props.theme.space.xxs};
|
|
65
|
-
pointer-events: none;
|
|
66
|
-
border-radius: 2px;
|
|
67
|
-
background-color: #ebedf0;
|
|
68
|
-
width: calc(100% + 24px);
|
|
69
|
-
border: 2px solid #1e79c2;
|
|
70
|
-
height: 100%;
|
|
71
|
-
z-index: -1;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
75
75
|
export {
|
|
76
|
-
|
|
77
|
-
StyledChatContainerContentList,
|
|
78
|
-
StyledChatContainerContentListScroll,
|
|
76
|
+
StyledFastList,
|
|
79
77
|
StyledLoadMoreContainer,
|
|
80
78
|
StyledNewMessagesHiddenContainer,
|
|
81
79
|
StyledWrapper,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/chat-container-messages-list/styled.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport type { DSChatBubbleT } from '@elliemae/ds-chat-bubble';\nimport { BUBBLE_TYPES } from '@elliemae/ds-chat-bubble';\n\nexport const StyledWrapper = styled.div`\n width: 100%;\n height: 100%;\n`;\n\n// list\nexport const StyledWrapperListItem = styled.div<Partial<DSChatBubbleT.Props>>`\n min-width: 100%;\n ${(props) =>\n props.type === BUBBLE_TYPES.SENDER &&\n `padding: ${props.theme.space.xxs} ${props.theme.space.xxs} ${props.theme.space.xxs} 13%\n `};\n ${(props) =>\n props.type === BUBBLE_TYPES.RECIPIENT &&\n `padding: ${props.theme.space.xxs} 13% ${props.theme.space.xxs}\n ${props.theme.space.xxs}\n `};\n ${(props) =>\n props.type === BUBBLE_TYPES.SYSTEM &&\n `padding: ${props.theme.space.xxs} 0px\n `};\n`;\n\nexport const
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport type { DSChatBubbleT } from '@elliemae/ds-chat-bubble';\nimport { BUBBLE_TYPES } from '@elliemae/ds-chat-bubble';\nimport { DSChatContainerSlotName, DSChatContainerSlots } from '../../DSChatContainerDefinitions.js';\n\nexport const StyledWrapper = styled.div`\n width: 100%;\n height: 100%;\n`;\n\n// list\nexport const StyledWrapperListItem = styled.div<Partial<DSChatBubbleT.Props>>`\n min-width: 100%;\n ${(props) =>\n props.type === BUBBLE_TYPES.SENDER &&\n `padding: ${props.theme.space.xxs} ${props.theme.space.xxs} ${props.theme.space.xxs} 13%\n `};\n ${(props) =>\n props.type === BUBBLE_TYPES.RECIPIENT &&\n `padding: ${props.theme.space.xxs} 13% ${props.theme.space.xxs}\n ${props.theme.space.xxs}\n `};\n ${(props) =>\n props.type === BUBBLE_TYPES.SYSTEM &&\n `padding: ${props.theme.space.xxs} 0px\n `};\n`;\n\n/**\n * The scroll container is DSFastList's own container, so its horizontal padding and overflow rules are\n * applied through the class that `styled(DSFastList)` forwards to it. `&&` doubles the class so these\n * rules win over the container's own `overflow: auto` regardless of style injection order.\n *\n * No padding-top here on purpose: the scroll container is also the virtualizer's scroll element, and\n * the virtualizer compares the raw `scrollTop` with its own content-relative item positions with no\n * awareness of CSS padding, so a CSS top-padding would desync `getVisibleItems()` near the top boundary\n * by roughly the padding's own size. The equivalent top space is passed as the virtualizer's\n * `paddingStart` instead (see useChatContainerMessageList.ts).\n */\nexport const StyledFastList = styled(DSFastList, {\n name: DSChatContainerSlotName,\n slot: DSChatContainerSlots.MESSAGES_LIST_SCROLL_AREA,\n})`\n && {\n padding: 0 ${(props) => props.theme.space.xs} 0 ${(props) => props.theme.space.xs};\n overflow-y: auto;\n overflow-x: hidden;\n }\n\n [data-element='chat-element-list-item'] {\n &:focus,\n &:focus-visible {\n outline: none;\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: -${(props) => props.theme.space.xxs};\n pointer-events: none;\n border-radius: 2px;\n background-color: #ebedf0;\n width: calc(100% + 24px);\n border: 2px solid #1e79c2;\n height: 100%;\n z-index: -1;\n }\n }\n }\n`;\n\nexport const StyledNewMessagesHiddenContainer = styled.div`\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n border: 0;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(100%);\n white-space: nowrap;\n`;\n\nexport const StyledLoadMoreContainer = styled.div<{ hasMoreItems?: 'top' | 'bottom' }>`\n position: absolute;\n width: calc(100% + ${(props) => props.theme.space.xxs});\n padding: ${(props) => props.theme.space.xxs};\n left: -${(props) => props.theme.space.xxs};\n right: -${(props) => props.theme.space.xxs};\n display: grid;\n justify-content: center;\n align-items: center;\n ${(props) => (props.hasMoreItems === 'top' ? 'top: 0;' : '')}\n ${(props) => (props.hasMoreItems === 'bottom' ? 'bottom: 0;' : '')}\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB,4BAA4B;AAEvD,MAAM,gBAAgB,OAAO;AAAA;AAAA;AAAA;AAM7B,MAAM,wBAAwB,OAAO;AAAA;AAAA,IAExC,CAAC,UACD,MAAM,SAAS,aAAa,UAC5B,YAAY,MAAM,MAAM,MAAM,GAAG,IAAI,MAAM,MAAM,MAAM,GAAG,IAAI,MAAM,MAAM,MAAM,GAAG;AAAA,GACpF;AAAA,IACC,CAAC,UACD,MAAM,SAAS,aAAa,aAC5B,YAAY,MAAM,MAAM,MAAM,GAAG,QAAQ,MAAM,MAAM,MAAM,GAAG;AAAA,MAC5D,MAAM,MAAM,MAAM,GAAG;AAAA,GACxB;AAAA,IACC,CAAC,UACD,MAAM,SAAS,aAAa,UAC5B,YAAY,MAAM,MAAM,MAAM,GAAG;AAAA,GAClC;AAAA;AAcI,MAAM,iBAAiB,OAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,qBAAqB;AAC7B,CAAC;AAAA;AAAA,iBAEgB,CAAC,UAAU,MAAM,MAAM,MAAM,EAAE,MAAM,CAAC,UAAU,MAAM,MAAM,MAAM,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAcpE,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAa1C,MAAM,mCAAmC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAahD,MAAM,0BAA0B,OAAO;AAAA;AAAA,uBAEvB,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG;AAAA,aAC1C,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG;AAAA,WAClC,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG;AAAA,YAC/B,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA,IAIxC,CAAC,UAAW,MAAM,iBAAiB,QAAQ,YAAY,EAAG;AAAA,IAC1D,CAAC,UAAW,MAAM,iBAAiB,WAAW,eAAe,EAAG;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,9 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import React2 from "react";
|
|
3
3
|
const useActionRef = ({
|
|
4
4
|
actionRef,
|
|
5
|
-
|
|
5
|
+
vScroll,
|
|
6
6
|
virtualListRef,
|
|
7
|
-
updateCache,
|
|
8
7
|
getMessagesInView,
|
|
9
8
|
onlyFocus,
|
|
10
9
|
scrollAndFocus
|
|
@@ -16,7 +15,6 @@ const useActionRef = ({
|
|
|
16
15
|
vScroll(index, opts);
|
|
17
16
|
requestAnimationFrame(() => {
|
|
18
17
|
vScroll(index, opts);
|
|
19
|
-
updateCache();
|
|
20
18
|
});
|
|
21
19
|
}, 0);
|
|
22
20
|
};
|
|
@@ -28,12 +26,11 @@ const useActionRef = ({
|
|
|
28
26
|
};
|
|
29
27
|
actionRef.current.scrollToIndex = scrollToIndex;
|
|
30
28
|
actionRef.current.getMessagesInView = getMessagesInView;
|
|
31
|
-
updateCache();
|
|
32
29
|
actionRef.current.focusToIndex = focusToIndex;
|
|
33
30
|
actionRef.current.focusToIndexWithoutScroll = onlyFocus;
|
|
34
31
|
actionRef.current.focusToList = focusToList;
|
|
35
32
|
}
|
|
36
|
-
}, [actionRef,
|
|
33
|
+
}, [actionRef, getMessagesInView, onlyFocus, scrollAndFocus, vScroll, virtualListRef]);
|
|
37
34
|
};
|
|
38
35
|
export {
|
|
39
36
|
useActionRef
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/chat-container-messages-list/useActionRef.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACGvB,OAAOA,YAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport type { DSChatT } from '../../react-desc-prop-types.js';\n\ntype UseActionRefArgs = {\n actionRef: DSChatT.ActionRef;\n vScroll: (index: number, opts?: DSChatT.ScrollActionOptions) => void;\n virtualListRef: React.MutableRefObject<HTMLDivElement | null>;\n getMessagesInView: () => string[];\n onlyFocus: (index: string) => void;\n scrollAndFocus: (index: number, opts?: DSChatT.ScrollActionOptions) => void;\n};\n\nexport const useActionRef = ({\n actionRef,\n vScroll,\n virtualListRef,\n getMessagesInView,\n onlyFocus,\n scrollAndFocus,\n}: UseActionRefArgs) => {\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n const scrollToIndex: DSChatT.ActionRef['current']['scrollToIndex'] = (index, opts = { align: 'center' }) => {\n setTimeout(() => {\n vScroll(index, opts);\n /* [PUI-15629](https://jira.elliemae.io/browse/PUI-15629)\n * requestAnimationFrame is needed because the first scroll might not calculate positions\n * correctly if the DOM hasn't been fully updated yet. By waiting for the next animation\n * frame, we ensure that:\n * 1. The DOM has been updated with new positions after the first scroll\n * 2. Element height and position measurements are accurate\n * 3. The second scroll can align the element with correct measurements\n */\n requestAnimationFrame(() => {\n vScroll(index, opts);\n });\n }, 0);\n };\n const focusToIndex: DSChatT.ActionRef['current']['focusToIndex'] = (index, opts = { align: 'center' }) => {\n scrollAndFocus(index, opts);\n };\n const focusToList = () => {\n virtualListRef.current?.focus();\n };\n\n actionRef.current.scrollToIndex = scrollToIndex;\n actionRef.current.getMessagesInView = getMessagesInView;\n actionRef.current.focusToIndex = focusToIndex;\n actionRef.current.focusToIndexWithoutScroll = onlyFocus;\n actionRef.current.focusToList = focusToList;\n }\n }, [actionRef, getMessagesInView, onlyFocus, scrollAndFocus, vScroll, virtualListRef]);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB,OAAOA,YAAW;AAYX,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAwB;AACtB,EAAAA,OAAM,UAAU,MAAM;AACpB,QAAI,aAAa,UAAU,SAAS;AAClC,YAAM,gBAA+D,CAAC,OAAO,OAAO,EAAE,OAAO,SAAS,MAAM;AAC1G,mBAAW,MAAM;AACf,kBAAQ,OAAO,IAAI;AASnB,gCAAsB,MAAM;AAC1B,oBAAQ,OAAO,IAAI;AAAA,UACrB,CAAC;AAAA,QACH,GAAG,CAAC;AAAA,MACN;AACA,YAAM,eAA6D,CAAC,OAAO,OAAO,EAAE,OAAO,SAAS,MAAM;AACxG,uBAAe,OAAO,IAAI;AAAA,MAC5B;AACA,YAAM,cAAc,MAAM;AACxB,uBAAe,SAAS,MAAM;AAAA,MAChC;AAEA,gBAAU,QAAQ,gBAAgB;AAClC,gBAAU,QAAQ,oBAAoB;AACtC,gBAAU,QAAQ,eAAe;AACjC,gBAAU,QAAQ,4BAA4B;AAC9C,gBAAU,QAAQ,cAAc;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,WAAW,mBAAmB,WAAW,gBAAgB,SAAS,cAAc,CAAC;AACvF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import React2 from "react";
|
|
3
|
+
import { useTheme } from "styled-components";
|
|
3
4
|
import {
|
|
4
5
|
useMemoMergePropsWithDefault,
|
|
5
6
|
useGetGlobalAttributes,
|
|
6
7
|
useValidateTypescriptPropTypes
|
|
7
8
|
} from "@elliemae/ds-props-helpers";
|
|
8
|
-
import { useVirtual } from "react-virtual";
|
|
9
9
|
import { useActionRef } from "./useActionRef.js";
|
|
10
10
|
import { useGlobalEventListener } from "./useGlobalEventListener.js";
|
|
11
11
|
import { useKeyboard } from "./useKeyboard.js";
|
|
12
12
|
import { useFocusAndScrollHelpers } from "./useFocusAndScrollHelpers.js";
|
|
13
|
+
import { useMessageFocusTracker } from "./useMessageFocusTracker.js";
|
|
13
14
|
import { ChatContainerMessagesListPropTypes, defaultPropsMessagesList } from "../../react-desc-prop-types.js";
|
|
14
15
|
import { DSChatContainerMessagesList } from "../../DSChatContainerDefinitions.js";
|
|
15
16
|
const getPadding = ({ hasMoreItems, bannerPosition, isLoading }) => {
|
|
@@ -30,29 +31,27 @@ const useChatContainerMessageList = (props) => {
|
|
|
30
31
|
);
|
|
31
32
|
const globalAttributes = useGetGlobalAttributes(propsWithDefault);
|
|
32
33
|
const loadMoreRef = React2.useRef();
|
|
33
|
-
const virtualListRef = React2.useRef();
|
|
34
|
+
const virtualListRef = React2.useRef(null);
|
|
35
|
+
const fastListActionRef = React2.useRef({});
|
|
34
36
|
const pendingOnScroll = React2.useRef(false);
|
|
35
|
-
const { bannerPosition,
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
const { onScrollStop, updateCache, getMessagesInView, onlyFocus, scrollAndFocus, checkPendingOnScroll } = useFocusAndScrollHelpers({
|
|
37
|
+
const { bannerPosition, actionRef, hasMoreItems, isLoading } = propsWithDefault;
|
|
38
|
+
const theme = useTheme();
|
|
39
|
+
const containerPaddingStart = parseInt(theme.space.xs, 10);
|
|
40
|
+
const padding = getPadding({ hasMoreItems, bannerPosition, isLoading });
|
|
41
|
+
const paddingStart = padding.paddingStart + containerPaddingStart;
|
|
42
|
+
const { paddingEnd } = padding;
|
|
43
|
+
const focusTracker = useMessageFocusTracker(virtualListRef);
|
|
44
|
+
const { trackFocusMessage } = focusTracker;
|
|
45
|
+
const { vScroll, onScrollStop, getMessagesInView, onlyFocus, scrollAndFocus, checkPendingOnScroll } = useFocusAndScrollHelpers({
|
|
46
46
|
propsWithDefault,
|
|
47
|
-
|
|
47
|
+
fastListActionRef,
|
|
48
48
|
pendingOnScroll,
|
|
49
|
-
|
|
49
|
+
trackFocusMessage
|
|
50
50
|
});
|
|
51
51
|
useActionRef({
|
|
52
52
|
actionRef,
|
|
53
|
-
|
|
53
|
+
vScroll,
|
|
54
54
|
virtualListRef,
|
|
55
|
-
updateCache,
|
|
56
55
|
getMessagesInView,
|
|
57
56
|
onlyFocus,
|
|
58
57
|
scrollAndFocus
|
|
@@ -70,18 +69,32 @@ const useChatContainerMessageList = (props) => {
|
|
|
70
69
|
loadMoreRef,
|
|
71
70
|
scrollAndFocus,
|
|
72
71
|
onlyFocus,
|
|
73
|
-
getMessagesInView
|
|
72
|
+
getMessagesInView,
|
|
73
|
+
trackFocusMessage
|
|
74
74
|
});
|
|
75
75
|
return React2.useMemo(
|
|
76
76
|
() => ({
|
|
77
77
|
propsWithDefault,
|
|
78
78
|
globalAttributes,
|
|
79
|
-
|
|
79
|
+
fastListActionRef,
|
|
80
|
+
paddingStart,
|
|
81
|
+
paddingEnd,
|
|
80
82
|
loadMoreRef,
|
|
81
83
|
virtualListRef,
|
|
84
|
+
focusTracker,
|
|
82
85
|
...keyboardMethods
|
|
83
86
|
}),
|
|
84
|
-
[
|
|
87
|
+
[
|
|
88
|
+
globalAttributes,
|
|
89
|
+
keyboardMethods,
|
|
90
|
+
propsWithDefault,
|
|
91
|
+
fastListActionRef,
|
|
92
|
+
paddingStart,
|
|
93
|
+
paddingEnd,
|
|
94
|
+
loadMoreRef,
|
|
95
|
+
virtualListRef,
|
|
96
|
+
focusTracker
|
|
97
|
+
]
|
|
85
98
|
);
|
|
86
99
|
};
|
|
87
100
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/chat-container-messages-list/useChatContainerMessageList.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport {\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useValidateTypescriptPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACGvB,OAAOA,YAAW;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport { useTheme } from 'styled-components';\nimport {\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useValidateTypescriptPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { DSFastListT } from '@elliemae/ds-fast-list';\nimport { useActionRef } from './useActionRef.js';\nimport { useGlobalEventListener } from './useGlobalEventListener.js';\nimport { useKeyboard } from './useKeyboard.js';\nimport { useFocusAndScrollHelpers } from './useFocusAndScrollHelpers.js';\nimport { useMessageFocusTracker } from './useMessageFocusTracker.js';\nimport type { DSChatT } from '../../react-desc-prop-types.js';\nimport { ChatContainerMessagesListPropTypes, defaultPropsMessagesList } from '../../react-desc-prop-types.js';\nimport { DSChatContainerMessagesList } from '../../DSChatContainerDefinitions.js';\n\nconst getPadding = ({ hasMoreItems, bannerPosition, isLoading }: DSChatT.GetPaddingT) => {\n const padding = {\n paddingStart: 0,\n paddingEnd: -5,\n };\n if ([hasMoreItems, bannerPosition, isLoading].some((item) => item === 'top')) padding.paddingStart = 42;\n else if ([hasMoreItems, bannerPosition, isLoading].some((item) => item === 'bottom')) padding.paddingEnd = 42;\n return padding;\n};\n\ntype UseChatContainerMessageList = (props: DSChatT.MessagesListProps) => {\n propsWithDefault: DSChatT.MessagesListProps;\n globalAttributes: ReturnType<typeof useGetGlobalAttributes>;\n fastListActionRef: React.MutableRefObject<DSFastListT.ActionRef>;\n paddingStart: number;\n paddingEnd: number;\n loadMoreRef: React.MutableRefObject<HTMLButtonElement | undefined>;\n virtualListRef: React.MutableRefObject<HTMLDivElement | null>;\n focusTracker: ReturnType<typeof useMessageFocusTracker>;\n} & ReturnType<typeof useKeyboard>;\n\nexport const useChatContainerMessageList: UseChatContainerMessageList = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatT.MessagesListProps>(props, defaultPropsMessagesList);\n useValidateTypescriptPropTypes<DSChatT.MessagesListProps>(\n propsWithDefault,\n ChatContainerMessagesListPropTypes,\n DSChatContainerMessagesList,\n );\n const globalAttributes = useGetGlobalAttributes(propsWithDefault);\n const loadMoreRef = React.useRef<HTMLButtonElement>();\n const virtualListRef = React.useRef<HTMLDivElement | null>(null);\n const fastListActionRef = React.useRef<DSFastListT.ActionRef>({});\n\n const pendingOnScroll = React.useRef(false);\n const { bannerPosition, actionRef, hasMoreItems, isLoading } = propsWithDefault;\n const theme = useTheme();\n // The scroll container's own CSS top-padding was removed (see styled.ts's StyledFastList) and\n // replaced with this \u2014 an equivalent virtualizer-space paddingStart keeps getVisibleItems()'s\n // scrollOffset comparisons in the same frame as its item measurements.\n const containerPaddingStart = parseInt(theme.space.xs, 10);\n const padding = getPadding({ hasMoreItems, bannerPosition, isLoading });\n const paddingStart = padding.paddingStart + containerPaddingStart;\n const { paddingEnd } = padding;\n\n const focusTracker = useMessageFocusTracker(virtualListRef);\n const { trackFocusMessage } = focusTracker;\n\n const { vScroll, onScrollStop, getMessagesInView, onlyFocus, scrollAndFocus, checkPendingOnScroll } =\n useFocusAndScrollHelpers({\n propsWithDefault,\n fastListActionRef,\n pendingOnScroll,\n trackFocusMessage,\n });\n\n useActionRef({\n actionRef,\n vScroll,\n virtualListRef,\n getMessagesInView,\n onlyFocus,\n scrollAndFocus,\n });\n\n useGlobalEventListener({\n propsWithDefault,\n virtualListRef,\n onScrollStop,\n checkPendingOnScroll,\n });\n\n const keyboardMethods = useKeyboard({\n propsWithDefault,\n actionRef,\n virtualListRef,\n loadMoreRef,\n scrollAndFocus,\n onlyFocus,\n getMessagesInView,\n trackFocusMessage,\n });\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalAttributes,\n fastListActionRef,\n paddingStart,\n paddingEnd,\n loadMoreRef,\n virtualListRef,\n focusTracker,\n ...keyboardMethods,\n }),\n [\n globalAttributes,\n keyboardMethods,\n propsWithDefault,\n fastListActionRef,\n paddingStart,\n paddingEnd,\n loadMoreRef,\n virtualListRef,\n focusTracker,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB,OAAOA,YAAW;AAClB,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB;AAC7B,SAAS,8BAA8B;AACvC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,8BAA8B;AAEvC,SAAS,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