@elliemae/ds-chat-container 3.6.0-next.0

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.
Files changed (73) hide show
  1. package/dist/cjs/ChatContainer.js +174 -0
  2. package/dist/cjs/ChatContainer.js.map +7 -0
  3. package/dist/cjs/ChatContainerDataTestids.js +42 -0
  4. package/dist/cjs/ChatContainerDataTestids.js.map +7 -0
  5. package/dist/cjs/index.js +35 -0
  6. package/dist/cjs/index.js.map +7 -0
  7. package/dist/cjs/parts/chat-composer/ChatContainerComposer.js +195 -0
  8. package/dist/cjs/parts/chat-composer/ChatContainerComposer.js.map +7 -0
  9. package/dist/cjs/parts/chat-composer/index.js +33 -0
  10. package/dist/cjs/parts/chat-composer/index.js.map +7 -0
  11. package/dist/cjs/parts/chat-composer/styled.js +99 -0
  12. package/dist/cjs/parts/chat-composer/styled.js.map +7 -0
  13. package/dist/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +146 -0
  14. package/dist/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +7 -0
  15. package/dist/cjs/parts/chat-container-messages-list/index.js +33 -0
  16. package/dist/cjs/parts/chat-container-messages-list/index.js.map +7 -0
  17. package/dist/cjs/parts/chat-container-messages-list/styled.js +110 -0
  18. package/dist/cjs/parts/chat-container-messages-list/styled.js.map +7 -0
  19. package/dist/cjs/parts/chat-container-messages-list/useActionRef.js +61 -0
  20. package/dist/cjs/parts/chat-container-messages-list/useActionRef.js.map +7 -0
  21. package/dist/cjs/parts/chat-container-messages-list/useChatContainerMessageList.js +106 -0
  22. package/dist/cjs/parts/chat-container-messages-list/useChatContainerMessageList.js.map +7 -0
  23. package/dist/cjs/parts/chat-container-messages-list/useFocusAndScrollHelpers.js +93 -0
  24. package/dist/cjs/parts/chat-container-messages-list/useFocusAndScrollHelpers.js.map +7 -0
  25. package/dist/cjs/parts/chat-container-messages-list/useGetNewMessages.js +46 -0
  26. package/dist/cjs/parts/chat-container-messages-list/useGetNewMessages.js.map +7 -0
  27. package/dist/cjs/parts/chat-container-messages-list/useGlobalEventListener.js +59 -0
  28. package/dist/cjs/parts/chat-container-messages-list/useGlobalEventListener.js.map +7 -0
  29. package/dist/cjs/parts/chat-container-messages-list/useKeyboard.js +151 -0
  30. package/dist/cjs/parts/chat-container-messages-list/useKeyboard.js.map +7 -0
  31. package/dist/cjs/parts/index.js +27 -0
  32. package/dist/cjs/parts/index.js.map +7 -0
  33. package/dist/cjs/react-desc-prop-types.js +184 -0
  34. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  35. package/dist/cjs/styled.js +109 -0
  36. package/dist/cjs/styled.js.map +7 -0
  37. package/dist/esm/ChatContainer.js +153 -0
  38. package/dist/esm/ChatContainer.js.map +7 -0
  39. package/dist/esm/ChatContainerDataTestids.js +16 -0
  40. package/dist/esm/ChatContainerDataTestids.js.map +7 -0
  41. package/dist/esm/index.js +9 -0
  42. package/dist/esm/index.js.map +7 -0
  43. package/dist/esm/parts/chat-composer/ChatContainerComposer.js +175 -0
  44. package/dist/esm/parts/chat-composer/ChatContainerComposer.js.map +7 -0
  45. package/dist/esm/parts/chat-composer/index.js +7 -0
  46. package/dist/esm/parts/chat-composer/index.js.map +7 -0
  47. package/dist/esm/parts/chat-composer/styled.js +73 -0
  48. package/dist/esm/parts/chat-composer/styled.js.map +7 -0
  49. package/dist/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +128 -0
  50. package/dist/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +7 -0
  51. package/dist/esm/parts/chat-container-messages-list/index.js +7 -0
  52. package/dist/esm/parts/chat-container-messages-list/index.js.map +7 -0
  53. package/dist/esm/parts/chat-container-messages-list/styled.js +84 -0
  54. package/dist/esm/parts/chat-container-messages-list/styled.js.map +7 -0
  55. package/dist/esm/parts/chat-container-messages-list/useActionRef.js +35 -0
  56. package/dist/esm/parts/chat-container-messages-list/useActionRef.js.map +7 -0
  57. package/dist/esm/parts/chat-container-messages-list/useChatContainerMessageList.js +84 -0
  58. package/dist/esm/parts/chat-container-messages-list/useChatContainerMessageList.js.map +7 -0
  59. package/dist/esm/parts/chat-container-messages-list/useFocusAndScrollHelpers.js +67 -0
  60. package/dist/esm/parts/chat-container-messages-list/useFocusAndScrollHelpers.js.map +7 -0
  61. package/dist/esm/parts/chat-container-messages-list/useGetNewMessages.js +20 -0
  62. package/dist/esm/parts/chat-container-messages-list/useGetNewMessages.js.map +7 -0
  63. package/dist/esm/parts/chat-container-messages-list/useGlobalEventListener.js +33 -0
  64. package/dist/esm/parts/chat-container-messages-list/useGlobalEventListener.js.map +7 -0
  65. package/dist/esm/parts/chat-container-messages-list/useKeyboard.js +125 -0
  66. package/dist/esm/parts/chat-container-messages-list/useKeyboard.js.map +7 -0
  67. package/dist/esm/parts/index.js +4 -0
  68. package/dist/esm/parts/index.js.map +7 -0
  69. package/dist/esm/react-desc-prop-types.js +158 -0
  70. package/dist/esm/react-desc-prop-types.js.map +7 -0
  71. package/dist/esm/styled.js +83 -0
  72. package/dist/esm/styled.js.map +7 -0
  73. package/package.json +162 -0
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var styled_exports = {};
26
+ __export(styled_exports, {
27
+ StyledChatContainerContentComposer: () => StyledChatContainerContentComposer,
28
+ StyledComposerButton: () => StyledComposerButton,
29
+ StyledComposerInput: () => StyledComposerInput,
30
+ StyledCounterArea: () => StyledCounterArea,
31
+ StyledCounterErrorA11y: () => StyledCounterErrorA11y
32
+ });
33
+ module.exports = __toCommonJS(styled_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_ds_system = require("@elliemae/ds-system");
36
+ var import_ds_grid = require("@elliemae/ds-grid");
37
+ var import_ds_button = require("@elliemae/ds-button");
38
+ const StyledChatContainerContentComposer = (0, import_ds_system.styled)(import_ds_grid.Grid)`
39
+ width: 100%;
40
+ min-height: 56px;
41
+ background: ${(props) => props.theme.colors.neutral["050"]};
42
+ padding: ${(props) => props.theme.space.xxs};
43
+ padding-bottom: 3px;
44
+ padding-top: 6px;
45
+ padding-left: ${(props) => props.theme.space.xs};
46
+ max-height: ${(props) => props.maxHeight};
47
+ border-top: 1px solid #cbcfd7;
48
+ `;
49
+ const StyledComposerInput = import_ds_system.styled.textarea`
50
+ padding: ${(props) => props.theme.space.xxs};
51
+ resize: none;
52
+ min-height: 32px;
53
+ border-radius: 2px;
54
+ border: solid 1px #cbcfd7;
55
+ color: #25292f;
56
+ height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height};
57
+ min-width: 244px;
58
+ overflow-y: auto;
59
+ font-size: 13px;
60
+ font-weight: 400;
61
+ line-height: 1;
62
+ transition: height 0.05s;
63
+ &:focus {
64
+ outline: none;
65
+ border: 1px solid ${(props) => props.theme.colors.brand[600]};
66
+ box-shadow: inset 0 0 0 1px #8cc2ed;
67
+ border-radius: 2px;
68
+ }
69
+ `;
70
+ const StyledComposerButton = (0, import_ds_system.styled)(import_ds_button.DSButtonV2)`
71
+ &:disabled {
72
+ background: none;
73
+ svg {
74
+ fill: #5d6775;
75
+ }
76
+ }
77
+ svg {
78
+ fill: ${(props) => props.theme.colors.brand[600]};
79
+ }
80
+ &:focus {
81
+ background: ${(props) => props.theme.colors.brand[200]};
82
+ }
83
+ `;
84
+ const StyledCounterArea = (0, import_ds_system.styled)(import_ds_grid.Grid)`
85
+ text-align: right;
86
+ font-size: 11px;
87
+ height: 15px;
88
+ align-items: center;
89
+ font-style: italic;
90
+ ${(props) => props.hasError ? `color:${props.theme.colors.danger[900]};` : ""}
91
+ position:relative;
92
+ `;
93
+ const StyledCounterErrorA11y = import_ds_system.styled.span`
94
+ width: 1px;
95
+ height: 1px;
96
+ position: absolute;
97
+ clip: rect(1px, 1px, 1px, 1px);
98
+ `;
99
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/parts/chat-composer/styled.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { TextAreaProps } from '../../react-desc-prop-types';\n\n// Composer\nexport const StyledChatContainerContentComposer = styled(Grid)<{ maxHeight: string }>`\n width: 100%;\n min-height: 56px;\n background: ${(props) => props.theme.colors.neutral['050']};\n padding: ${(props) => props.theme.space.xxs};\n padding-bottom: 3px;\n padding-top: 6px;\n padding-left: ${(props) => props.theme.space.xs};\n max-height: ${(props) => props.maxHeight};\n border-top: 1px solid #cbcfd7;\n`;\n\nexport const StyledComposerInput = styled.textarea`\n padding: ${(props) => props.theme.space.xxs};\n resize: none;\n min-height: 32px;\n border-radius: 2px;\n border: solid 1px #cbcfd7;\n color: #25292f;\n height: ${(props: TextAreaProps) => (typeof props.height === 'number' ? `${props.height}px` : props.height)};\n min-width: 244px;\n overflow-y: auto;\n font-size: 13px;\n font-weight: 400;\n line-height: 1;\n transition: height 0.05s;\n &:focus {\n outline: none;\n border: 1px solid ${(props) => props.theme.colors.brand[600]};\n box-shadow: inset 0 0 0 1px #8cc2ed;\n border-radius: 2px;\n }\n`;\nexport const StyledComposerButton = styled(DSButtonV2)`\n &:disabled {\n background: none;\n svg {\n fill: #5d6775;\n }\n }\n svg {\n fill: ${(props) => props.theme.colors.brand[600]};\n }\n &:focus {\n background: ${(props) => props.theme.colors.brand[200]};\n }\n`;\n\nexport const StyledCounterArea = styled(Grid)<{ hasError: boolean }>`\n text-align: right;\n font-size: 11px;\n height: 15px;\n align-items: center;\n font-style: italic;\n ${(props) => (props.hasError ? `color:${props.theme.colors.danger[900]};` : '')}\n position:relative;\n`;\n\nexport const StyledCounterErrorA11y = styled.span`\n width: 1px;\n height: 1px;\n position: absolute;\n clip: rect(1px, 1px, 1px, 1px);\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,qBAAqB;AACrB,uBAA2B;AAIpB,MAAM,yCAAqC,yBAAO,mBAAI;AAAA;AAAA;AAAA,gBAG7C,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA,aACzC,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA,kBAGxB,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA,gBAC/B,CAAC,UAAU,MAAM;AAAA;AAAA;AAI1B,MAAM,sBAAsB,wBAAO;AAAA,aAC7B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAM9B,CAAC,UAA0B,OAAO,MAAM,WAAW,WAAW,GAAG,MAAM,aAAa,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAS9E,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAKrD,MAAM,2BAAuB,yBAAO,2BAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAQzC,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA,kBAG9B,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;AAI/C,MAAM,wBAAoB,yBAAO,mBAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMxC,CAAC,UAAW,MAAM,WAAW,SAAS,MAAM,MAAM,OAAO,OAAO,UAAU;AAAA;AAAA;AAIvE,MAAM,yBAAyB,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var ChatContainerMessagesList_exports = {};
26
+ __export(ChatContainerMessagesList_exports, {
27
+ ChatContainerMessagesList: () => ChatContainerMessagesList,
28
+ ChatContainerMessagesListWithSchema: () => ChatContainerMessagesListWithSchema
29
+ });
30
+ module.exports = __toCommonJS(ChatContainerMessagesList_exports);
31
+ var React = __toESM(require("react"));
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ var import_react = __toESM(require("react"));
34
+ var import_ds_utilities = require("@elliemae/ds-utilities");
35
+ var import_ds_button = __toESM(require("@elliemae/ds-button"));
36
+ var import_ds_chat_bubble = require("@elliemae/ds-chat-bubble");
37
+ var import_ds_chat_message_delimeter = require("@elliemae/ds-chat-message-delimeter");
38
+ var import_ds_chat_system_message = require("@elliemae/ds-chat-system-message");
39
+ var import_styled = require("./styled");
40
+ var import_react_desc_prop_types = require("../../react-desc-prop-types");
41
+ var import_useGetNewMessages = require("./useGetNewMessages");
42
+ var import_useChatContainerMessageList = require("./useChatContainerMessageList");
43
+ var import_ChatContainerDataTestids = require("../../ChatContainerDataTestids");
44
+ const ChatContainerMessagesList = (props) => {
45
+ const {
46
+ propsWithDefault,
47
+ globalAttributes,
48
+ useVirtualHelpers,
49
+ handleKey,
50
+ handleListKey,
51
+ loadMoreRef,
52
+ virtualListRef
53
+ } = (0, import_useChatContainerMessageList.useChatContainerMessageList)(props);
54
+ const { sendingText, sendingMessages, messages, getMoreMessages, hasMoreItems, isLoading } = propsWithDefault;
55
+ const { totalSize, virtualItems } = useVirtualHelpers;
56
+ const newMessages = (0, import_useGetNewMessages.useGetNewMessages)(messages);
57
+ const render = import_react.default.useMemo(
58
+ () => virtualItems.map((virtualItem) => {
59
+ const { index, measureRef, start } = virtualItem;
60
+ const row = messages[index];
61
+ const isSending = sendingMessages && sendingMessages.find((m) => m === row.dsId);
62
+ const style = {
63
+ position: "absolute",
64
+ top: 0,
65
+ left: 0,
66
+ transform: `translateY(${start}px)`,
67
+ width: "100%"
68
+ };
69
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.ListItem, {
70
+ "data-element": "chat-element-list-item",
71
+ "data-index": index,
72
+ style,
73
+ ref: measureRef,
74
+ tabIndex: -1,
75
+ onKeyDown: handleKey,
76
+ role: "listitem",
77
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledWrapperListItem, {
78
+ type: row.type,
79
+ children: [
80
+ row.type === import_ds_chat_bubble.BUBBLE_TYPES.SENDER || row.type === import_ds_chat_bubble.BUBBLE_TYPES.RECIPIENT ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_chat_bubble.ChatBubble, {
81
+ ...row,
82
+ helpMessage: isSending ? sendingText : row.helpMessage
83
+ }) : null,
84
+ row.type === import_ds_chat_bubble.BUBBLE_TYPES.DELIMITER ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_chat_message_delimeter.MessageDelimiter, {
85
+ ...row
86
+ }) : null,
87
+ row.type === import_ds_chat_bubble.BUBBLE_TYPES.SYSTEM ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_chat_system_message.SystemMessage, {
88
+ ...row
89
+ }) : null
90
+ ]
91
+ })
92
+ }, `ds-chat-bubble-${index}-${row.dsId}-${row.type}`);
93
+ }),
94
+ [virtualItems, messages, sendingMessages, handleKey, sendingText]
95
+ );
96
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledWrapper, {
97
+ ...globalAttributes,
98
+ children: [
99
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledChatContainerContentList, {
100
+ "data-testid": import_ChatContainerDataTestids.ChatContainerDataTestIds.THREAD_CONTAINER,
101
+ tabIndex: 0,
102
+ ref: virtualListRef,
103
+ role: "list",
104
+ onKeyDown: handleListKey,
105
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledChatContainerContentListScroll, {
106
+ height: `${totalSize}px`,
107
+ children: [
108
+ !isLoading && hasMoreItems ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledLoadMoreContainer, {
109
+ hasMoreItems,
110
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_button.default, {
111
+ labelText: "Load More",
112
+ buttonType: "secondary",
113
+ onClick: getMoreMessages,
114
+ "data-testid": import_ChatContainerDataTestids.ChatContainerDataTestIds.LOAD_MORE_BUTTON,
115
+ innerRef: loadMoreRef
116
+ })
117
+ }) : null,
118
+ render
119
+ ]
120
+ })
121
+ }),
122
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledNewMessagesHiddenContainer, {
123
+ "aria-live": "polite",
124
+ "aria-hidden": "false",
125
+ children: newMessages.map((newMessage) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
126
+ children: [
127
+ newMessage.title,
128
+ " ",
129
+ newMessage.time,
130
+ " ",
131
+ newMessage.body,
132
+ " ",
133
+ newMessage.errorMessage,
134
+ " ",
135
+ newMessage.helpMessage
136
+ ]
137
+ }, newMessage.dsId))
138
+ })
139
+ ]
140
+ });
141
+ };
142
+ ChatContainerMessagesList.propTypes = import_react_desc_prop_types.ChatContainerMessagesListPropTypes;
143
+ ChatContainerMessagesList.displayName = "ChatContainerMessagesList";
144
+ const ChatContainerMessagesListWithSchema = (0, import_ds_utilities.describe)(ChatContainerMessagesList);
145
+ ChatContainerMessagesListWithSchema.propTypes = import_react_desc_prop_types.ChatContainerMessagesListPropTypes;
146
+ //# sourceMappingURL=ChatContainerMessagesList.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/parts/chat-container-messages-list/ChatContainerMessagesList.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport React, { CSSProperties, WeakValidationMap } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport DSButton from '@elliemae/ds-button';\nimport { ChatBubble, BUBBLE_TYPES } from '@elliemae/ds-chat-bubble';\nimport { MessageDelimiter, DSChatMessageDelimeterT } from '@elliemae/ds-chat-message-delimeter';\nimport { SystemMessage, DSChatSystemMessageT } from '@elliemae/ds-chat-system-message';\nimport {\n StyledWrapperListItem,\n StyledChatContainerContentList,\n StyledChatContainerContentListScroll,\n StyledWrapper,\n StyledLoadMoreContainer,\n ListItem,\n StyledNewMessagesHiddenContainer,\n} from './styled';\nimport { DSChatT, ChatContainerMessagesListPropTypes } from '../../react-desc-prop-types';\nimport { useGetNewMessages } from './useGetNewMessages';\nimport { useChatContainerMessageList } from './useChatContainerMessageList';\nimport { ChatContainerDataTestIds } from '../../ChatContainerDataTestids';\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 ref={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 ref={virtualListRef as React.RefObject<HTMLDivElement>}\n role=\"list\"\n onKeyDown={handleListKey}\n >\n <StyledChatContainerContentListScroll height={`${totalSize}px`}>\n {!isLoading && hasMoreItems ? (\n <StyledLoadMoreContainer hasMoreItems={hasMoreItems}>\n <DSButton\n labelText=\"Load More\"\n buttonType=\"secondary\"\n onClick={getMoreMessages}\n data-testid={ChatContainerDataTestIds.LOAD_MORE_BUTTON}\n innerRef={loadMoreRef}\n />\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.propTypes = ChatContainerMessagesListPropTypes as WeakValidationMap<unknown>;\nChatContainerMessagesList.displayName = 'ChatContainerMessagesList';\nconst ChatContainerMessagesListWithSchema = describe(ChatContainerMessagesList);\nChatContainerMessagesListWithSchema.propTypes = ChatContainerMessagesListPropTypes as WeakValidationMap<unknown>;\n\nexport { ChatContainerMessagesList, ChatContainerMessagesListWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAGA,mBAAwD;AACxD,0BAAyB;AACzB,uBAAqB;AACrB,4BAAyC;AACzC,uCAA0D;AAC1D,oCAAoD;AACpD,oBAQO;AACP,mCAA4D;AAC5D,+BAAkC;AAClC,yCAA4C;AAC5C,sCAAyC;AAEzC,MAAM,4BAA4E,CAAC,UAAU;AAC3F,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,gEAA4B,KAAK;AAErC,QAAM,EAAE,aAAa,iBAAiB,UAAU,iBAAiB,cAAc,UAAU,IAAI;AAC7F,QAAM,EAAE,WAAW,aAAa,IAAI;AAEpC,QAAM,kBAAc,4CAAkB,QAAQ;AAE9C,QAAM,SAAS,aAAAA,QAAM;AAAA,IACnB,MACE,aAAa,IAAI,CAAC,gBAAgB;AAChC,YAAM,EAAE,OAAO,YAAY,MAAM,IAAI;AACrC,YAAM,MAAM,SAAS;AACrB,YAAM,YAAY,mBAAmB,gBAAgB,KAAK,CAAC,MAAM,MAAM,IAAI,IAAI;AAC/E,YAAM,QAAuB;AAAA,QAC3B,UAAU;AAAA,QACV,KAAK;AAAA,QACL,MAAM;AAAA,QACN,WAAW,cAAc;AAAA,QACzB,OAAO;AAAA,MACT;AAEA,aACE,4CAAC;AAAA,QACC,gBAAa;AAAA,QACb,cAAY;AAAA,QAEZ;AAAA,QACA,KAAK;AAAA,QACL,UAAU;AAAA,QACV,WAAW;AAAA,QACX,MAAK;AAAA,QAEL,uDAAC;AAAA,UAAsB,MAAM,IAAI;AAAA,UAC9B;AAAA,gBAAI,SAAS,mCAAa,UAAU,IAAI,SAAS,mCAAa,YAC7D,4CAAC;AAAA,cAAY,GAAG;AAAA,cAAK,aAAa,YAAY,cAAc,IAAI;AAAA,aAAa,IAC3E;AAAA,YACH,IAAI,SAAS,mCAAa,YACzB,4CAAC;AAAA,cAAkB,GAAI;AAAA,aAAkD,IACvE;AAAA,YACH,IAAI,SAAS,mCAAa,SAAS,4CAAC;AAAA,cAAe,GAAI;AAAA,aAAoC,IAAK;AAAA;AAAA,SACnG;AAAA,SAfK,kBAAkB,SAAS,IAAI,QAAQ,IAAI,MAgBlD;AAAA,IAEJ,CAAC;AAAA,IACH,CAAC,cAAc,UAAU,iBAAiB,WAAW,WAAW;AAAA,EAClE;AAEA,SACE,6CAAC;AAAA,IAAe,GAAG;AAAA,IACjB;AAAA,kDAAC;AAAA,QACC,eAAa,yDAAyB;AAAA,QACtC,UAAU;AAAA,QACV,KAAK;AAAA,QACL,MAAK;AAAA,QACL,WAAW;AAAA,QAEX,uDAAC;AAAA,UAAqC,QAAQ,GAAG;AAAA,UAC9C;AAAA,aAAC,aAAa,eACb,4CAAC;AAAA,cAAwB;AAAA,cACvB,sDAAC,iBAAAC,SAAA;AAAA,gBACC,WAAU;AAAA,gBACV,YAAW;AAAA,gBACX,SAAS;AAAA,gBACT,eAAa,yDAAyB;AAAA,gBACtC,UAAU;AAAA,eACZ;AAAA,aACF,IACE;AAAA,YACH;AAAA;AAAA,SACH;AAAA,OACF;AAAA,MAEA,4CAAC;AAAA,QAAiC,aAAU;AAAA,QAAS,eAAY;AAAA,QAC9D,sBAAY,IAAI,CAAC,eAChB,6CAAC;AAAA,UACE;AAAA,uBAAW;AAAA,YAAM;AAAA,YAAE,WAAW;AAAA,YAAK;AAAA,YAAE,WAAW;AAAA,YAAK;AAAA,YAAE,WAAW;AAAA,YAAa;AAAA,YAAE,WAAW;AAAA;AAAA,WADvF,WAAW,IAEnB,CACD;AAAA,OACH;AAAA;AAAA,GACF;AAEJ;AAEA,0BAA0B,YAAY;AACtC,0BAA0B,cAAc;AACxC,MAAM,0CAAsC,8BAAS,yBAAyB;AAC9E,oCAAoC,YAAY;",
6
+ "names": ["React", "DSButton"]
7
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var chat_container_messages_list_exports = {};
26
+ __export(chat_container_messages_list_exports, {
27
+ ChatContainerMessagesList: () => import_ChatContainerMessagesList.ChatContainerMessagesList,
28
+ ChatContainerMessagesListWithSchema: () => import_ChatContainerMessagesList.ChatContainerMessagesListWithSchema
29
+ });
30
+ module.exports = __toCommonJS(chat_container_messages_list_exports);
31
+ var React = __toESM(require("react"));
32
+ var import_ChatContainerMessagesList = require("./ChatContainerMessagesList");
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/parts/chat-container-messages-list/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export { ChatContainerMessagesList, ChatContainerMessagesListWithSchema } from './ChatContainerMessagesList';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uCAA+E;",
6
+ "names": []
7
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var styled_exports = {};
26
+ __export(styled_exports, {
27
+ ListItem: () => ListItem,
28
+ StyledChatContainerContentList: () => StyledChatContainerContentList,
29
+ StyledChatContainerContentListScroll: () => StyledChatContainerContentListScroll,
30
+ StyledLoadMoreContainer: () => StyledLoadMoreContainer,
31
+ StyledNewMessagesHiddenContainer: () => StyledNewMessagesHiddenContainer,
32
+ StyledWrapper: () => StyledWrapper,
33
+ StyledWrapperListItem: () => StyledWrapperListItem
34
+ });
35
+ module.exports = __toCommonJS(styled_exports);
36
+ var React = __toESM(require("react"));
37
+ var import_ds_system = require("@elliemae/ds-system");
38
+ var import_ds_chat_bubble = require("@elliemae/ds-chat-bubble");
39
+ const StyledWrapper = import_ds_system.styled.div`
40
+ width: 100%;
41
+ height: 100%;
42
+ `;
43
+ const StyledWrapperListItem = import_ds_system.styled.div`
44
+ min-width: 100%;
45
+ ${(props) => props.type === import_ds_chat_bubble.BUBBLE_TYPES.SENDER && `padding: ${props.theme.space.xxs} ${props.theme.space.xxs} ${props.theme.space.xxs} 13%
46
+ `};
47
+ ${(props) => props.type === import_ds_chat_bubble.BUBBLE_TYPES.RECIPIENT && `padding: ${props.theme.space.xxs} 13% ${props.theme.space.xxs}
48
+ ${props.theme.space.xxs}
49
+ `};
50
+ ${(props) => props.type === import_ds_chat_bubble.BUBBLE_TYPES.SYSTEM && `padding: ${props.theme.space.xxs} 0px
51
+ `};
52
+ `;
53
+ const StyledChatContainerContentList = import_ds_system.styled.div`
54
+ width: 100%;
55
+ height: 100%;
56
+ padding: ${(props) => props.theme.space.xs};
57
+ padding-bottom: 0;
58
+ overflow-y: auto;
59
+ overflow-x: hidden;
60
+ `;
61
+ const StyledNewMessagesHiddenContainer = import_ds_system.styled.div`
62
+ position: absolute;
63
+ width: 1px;
64
+ height: 1px;
65
+ margin: -1px;
66
+ border: 0;
67
+ padding: 0;
68
+ overflow: hidden;
69
+ clip: rect(0 0 0 0);
70
+ clip-path: inset(100%);
71
+ white-space: nowrap;
72
+ `;
73
+ const StyledChatContainerContentListScroll = import_ds_system.styled.div`
74
+ width: 100%;
75
+ height: ${(props) => props.height};
76
+ position: relative;
77
+ `;
78
+ const StyledLoadMoreContainer = import_ds_system.styled.div`
79
+ position: absolute;
80
+ width: calc(100% + ${(props) => props.theme.space.xxs});
81
+ padding: ${(props) => props.theme.space.xxs};
82
+ left: -${(props) => props.theme.space.xxs};
83
+ right: -${(props) => props.theme.space.xxs};
84
+ display: grid;
85
+ justify-content: center;
86
+ align-items: center;
87
+ ${(props) => props.hasMoreItems === "top" ? "top: 0;" : ""}
88
+ ${(props) => props.hasMoreItems === "bottom" ? "bottom: 0;" : ""}
89
+ `;
90
+ const ListItem = import_ds_system.styled.div`
91
+ &:focus,
92
+ &:focus-visible {
93
+ outline: none;
94
+ &:after {
95
+ content: '';
96
+ display: block;
97
+ position: absolute;
98
+ top: 0;
99
+ left: -${(props) => props.theme.space.xxs};
100
+ pointer-events: none;
101
+ border-radius: 2px;
102
+ background-color: #ebedf0;
103
+ width: calc(100% + 24px);
104
+ border: 2px solid #1e79c2;
105
+ height: 100%;
106
+ z-index: -1;
107
+ }
108
+ }
109
+ `;
110
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/parts/chat-container-messages-list/styled.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport { BUBBLE_TYPES, DSChatBubbleT } 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 StyledChatContainerContentList = styled.div`\n width: 100%;\n height: 100%;\n padding: ${(props) => props.theme.space.xs};\n padding-bottom: 0;\n overflow-y: auto;\n overflow-x: hidden;\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 StyledChatContainerContentListScroll = styled.div<{ height: string }>`\n width: 100%;\n height: ${(props) => props.height};\n position: relative;\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`;\nexport const ListItem = styled.div`\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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,4BAA4C;AAErC,MAAM,gBAAgB,wBAAO;AAAA;AAAA;AAAA;AAM7B,MAAM,wBAAwB,wBAAO;AAAA;AAAA,IAExC,CAAC,UACD,MAAM,SAAS,mCAAa,UAC5B,YAAY,MAAM,MAAM,MAAM,OAAO,MAAM,MAAM,MAAM,OAAO,MAAM,MAAM,MAAM;AAAA;AAAA,IAEhF,CAAC,UACD,MAAM,SAAS,mCAAa,aAC5B,YAAY,MAAM,MAAM,MAAM,WAAW,MAAM,MAAM,MAAM;AAAA,MACzD,MAAM,MAAM,MAAM;AAAA;AAAA,IAEpB,CAAC,UACD,MAAM,SAAS,mCAAa,UAC5B,YAAY,MAAM,MAAM,MAAM;AAAA;AAAA;AAI3B,MAAM,iCAAiC,wBAAO;AAAA;AAAA;AAAA,aAGxC,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAMnC,MAAM,mCAAmC,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAahD,MAAM,uCAAuC,wBAAO;AAAA;AAAA,YAE/C,CAAC,UAAU,MAAM;AAAA;AAAA;AAItB,MAAM,0BAA0B,wBAAO;AAAA;AAAA,uBAEvB,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA,aACvC,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA,WAC/B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA,YAC5B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA,IAIrC,CAAC,UAAW,MAAM,iBAAiB,QAAQ,YAAY;AAAA,IACvD,CAAC,UAAW,MAAM,iBAAiB,WAAW,eAAe;AAAA;AAE1D,MAAM,WAAW,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAShB,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var useActionRef_exports = {};
26
+ __export(useActionRef_exports, {
27
+ useActionRef: () => useActionRef
28
+ });
29
+ module.exports = __toCommonJS(useActionRef_exports);
30
+ var React = __toESM(require("react"));
31
+ var import_react = __toESM(require("react"));
32
+ const useActionRef = ({
33
+ actionRef,
34
+ useVirtualHelpers: { scrollToIndex: vScroll },
35
+ virtualListRef,
36
+ onScrollStop,
37
+ onlyFocus,
38
+ scrollAndFocus
39
+ }) => {
40
+ import_react.default.useEffect(() => {
41
+ if (actionRef && actionRef.current) {
42
+ const scrollToIndex = (index, opts = { align: "center" }) => {
43
+ vScroll(index, opts);
44
+ onScrollStop();
45
+ };
46
+ const focusToIndex = (index, opts = { align: "center" }) => {
47
+ scrollAndFocus(index, opts);
48
+ };
49
+ const focusToList = () => {
50
+ virtualListRef.current?.focus();
51
+ };
52
+ actionRef.current.scrollToIndex = scrollToIndex;
53
+ actionRef.current.getMessagesInView = onScrollStop;
54
+ onScrollStop();
55
+ actionRef.current.focusToIndex = focusToIndex;
56
+ actionRef.current.focusToIndexWithoutScroll = onlyFocus;
57
+ actionRef.current.focusToList = focusToList;
58
+ }
59
+ }, [actionRef, onScrollStop, onlyFocus, scrollAndFocus, vScroll, virtualListRef]);
60
+ };
61
+ //# sourceMappingURL=useActionRef.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/parts/chat-container-messages-list/useActionRef.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport { useVirtual } from 'react-virtual';\nimport { DSChatT } from '../../react-desc-prop-types';\n\ntype UseActionRefArgs = {\n actionRef: DSChatT.ActionRef;\n useVirtualHelpers: ReturnType<typeof useVirtual>;\n virtualListRef: React.MutableRefObject<HTMLDivElement | undefined>;\n onScrollStop: () => string[];\n onlyFocus: (index: string) => void;\n scrollAndFocus: (index: number, opts?: DSChatT.ScrollToIndexOptions) => void;\n};\n\nexport const useActionRef = ({\n actionRef,\n useVirtualHelpers: { scrollToIndex: vScroll },\n virtualListRef,\n onScrollStop,\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 vScroll(index, opts);\n onScrollStop();\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 = onScrollStop;\n // I have no idea what the next line refeers to\n // keeping this from original code to avoid any possible breaking-change\n onScrollStop(); // init useMemo due to debounce use.\n actionRef.current.focusToIndex = focusToIndex;\n actionRef.current.focusToIndexWithoutScroll = onlyFocus;\n actionRef.current.focusToList = focusToList;\n }\n }, [actionRef, onScrollStop, onlyFocus, scrollAndFocus, vScroll, virtualListRef]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAkB;AAaX,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,mBAAmB,EAAE,eAAe,QAAQ;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAwB;AACtB,eAAAA,QAAM,UAAU,MAAM;AACpB,QAAI,aAAa,UAAU,SAAS;AAClC,YAAM,gBAA+D,CAAC,OAAO,OAAO,EAAE,OAAO,SAAS,MAAM;AAC1G,gBAAQ,OAAO,IAAI;AACnB,qBAAa;AAAA,MACf;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;AAGtC,mBAAa;AACb,gBAAU,QAAQ,eAAe;AACjC,gBAAU,QAAQ,4BAA4B;AAC9C,gBAAU,QAAQ,cAAc;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,WAAW,cAAc,WAAW,gBAAgB,SAAS,cAAc,CAAC;AAClF;",
6
+ "names": ["React"]
7
+ }
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var useChatContainerMessageList_exports = {};
26
+ __export(useChatContainerMessageList_exports, {
27
+ useChatContainerMessageList: () => useChatContainerMessageList
28
+ });
29
+ module.exports = __toCommonJS(useChatContainerMessageList_exports);
30
+ var React = __toESM(require("react"));
31
+ var import_react = __toESM(require("react"));
32
+ var import_ds_utilities = require("@elliemae/ds-utilities");
33
+ var import_react_virtual = require("react-virtual");
34
+ var import_useActionRef = require("./useActionRef");
35
+ var import_useGlobalEventListener = require("./useGlobalEventListener");
36
+ var import_useKeyboard = require("./useKeyboard");
37
+ var import_useFocusAndScrollHelpers = require("./useFocusAndScrollHelpers");
38
+ var import_react_desc_prop_types = require("../../react-desc-prop-types");
39
+ const getPadding = ({ hasMoreItems, bannerPosition, isLoading }) => {
40
+ const padding = {
41
+ paddingStart: 0,
42
+ paddingEnd: -5
43
+ };
44
+ if ([hasMoreItems, bannerPosition, isLoading].some((item) => item === "top"))
45
+ padding.paddingStart = 42;
46
+ else if ([hasMoreItems, bannerPosition, isLoading].some((item) => item === "bottom"))
47
+ padding.paddingEnd = 42;
48
+ return padding;
49
+ };
50
+ const useChatContainerMessageList = (props) => {
51
+ const propsWithDefault = (0, import_ds_utilities.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultPropsMessagesList);
52
+ (0, import_ds_utilities.useValidateTypescriptPropTypes)(propsWithDefault, import_react_desc_prop_types.ChatContainerMessagesListPropTypes);
53
+ const globalAttributes = (0, import_ds_utilities.useGetGlobalAttributes)(propsWithDefault);
54
+ const loadMoreRef = import_react.default.useRef();
55
+ const virtualListRef = import_react.default.useRef();
56
+ const pendingOnScroll = import_react.default.useRef(false);
57
+ const { bannerPosition, messages, actionRef, hasMoreItems, isLoading } = propsWithDefault;
58
+ const useVirtualHelpers = (0, import_react_virtual.useVirtual)({
59
+ size: messages?.length,
60
+ parentRef: virtualListRef,
61
+ overscan: 15,
62
+ ...getPadding({ hasMoreItems, bannerPosition, isLoading }),
63
+ estimateSize: import_react.default.useCallback(() => 80, [])
64
+ });
65
+ const { onScrollStop, onlyFocus, scrollAndFocus, checkPendingOnScroll } = (0, import_useFocusAndScrollHelpers.useFocusAndScrollHelpers)({
66
+ propsWithDefault,
67
+ useVirtualHelpers,
68
+ pendingOnScroll,
69
+ virtualListRef
70
+ });
71
+ (0, import_useActionRef.useActionRef)({
72
+ actionRef,
73
+ useVirtualHelpers,
74
+ virtualListRef,
75
+ onScrollStop,
76
+ onlyFocus,
77
+ scrollAndFocus
78
+ });
79
+ (0, import_useGlobalEventListener.useGlobalEventListener)({
80
+ propsWithDefault,
81
+ virtualListRef,
82
+ onScrollStop,
83
+ checkPendingOnScroll
84
+ });
85
+ const keyboardMethods = (0, import_useKeyboard.useKeyboard)({
86
+ propsWithDefault,
87
+ actionRef,
88
+ virtualListRef,
89
+ loadMoreRef,
90
+ scrollAndFocus,
91
+ onlyFocus,
92
+ onScrollStop
93
+ });
94
+ return import_react.default.useMemo(
95
+ () => ({
96
+ propsWithDefault,
97
+ globalAttributes,
98
+ useVirtualHelpers,
99
+ loadMoreRef,
100
+ virtualListRef,
101
+ ...keyboardMethods
102
+ }),
103
+ [globalAttributes, keyboardMethods, propsWithDefault, useVirtualHelpers, loadMoreRef, virtualListRef]
104
+ );
105
+ };
106
+ //# sourceMappingURL=useChatContainerMessageList.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/parts/chat-container-messages-list/useChatContainerMessageList.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* 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-utilities';\nimport { useVirtual } from 'react-virtual';\nimport { useActionRef } from './useActionRef';\nimport { useGlobalEventListener } from './useGlobalEventListener';\nimport { useKeyboard } from './useKeyboard';\nimport { useFocusAndScrollHelpers } from './useFocusAndScrollHelpers';\nimport { DSChatT, ChatContainerMessagesListPropTypes, defaultPropsMessagesList } from '../../react-desc-prop-types';\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 useVirtualHelpers: ReturnType<typeof useVirtual>;\n loadMoreRef: React.MutableRefObject<HTMLButtonElement | undefined>;\n virtualListRef: React.MutableRefObject<HTMLDivElement | undefined>;\n} & ReturnType<typeof useKeyboard>;\n\nexport const useChatContainerMessageList: UseChatContainerMessageList = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatT.MessagesListProps>(props, defaultPropsMessagesList);\n useValidateTypescriptPropTypes<DSChatT.MessagesListProps>(propsWithDefault, ChatContainerMessagesListPropTypes);\n const globalAttributes = useGetGlobalAttributes(propsWithDefault);\n const loadMoreRef = React.useRef<HTMLButtonElement>();\n const virtualListRef = React.useRef<HTMLDivElement>();\n\n const pendingOnScroll = React.useRef(false);\n const { bannerPosition, messages, actionRef, hasMoreItems, isLoading } = propsWithDefault;\n const useVirtualHelpers = useVirtual({\n size: messages?.length,\n parentRef: virtualListRef,\n overscan: 15,\n ...getPadding({ hasMoreItems, bannerPosition, isLoading }),\n // estimateSize should not be really required given what was stated on\n // https://github.com/tannerlinsley/react-virtual/issues/23\n estimateSize: React.useCallback(() => 80, []),\n });\n\n const { onScrollStop, onlyFocus, scrollAndFocus, checkPendingOnScroll } = useFocusAndScrollHelpers({\n propsWithDefault,\n useVirtualHelpers,\n pendingOnScroll,\n virtualListRef,\n });\n\n useActionRef({\n actionRef,\n useVirtualHelpers,\n virtualListRef,\n onScrollStop,\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 onScrollStop,\n });\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalAttributes,\n useVirtualHelpers,\n loadMoreRef,\n virtualListRef,\n ...keyboardMethods,\n }),\n [globalAttributes, keyboardMethods, propsWithDefault, useVirtualHelpers, loadMoreRef, virtualListRef],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAkB;AAClB,0BAIO;AACP,2BAA2B;AAC3B,0BAA6B;AAC7B,oCAAuC;AACvC,yBAA4B;AAC5B,sCAAyC;AACzC,mCAAsF;AAEtF,MAAM,aAAa,CAAC,EAAE,cAAc,gBAAgB,UAAU,MAA2B;AACvF,QAAM,UAAU;AAAA,IACd,cAAc;AAAA,IACd,YAAY;AAAA,EACd;AACA,MAAI,CAAC,cAAc,gBAAgB,SAAS,EAAE,KAAK,CAAC,SAAS,SAAS,KAAK;AAAG,YAAQ,eAAe;AAAA,WAC5F,CAAC,cAAc,gBAAgB,SAAS,EAAE,KAAK,CAAC,SAAS,SAAS,QAAQ;AAAG,YAAQ,aAAa;AAC3G,SAAO;AACT;AAUO,MAAM,8BAA2D,CAAC,UAAU;AACjF,QAAM,uBAAmB,kDAAwD,OAAO,qDAAwB;AAChH,0DAA0D,kBAAkB,+DAAkC;AAC9G,QAAM,uBAAmB,4CAAuB,gBAAgB;AAChE,QAAM,cAAc,aAAAA,QAAM,OAA0B;AACpD,QAAM,iBAAiB,aAAAA,QAAM,OAAuB;AAEpD,QAAM,kBAAkB,aAAAA,QAAM,OAAO,KAAK;AAC1C,QAAM,EAAE,gBAAgB,UAAU,WAAW,cAAc,UAAU,IAAI;AACzE,QAAM,wBAAoB,iCAAW;AAAA,IACnC,MAAM,UAAU;AAAA,IAChB,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG,WAAW,EAAE,cAAc,gBAAgB,UAAU,CAAC;AAAA,IAGzD,cAAc,aAAAA,QAAM,YAAY,MAAM,IAAI,CAAC,CAAC;AAAA,EAC9C,CAAC;AAED,QAAM,EAAE,cAAc,WAAW,gBAAgB,qBAAqB,QAAI,0DAAyB;AAAA,IACjG;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,wCAAa;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,4DAAuB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,sBAAkB,gCAAY;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA,CAAC,kBAAkB,iBAAiB,kBAAkB,mBAAmB,aAAa,cAAc;AAAA,EACtG;AACF;",
6
+ "names": ["React"]
7
+ }