@elliemae/ds-chat-container 3.28.1-rc.2 → 3.29.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.
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-chat-container-valid.js +104 -0
- package/dist/cjs/typescript-testing/typescript-chat-container-valid.js.map +7 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-chat-container-valid.js +81 -0
- package/dist/esm/typescript-testing/typescript-chat-container-valid.js.map +7 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/typescript-testing/typescript-chat-container-valid.d.ts +1 -0
- package/package.json +14 -14
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export { ChatComposer } from './parts/chat-composer/index.js';\nexport { ChatContainerMessagesList } from './parts/chat-container-messages-list/index.js';\nexport { ChatContainer, ChatContainerWithSchema } from './ChatContainer.js';\nexport { ChatContainerDataTestIds } from './ChatContainerDataTestids.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
4
|
+
"sourcesContent": ["export { ChatComposer } from './parts/chat-composer/index.js';\nexport { ChatContainerMessagesList } from './parts/chat-container-messages-list/index.js';\nexport { ChatContainer, ChatContainerWithSchema } from './ChatContainer.js';\nexport { ChatContainerDataTestIds } from './ChatContainerDataTestids.js';\nexport type { DSChatT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,2BAA6B;AAC7B,0CAA0C;AAC1C,2BAAuD;AACvD,sCAAyC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 type { CSSProperties, WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DSButtonV2 } 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\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}\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.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;
|
|
4
|
+
"sourcesContent": ["/* 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.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;ADsEX;AAlEZ,mBAAkB;AAClB,8BAAyB;AACzB,0BAA6C;AAC7C,4BAAyC;AAEzC,uCAAiC;AAEjC,oCAA8B;AAC9B,oBAQO;AAEP,mCAAmD;AACnD,+BAAkC;AAClC,yCAA4C;AAC5C,sCAAyC;AAIzC,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,KAAK;AAC1B,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;AAAA,QAAC;AAAA;AAAA,UACC,gBAAa;AAAA,UACb,cAAY;AAAA,UAEZ;AAAA,UACA,UAAU;AAAA,UACV,UAAU;AAAA,UACV,WAAW;AAAA,UACX,MAAK;AAAA,UAEL,uDAAC,uCAAsB,MAAM,IAAI,MAC9B;AAAA,gBAAI,SAAS,mCAAa,UAAU,IAAI,SAAS,mCAAa,YAC7D,4CAAC,oCAAY,GAAG,KAAK,aAAa,YAAY,cAAc,IAAI,aAAa,IAC3E;AAAA,YACH,IAAI,SAAS,mCAAa,YACzB,4CAAC,qDAAkB,GAAI,KAAkD,IACvE;AAAA,YACH,IAAI,SAAS,mCAAa,SAAS,4CAAC,+CAAe,GAAI,KAAoC,IAAK;AAAA,aACnG;AAAA;AAAA,QAfK,kBAAkB,SAAS,IAAI,QAAQ,IAAI;AAAA,MAgBlD;AAAA,IAEJ,CAAC;AAAA,IACH,CAAC,cAAc,UAAU,iBAAiB,WAAW,WAAW;AAAA,EAClE;AAEA,SACE,6CAAC,+BAAe,GAAG,kBACjB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,eAAa,yDAAyB;AAAA,QACtC,UAAU;AAAA,QACV,UAAU;AAAA,QACV,MAAK;AAAA,QACL,WAAW;AAAA,QAEX,uDAAC,sDAAqC,QAAQ,GAAG,eAC9C;AAAA,WAAC,aAAa,eACb,4CAAC,yCAAwB,cAA4B,MAAK,YACxD;AAAA,YAAC;AAAA;AAAA,cACC,YAAW;AAAA,cACX,SAAS;AAAA,cACT,eAAa,yDAAyB;AAAA,cACtC,UAAU;AAAA,cACX;AAAA;AAAA,UAED,GACF,IACE;AAAA,UACH;AAAA,WACH;AAAA;AAAA,IACF;AAAA,IAEA,4CAAC,kDAAiC,aAAU,UAAS,eAAY,SAC9D,sBAAY,IAAI,CAAC,eAChB,6CAAC,OACE;AAAA,iBAAW;AAAA,MAAM;AAAA,MAAE,WAAW;AAAA,MAAK;AAAA,MAAE,WAAW;AAAA,MAAK;AAAA,MAAE,WAAW;AAAA,MAAa;AAAA,MAAE,WAAW;AAAA,SADvF,WAAW,IAEnB,CACD,GACH;AAAA,KACF;AAEJ;AAEA,0BAA0B,YAAY;AACtC,0BAA0B,cAAc;AACxC,MAAM,0CAAsC,kCAAS,yBAAyB;AAC9E,oCAAoC,YAAY;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var React = __toESM(require("react"));
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import__ = require("../index.js");
|
|
27
|
+
const messages = [];
|
|
28
|
+
const testExplicitDefinition = {
|
|
29
|
+
messagesListProps: {
|
|
30
|
+
messages
|
|
31
|
+
},
|
|
32
|
+
composerProps: {
|
|
33
|
+
onChange: () => {
|
|
34
|
+
},
|
|
35
|
+
onSend: () => {
|
|
36
|
+
},
|
|
37
|
+
buttonDisabled: false
|
|
38
|
+
},
|
|
39
|
+
autoScroll: false,
|
|
40
|
+
device: "desktop",
|
|
41
|
+
getMoreMessages: () => {
|
|
42
|
+
},
|
|
43
|
+
sendingText: "Sending..."
|
|
44
|
+
};
|
|
45
|
+
const testInferedTypeCompatibility = {
|
|
46
|
+
messagesListProps: {
|
|
47
|
+
messages
|
|
48
|
+
},
|
|
49
|
+
composerProps: {
|
|
50
|
+
onChange: () => {
|
|
51
|
+
},
|
|
52
|
+
onSend: () => {
|
|
53
|
+
},
|
|
54
|
+
buttonDisabled: false
|
|
55
|
+
},
|
|
56
|
+
autoScroll: false,
|
|
57
|
+
device: "desktop",
|
|
58
|
+
getMoreMessages: () => {
|
|
59
|
+
},
|
|
60
|
+
sendingText: "Sending..."
|
|
61
|
+
};
|
|
62
|
+
const testDefinitionAsConst = {
|
|
63
|
+
messagesListProps: {
|
|
64
|
+
messages
|
|
65
|
+
},
|
|
66
|
+
composerProps: {
|
|
67
|
+
onChange: () => {
|
|
68
|
+
},
|
|
69
|
+
onSend: () => {
|
|
70
|
+
},
|
|
71
|
+
buttonDisabled: false
|
|
72
|
+
},
|
|
73
|
+
autoScroll: false,
|
|
74
|
+
device: "desktop",
|
|
75
|
+
getMoreMessages: () => {
|
|
76
|
+
},
|
|
77
|
+
sendingText: "Sending..."
|
|
78
|
+
};
|
|
79
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ChatContainer, { ...testExplicitDefinition }),
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ChatContainer, { ...testInferedTypeCompatibility }),
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ChatContainer, { ...testDefinitionAsConst }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
import__.ChatContainer,
|
|
85
|
+
{
|
|
86
|
+
messagesListProps: {
|
|
87
|
+
messages
|
|
88
|
+
},
|
|
89
|
+
composerProps: {
|
|
90
|
+
onChange: () => {
|
|
91
|
+
},
|
|
92
|
+
onSend: () => {
|
|
93
|
+
},
|
|
94
|
+
buttonDisabled: false
|
|
95
|
+
},
|
|
96
|
+
autoScroll: false,
|
|
97
|
+
device: "desktop",
|
|
98
|
+
getMoreMessages: () => {
|
|
99
|
+
},
|
|
100
|
+
sendingText: "Sending..."
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
] });
|
|
104
|
+
//# sourceMappingURL=typescript-chat-container-valid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-chat-container-valid.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport type { DSChatBubbleT } from '@elliemae/ds-chat-bubble';\nimport { ChatContainer } from '../index.js';\nimport type { DSChatT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSChatT.ContainerProps;\n\nconst messages: DSChatBubbleT.Props[] = [];\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n messagesListProps: {\n messages: messages,\n },\n composerProps: {\n onChange: () => {},\n onSend: () => {},\n buttonDisabled: false,\n },\n autoScroll: false,\n device: 'desktop',\n getMoreMessages: () => {},\n sendingText: 'Sending...',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n messagesListProps: {\n messages: messages,\n },\n composerProps: {\n onChange: () => {},\n onSend: () => {},\n buttonDisabled: false,\n },\n autoScroll: false,\n device: 'desktop',\n getMoreMessages: () => {},\n sendingText: 'Sending...',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n messagesListProps: {\n messages: messages,\n },\n composerProps: {\n onChange: () => {},\n onSend: () => {},\n buttonDisabled: false,\n },\n autoScroll: false,\n device: 'desktop',\n getMoreMessages: () => {},\n sendingText: 'Sending...',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <ChatContainer {...testExplicitDefinition} />\n <ChatContainer {...testInferedTypeCompatibility} />\n <ChatContainer {...testDefinitionAsConst} />\n {/* works with inline values */}\n <ChatContainer\n messagesListProps={{\n messages: messages,\n }}\n composerProps={{\n onChange: () => {},\n onSend: () => {},\n buttonDisabled: false,\n }}\n autoScroll={false}\n device=\"desktop\"\n getMoreMessages={() => {}}\n sendingText=\"Sending...\"\n />\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;AC0DrB;AAxDF,eAA8B;AAM9B,MAAM,WAAkC,CAAC;AAGzC,MAAM,yBAA+C;AAAA,EACnD,mBAAmB;AAAA,IACjB;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,UAAU,MAAM;AAAA,IAAC;AAAA,IACjB,QAAQ,MAAM;AAAA,IAAC;AAAA,IACf,gBAAgB;AAAA,EAClB;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,iBAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,aAAa;AACf;AAGA,MAAM,+BAA+B;AAAA,EACnC,mBAAmB;AAAA,IACjB;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,UAAU,MAAM;AAAA,IAAC;AAAA,IACjB,QAAQ,MAAM;AAAA,IAAC;AAAA,IACf,gBAAgB;AAAA,EAClB;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,iBAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,aAAa;AACf;AAEA,MAAM,wBAAwB;AAAA,EAC5B,mBAAmB;AAAA,IACjB;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,UAAU,MAAM;AAAA,IAAC;AAAA,IACjB,QAAQ,MAAM;AAAA,IAAC;AAAA,IACf,gBAAgB;AAAA,EAClB;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,iBAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,aAAa;AACf;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,0BAAe,GAAG,wBAAwB;AAAA,EAC3C,4CAAC,0BAAe,GAAG,8BAA8B;AAAA,EACjD,4CAAC,0BAAe,GAAG,uBAAuB;AAAA,EAE1C;AAAA,IAAC;AAAA;AAAA,MACC,mBAAmB;AAAA,QACjB;AAAA,MACF;AAAA,MACA,eAAe;AAAA,QACb,UAAU,MAAM;AAAA,QAAC;AAAA,QACjB,QAAQ,MAAM;AAAA,QAAC;AAAA,QACf,gBAAgB;AAAA,MAClB;AAAA,MACA,YAAY;AAAA,MACZ,QAAO;AAAA,MACP,iBAAiB,MAAM;AAAA,MAAC;AAAA,MACxB,aAAY;AAAA;AAAA,EACd;AAAA,GACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { ChatComposer } from './parts/chat-composer/index.js';\nexport { ChatContainerMessagesList } from './parts/chat-container-messages-list/index.js';\nexport { ChatContainer, ChatContainerWithSchema } from './ChatContainer.js';\nexport { ChatContainerDataTestIds } from './ChatContainerDataTestids.js';\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { ChatComposer } from './parts/chat-composer/index.js';\nexport { ChatContainerMessagesList } from './parts/chat-container-messages-list/index.js';\nexport { ChatContainer, ChatContainerWithSchema } from './ChatContainer.js';\nexport { ChatContainerDataTestIds } from './ChatContainerDataTestids.js';\nexport type { DSChatT } from './react-desc-prop-types.js';\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oBAAoB;AAC7B,SAAS,iCAAiC;AAC1C,SAAS,eAAe,+BAA+B;AACvD,SAAS,gCAAgC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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 } 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\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}\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.propTypes = ChatContainerMessagesListPropTypes as WeakValidationMap<unknown>;\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 { 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.propTypes = ChatContainerMessagesListPropTypes as WeakValidationMap<unknown>;\nChatContainerMessagesList.displayName = 'ChatContainerMessagesList';\nconst ChatContainerMessagesListWithSchema = describe(ChatContainerMessagesList);\nChatContainerMessagesListWithSchema.propTypes = ChatContainerMessagesListPropTypes as WeakValidationMap<unknown>;\n\nexport { ChatContainerMessagesList, ChatContainerMessagesListWithSchema };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChatContainer } from "../index.js";
|
|
4
|
+
const messages = [];
|
|
5
|
+
const testExplicitDefinition = {
|
|
6
|
+
messagesListProps: {
|
|
7
|
+
messages
|
|
8
|
+
},
|
|
9
|
+
composerProps: {
|
|
10
|
+
onChange: () => {
|
|
11
|
+
},
|
|
12
|
+
onSend: () => {
|
|
13
|
+
},
|
|
14
|
+
buttonDisabled: false
|
|
15
|
+
},
|
|
16
|
+
autoScroll: false,
|
|
17
|
+
device: "desktop",
|
|
18
|
+
getMoreMessages: () => {
|
|
19
|
+
},
|
|
20
|
+
sendingText: "Sending..."
|
|
21
|
+
};
|
|
22
|
+
const testInferedTypeCompatibility = {
|
|
23
|
+
messagesListProps: {
|
|
24
|
+
messages
|
|
25
|
+
},
|
|
26
|
+
composerProps: {
|
|
27
|
+
onChange: () => {
|
|
28
|
+
},
|
|
29
|
+
onSend: () => {
|
|
30
|
+
},
|
|
31
|
+
buttonDisabled: false
|
|
32
|
+
},
|
|
33
|
+
autoScroll: false,
|
|
34
|
+
device: "desktop",
|
|
35
|
+
getMoreMessages: () => {
|
|
36
|
+
},
|
|
37
|
+
sendingText: "Sending..."
|
|
38
|
+
};
|
|
39
|
+
const testDefinitionAsConst = {
|
|
40
|
+
messagesListProps: {
|
|
41
|
+
messages
|
|
42
|
+
},
|
|
43
|
+
composerProps: {
|
|
44
|
+
onChange: () => {
|
|
45
|
+
},
|
|
46
|
+
onSend: () => {
|
|
47
|
+
},
|
|
48
|
+
buttonDisabled: false
|
|
49
|
+
},
|
|
50
|
+
autoScroll: false,
|
|
51
|
+
device: "desktop",
|
|
52
|
+
getMoreMessages: () => {
|
|
53
|
+
},
|
|
54
|
+
sendingText: "Sending..."
|
|
55
|
+
};
|
|
56
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
|
+
/* @__PURE__ */ jsx(ChatContainer, { ...testExplicitDefinition }),
|
|
58
|
+
/* @__PURE__ */ jsx(ChatContainer, { ...testInferedTypeCompatibility }),
|
|
59
|
+
/* @__PURE__ */ jsx(ChatContainer, { ...testDefinitionAsConst }),
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
ChatContainer,
|
|
62
|
+
{
|
|
63
|
+
messagesListProps: {
|
|
64
|
+
messages
|
|
65
|
+
},
|
|
66
|
+
composerProps: {
|
|
67
|
+
onChange: () => {
|
|
68
|
+
},
|
|
69
|
+
onSend: () => {
|
|
70
|
+
},
|
|
71
|
+
buttonDisabled: false
|
|
72
|
+
},
|
|
73
|
+
autoScroll: false,
|
|
74
|
+
device: "desktop",
|
|
75
|
+
getMoreMessages: () => {
|
|
76
|
+
},
|
|
77
|
+
sendingText: "Sending..."
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] });
|
|
81
|
+
//# sourceMappingURL=typescript-chat-container-valid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-chat-container-valid.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport type { DSChatBubbleT } from '@elliemae/ds-chat-bubble';\nimport { ChatContainer } from '../index.js';\nimport type { DSChatT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSChatT.ContainerProps;\n\nconst messages: DSChatBubbleT.Props[] = [];\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n messagesListProps: {\n messages: messages,\n },\n composerProps: {\n onChange: () => {},\n onSend: () => {},\n buttonDisabled: false,\n },\n autoScroll: false,\n device: 'desktop',\n getMoreMessages: () => {},\n sendingText: 'Sending...',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n messagesListProps: {\n messages: messages,\n },\n composerProps: {\n onChange: () => {},\n onSend: () => {},\n buttonDisabled: false,\n },\n autoScroll: false,\n device: 'desktop',\n getMoreMessages: () => {},\n sendingText: 'Sending...',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n messagesListProps: {\n messages: messages,\n },\n composerProps: {\n onChange: () => {},\n onSend: () => {},\n buttonDisabled: false,\n },\n autoScroll: false,\n device: 'desktop',\n getMoreMessages: () => {},\n sendingText: 'Sending...',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <ChatContainer {...testExplicitDefinition} />\n <ChatContainer {...testInferedTypeCompatibility} />\n <ChatContainer {...testDefinitionAsConst} />\n {/* works with inline values */}\n <ChatContainer\n messagesListProps={{\n messages: messages,\n }}\n composerProps={{\n onChange: () => {},\n onSend: () => {},\n buttonDisabled: false,\n }}\n autoScroll={false}\n device=\"desktop\"\n getMoreMessages={() => {}}\n sendingText=\"Sending...\"\n />\n </>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC0DrB,mBAEE,KAFF;AAxDF,SAAS,qBAAqB;AAM9B,MAAM,WAAkC,CAAC;AAGzC,MAAM,yBAA+C;AAAA,EACnD,mBAAmB;AAAA,IACjB;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,UAAU,MAAM;AAAA,IAAC;AAAA,IACjB,QAAQ,MAAM;AAAA,IAAC;AAAA,IACf,gBAAgB;AAAA,EAClB;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,iBAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,aAAa;AACf;AAGA,MAAM,+BAA+B;AAAA,EACnC,mBAAmB;AAAA,IACjB;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,UAAU,MAAM;AAAA,IAAC;AAAA,IACjB,QAAQ,MAAM;AAAA,IAAC;AAAA,IACf,gBAAgB;AAAA,EAClB;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,iBAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,aAAa;AACf;AAEA,MAAM,wBAAwB;AAAA,EAC5B,mBAAmB;AAAA,IACjB;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,UAAU,MAAM;AAAA,IAAC;AAAA,IACjB,QAAQ,MAAM;AAAA,IAAC;AAAA,IACf,gBAAgB;AAAA,EAClB;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,iBAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,aAAa;AACf;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,iBAAe,GAAG,wBAAwB;AAAA,EAC3C,oBAAC,iBAAe,GAAG,8BAA8B;AAAA,EACjD,oBAAC,iBAAe,GAAG,uBAAuB;AAAA,EAE1C;AAAA,IAAC;AAAA;AAAA,MACC,mBAAmB;AAAA,QACjB;AAAA,MACF;AAAA,MACA,eAAe;AAAA,QACb,UAAU,MAAM;AAAA,QAAC;AAAA,QACjB,QAAQ,MAAM;AAAA,QAAC;AAAA,QACf,gBAAgB;AAAA,MAClB;AAAA,MACA,YAAY;AAAA,MACZ,QAAO;AAAA,MACP,iBAAiB,MAAM;AAAA,MAAC;AAAA,MACxB,aAAY;AAAA;AAAA,EACd;AAAA,GACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { ChatComposer } from './parts/chat-composer/index.js';
|
|
|
2
2
|
export { ChatContainerMessagesList } from './parts/chat-container-messages-list/index.js';
|
|
3
3
|
export { ChatContainer, ChatContainerWithSchema } from './ChatContainer.js';
|
|
4
4
|
export { ChatContainerDataTestIds } from './ChatContainerDataTestids.js';
|
|
5
|
+
export type { DSChatT } from './react-desc-prop-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-chat-container",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.29.0-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Chat Container",
|
|
6
6
|
"files": [
|
|
@@ -120,27 +120,27 @@
|
|
|
120
120
|
},
|
|
121
121
|
"publishConfig": {
|
|
122
122
|
"access": "public",
|
|
123
|
-
"typeSafety":
|
|
123
|
+
"typeSafety": true
|
|
124
124
|
},
|
|
125
125
|
"dependencies": {
|
|
126
126
|
"react-virtual": "~2.10.4",
|
|
127
|
-
"@elliemae/ds-banner": "3.
|
|
128
|
-
"@elliemae/ds-button-v2": "3.
|
|
129
|
-
"@elliemae/ds-chat-
|
|
130
|
-
"@elliemae/ds-chat-
|
|
131
|
-
"@elliemae/ds-chat-
|
|
132
|
-
"@elliemae/ds-chat-system-message": "3.
|
|
133
|
-
"@elliemae/ds-grid": "3.
|
|
134
|
-
"@elliemae/ds-icons": "3.
|
|
135
|
-
"@elliemae/ds-
|
|
136
|
-
"@elliemae/ds-props-helpers": "3.
|
|
137
|
-
"@elliemae/ds-
|
|
127
|
+
"@elliemae/ds-banner": "3.29.0-next.0",
|
|
128
|
+
"@elliemae/ds-button-v2": "3.29.0-next.0",
|
|
129
|
+
"@elliemae/ds-chat-bubble": "3.29.0-next.0",
|
|
130
|
+
"@elliemae/ds-chat-container-header": "3.29.0-next.0",
|
|
131
|
+
"@elliemae/ds-chat-message-delimeter": "3.29.0-next.0",
|
|
132
|
+
"@elliemae/ds-chat-system-message": "3.29.0-next.0",
|
|
133
|
+
"@elliemae/ds-grid": "3.29.0-next.0",
|
|
134
|
+
"@elliemae/ds-icons": "3.29.0-next.0",
|
|
135
|
+
"@elliemae/ds-indeterminate-progress-indicator": "3.29.0-next.0",
|
|
136
|
+
"@elliemae/ds-props-helpers": "3.29.0-next.0",
|
|
137
|
+
"@elliemae/ds-system": "3.29.0-next.0"
|
|
138
138
|
},
|
|
139
139
|
"devDependencies": {
|
|
140
140
|
"@elliemae/pui-cli": "~9.0.0-next.31",
|
|
141
141
|
"@types/react": "latest",
|
|
142
142
|
"styled-components": "~5.3.9",
|
|
143
|
-
"@elliemae/ds-monorepo-devops": "3.
|
|
143
|
+
"@elliemae/ds-monorepo-devops": "3.29.0-next.0"
|
|
144
144
|
},
|
|
145
145
|
"peerDependencies": {
|
|
146
146
|
"lodash": "^4.17.21",
|