@elliemae/ds-chat 1.61.6 → 1.61.11

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 (42) hide show
  1. package/cjs/index.js +2 -1
  2. package/cjs/index.js.map +1 -1
  3. package/cjs/parts/chat-composer/ChatContainerComposer.js +10 -6
  4. package/cjs/parts/chat-composer/ChatContainerComposer.js.map +1 -1
  5. package/cjs/parts/chat-composer/props.js +2 -0
  6. package/cjs/parts/chat-composer/props.js.map +1 -1
  7. package/cjs/parts/chat-container/ChatContainer.js +6 -3
  8. package/cjs/parts/chat-container/ChatContainer.js.map +1 -1
  9. package/cjs/parts/chat-container/index.js +1 -0
  10. package/cjs/parts/chat-container/index.js.map +1 -1
  11. package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +13 -6
  12. package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +1 -1
  13. package/cjs/parts/chat-container-messages-list/index.js +2 -0
  14. package/cjs/parts/chat-container-messages-list/index.js.map +1 -1
  15. package/cjs/parts/chat-container-messages-list/styled.js +7 -3
  16. package/cjs/parts/chat-container-messages-list/styled.js.map +1 -1
  17. package/cjs/parts/chat-container-messages-list/useGetNewMessages.js +34 -0
  18. package/cjs/parts/chat-container-messages-list/useGetNewMessages.js.map +1 -0
  19. package/cjs/parts/grid-influencer/InfluencerContainer.js +1 -0
  20. package/cjs/parts/grid-influencer/InfluencerContainer.js.map +1 -1
  21. package/esm/index.js +2 -1
  22. package/esm/index.js.map +1 -1
  23. package/esm/parts/chat-composer/ChatContainerComposer.js +10 -6
  24. package/esm/parts/chat-composer/ChatContainerComposer.js.map +1 -1
  25. package/esm/parts/chat-composer/props.js +2 -0
  26. package/esm/parts/chat-composer/props.js.map +1 -1
  27. package/esm/parts/chat-container/ChatContainer.js +6 -3
  28. package/esm/parts/chat-container/ChatContainer.js.map +1 -1
  29. package/esm/parts/chat-container/index.js +1 -0
  30. package/esm/parts/chat-container/index.js.map +1 -1
  31. package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +14 -7
  32. package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +1 -1
  33. package/esm/parts/chat-container-messages-list/index.js +2 -0
  34. package/esm/parts/chat-container-messages-list/index.js.map +1 -1
  35. package/esm/parts/chat-container-messages-list/styled.js +7 -4
  36. package/esm/parts/chat-container-messages-list/styled.js.map +1 -1
  37. package/esm/parts/chat-container-messages-list/useGetNewMessages.js +26 -0
  38. package/esm/parts/chat-container-messages-list/useGetNewMessages.js.map +1 -0
  39. package/esm/parts/grid-influencer/InfluencerContainer.js +1 -0
  40. package/esm/parts/grid-influencer/InfluencerContainer.js.map +1 -1
  41. package/package.json +9 -9
  42. package/parts/chat-container-messages-list/useGetNewMessages/package.json +10 -0
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
+ var React = require('react');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
11
+
12
+ var useGetNewMessages = function useGetNewMessages(messages) {
13
+ var _useState = React.useState({}),
14
+ _useState2 = _slicedToArray__default['default'](_useState, 2),
15
+ seenMessages = _useState2[0],
16
+ setSeenMessages = _useState2[1];
17
+
18
+ var newMessages = React.useMemo(function () {
19
+ var list = [];
20
+ messages.forEach(function (message) {
21
+ if (!(message.dsId in seenMessages)) {
22
+ list.push(message);
23
+ }
24
+ });
25
+ setSeenMessages(Object.fromEntries(messages.map(function (m) {
26
+ return [m.dsId, true];
27
+ })));
28
+ return list; // eslint-disable-next-line react-hooks/exhaustive-deps
29
+ }, [messages]);
30
+ return newMessages;
31
+ };
32
+
33
+ exports.useGetNewMessages = useGetNewMessages;
34
+ //# sourceMappingURL=useGetNewMessages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetNewMessages.js","sources":["../../../../src/parts/chat-container-messages-list/useGetNewMessages.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { BubbleProps } from '../bubble/props';\n\nexport const useGetNewMessages = (messages: BubbleProps[]) => {\n const [seenMessages, setSeenMessages] = useState<Record<BubbleProps['dsId'], true>>({});\n\n const newMessages = useMemo(() => {\n const list: BubbleProps[] = [];\n messages.forEach((message) => {\n if (!(message.dsId in seenMessages)) {\n list.push(message);\n }\n });\n setSeenMessages(Object.fromEntries(messages.map((m) => [m.dsId, true])));\n return list;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messages]);\n\n return newMessages;\n};\n"],"names":["useGetNewMessages","messages","useState","seenMessages","setSeenMessages","newMessages","useMemo","list","forEach","message","dsId","push","Object","fromEntries","map","m"],"mappings":";;;;;;;;;;;IAGaA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD,EAA6B;AAC5D,kBAAwCC,cAAQ,CAAoC,EAApC,CAAhD;AAAA;AAAA,MAAOC,YAAP;AAAA,MAAqBC,eAArB;;AAEA,MAAMC,WAAW,GAAGC,aAAO,CAAC,YAAM;AAChC,QAAMC,IAAmB,GAAG,EAA5B;AACAN,IAAAA,QAAQ,CAACO,OAAT,CAAiB,UAACC,OAAD,EAAa;AAC5B,UAAI,EAAEA,OAAO,CAACC,IAAR,IAAgBP,YAAlB,CAAJ,EAAqC;AACnCI,QAAAA,IAAI,CAACI,IAAL,CAAUF,OAAV;AACD;AACF,KAJD;AAKAL,IAAAA,eAAe,CAACQ,MAAM,CAACC,WAAP,CAAmBZ,QAAQ,CAACa,GAAT,CAAa,UAACC,CAAD;AAAA,aAAO,CAACA,CAAC,CAACL,IAAH,EAAS,IAAT,CAAP;AAAA,KAAb,CAAnB,CAAD,CAAf;AACA,WAAOH,IAAP,CARgC;AAUjC,GAV0B,EAUxB,CAACN,QAAD,CAVwB,CAA3B;AAYA,SAAOI,WAAP;AACD;;;;"}
@@ -42,6 +42,7 @@ require('../system-message/config/useValidateProps.js');
42
42
  require('../chat-container-messages-list/styled.js');
43
43
  require('../chat-container-messages-list/props.js');
44
44
  require('../chat-container-messages-list/config/useValidateProps.js');
45
+ require('../chat-container-messages-list/useGetNewMessages.js');
45
46
  require('../chat-container/props.js');
46
47
  require('../chat-container/styled.js');
47
48
  require('../chat-container/config/useValidateProps.js');
@@ -1 +1 @@
1
- {"version":3,"file":"InfluencerContainer.js","sources":["../../../../src/parts/grid-influencer/InfluencerContainer.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { StyledChatContainer } from './styled';\nimport { ChatContainer } from '../chat-container/ChatContainer';\nimport { SideBarChat } from '../chat-sidebar/SideBarChat';\n\nexport const InfluencerContainer: React.ComponentType<any> = (props) =>\n React.useMemo(\n () =>\n props.floating ? null : (\n <StyledChatContainer\n cols={['auto', props.expanded ? 1 : '0px']}\n expanded={props.expanded}\n expandedWidth={props.expandedWidth}\n >\n <SideBarChat />\n {props.expanded ? <ChatContainer /> : <div />}\n </StyledChatContainer>\n ),\n [props.floating, props.expanded, props.expandedWidth],\n );\n"],"names":["InfluencerContainer","props","React","useMemo","floating","StyledChatContainer","expanded","expandedWidth","SideBarChat","ChatContainer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;IAMaA,mBAA6C,GAAG,SAAhDA,mBAAgD,CAACC,KAAD;AAAA,SAC3DC,yBAAK,CAACC,OAAN,CACE;AAAA,WACEF,KAAK,CAACG,QAAN,GAAiB,IAAjB,gBACEF,wCAACG,+CAAD;AACE,MAAA,IAAI,EAAE,CAAC,MAAD,EAASJ,KAAK,CAACK,QAAN,GAAiB,CAAjB,GAAqB,KAA9B,CADR;AAEE,MAAA,QAAQ,EAAEL,KAAK,CAACK,QAFlB;AAGE,MAAA,aAAa,EAAEL,KAAK,CAACM;AAHvB,oBAKEL,wCAACM,yCAAD,OALF,EAMGP,KAAK,CAACK,QAAN,gBAAiBJ,wCAACO,+CAAD,OAAjB,gBAAqCP,oDANxC,CAFJ;AAAA,GADF,EAYE,CAACD,KAAK,CAACG,QAAP,EAAiBH,KAAK,CAACK,QAAvB,EAAiCL,KAAK,CAACM,aAAvC,CAZF,CAD2D;AAAA;;;;"}
1
+ {"version":3,"file":"InfluencerContainer.js","sources":["../../../../src/parts/grid-influencer/InfluencerContainer.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { StyledChatContainer } from './styled';\nimport { ChatContainer } from '../chat-container/ChatContainer';\nimport { SideBarChat } from '../chat-sidebar/SideBarChat';\n\nexport const InfluencerContainer: React.ComponentType<any> = (props) =>\n React.useMemo(\n () =>\n props.floating ? null : (\n <StyledChatContainer\n cols={['auto', props.expanded ? 1 : '0px']}\n expanded={props.expanded}\n expandedWidth={props.expandedWidth}\n >\n <SideBarChat />\n {props.expanded ? <ChatContainer /> : <div />}\n </StyledChatContainer>\n ),\n [props.floating, props.expanded, props.expandedWidth],\n );\n"],"names":["InfluencerContainer","props","React","useMemo","floating","StyledChatContainer","expanded","expandedWidth","SideBarChat","ChatContainer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;IAMaA,mBAA6C,GAAG,SAAhDA,mBAAgD,CAACC,KAAD;AAAA,SAC3DC,yBAAK,CAACC,OAAN,CACE;AAAA,WACEF,KAAK,CAACG,QAAN,GAAiB,IAAjB,gBACEF,wCAACG,+CAAD;AACE,MAAA,IAAI,EAAE,CAAC,MAAD,EAASJ,KAAK,CAACK,QAAN,GAAiB,CAAjB,GAAqB,KAA9B,CADR;AAEE,MAAA,QAAQ,EAAEL,KAAK,CAACK,QAFlB;AAGE,MAAA,aAAa,EAAEL,KAAK,CAACM;AAHvB,oBAKEL,wCAACM,yCAAD,OALF,EAMGP,KAAK,CAACK,QAAN,gBAAiBJ,wCAACO,+CAAD,OAAjB,gBAAqCP,oDANxC,CAFJ;AAAA,GADF,EAYE,CAACD,KAAK,CAACG,QAAP,EAAiBH,KAAK,CAACK,QAAvB,EAAiCL,KAAK,CAACM,aAAvC,CAZF,CAD2D;AAAA;;;;"}
package/esm/index.js CHANGED
@@ -39,13 +39,14 @@ import '@elliemae/ds-button';
39
39
  import './parts/chat-container-messages-list/styled.js';
40
40
  import './parts/chat-container-messages-list/props.js';
41
41
  import './parts/chat-container-messages-list/config/useValidateProps.js';
42
+ import './parts/chat-container-messages-list/useGetNewMessages.js';
43
+ import '@babel/runtime/helpers/esm/slicedToArray';
42
44
  import './parts/message-delimiter/styled.js';
43
45
  import './parts/message-delimiter/props.js';
44
46
  import './parts/message-delimiter/config/useValidateProps.js';
45
47
  import './parts/system-message/style.js';
46
48
  import './parts/system-message/props.js';
47
49
  import './parts/system-message/config/useValidateProps.js';
48
- import '@babel/runtime/helpers/esm/slicedToArray';
49
50
  import './parts/chat-composer/styled.js';
50
51
  import './parts/chat-composer/config/useValidateProps.js';
51
52
  import './parts/chat-composer/props.js';
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -12,9 +12,9 @@ import '@elliemae/ds-button';
12
12
  import '@elliemae/ds-props-helpers';
13
13
  import 'lodash';
14
14
 
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
16
 
17
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
18
 
19
19
  var ChatComposer = function ChatComposer(props) {
20
20
  var _input$current;
@@ -32,9 +32,11 @@ var ChatComposer = function ChatComposer(props) {
32
32
  placeholder = props.placeholder,
33
33
  inputMaxLength = props.inputMaxLength,
34
34
  maxLengthMessage = props.maxLengthMessage,
35
+ ariaMaxLengthMessage = props.ariaMaxLengthMessage,
35
36
  buttonDisabled = props.buttonDisabled,
36
37
  dataTestid = props.dataTestid,
37
38
  actionRef = props.actionRef;
39
+ var COMPOSER_MIN_HEIGHT = 32;
38
40
  var input = React.useRef();
39
41
  var inputSize = React.useRef();
40
42
  var inputSend = React.useRef();
@@ -57,10 +59,10 @@ var ChatComposer = function ChatComposer(props) {
57
59
  var _inputSize$current, _inputSize$current2, _inputSize$current3, _inputSize$current4;
58
60
 
59
61
  var newHeight = ((_inputSize$current = inputSize.current) === null || _inputSize$current === void 0 ? void 0 : _inputSize$current.scrollHeight) > internalMaxHeight ? internalMaxHeight : (_inputSize$current2 = inputSize.current) === null || _inputSize$current2 === void 0 ? void 0 : _inputSize$current2.scrollHeight;
60
- onResize(newHeight);
62
+ if (newHeight !== height && newHeight > COMPOSER_MIN_HEIGHT) onResize(newHeight);
61
63
  setHeight(newHeight);
62
64
  setShowScroll(((_inputSize$current3 = inputSize.current) === null || _inputSize$current3 === void 0 ? void 0 : _inputSize$current3.scrollHeight) - ((_inputSize$current4 = inputSize.current) === null || _inputSize$current4 === void 0 ? void 0 : _inputSize$current4.clientHeight) > 5);
63
- }, [inputValue, internalMaxHeight, onResize]);
65
+ }, [inputValue, internalMaxHeight, height, onResize]);
64
66
  React.useEffect(function () {
65
67
  if (actionRef && actionRef.current) {
66
68
  actionRef.current.focusToComposer = function () {
@@ -105,7 +107,9 @@ var ChatComposer = function ChatComposer(props) {
105
107
  onKeyDown: onKeyDown,
106
108
  placeholder: placeholder,
107
109
  "aria-label": "Message to send",
108
- "data-testid": "chat-composer-textarea"
110
+ "data-testid": "chat-composer-textarea",
111
+ name: "chat-composer-textarea",
112
+ id: "chat-composer-textarea"
109
113
  }), /*#__PURE__*/React.createElement(Grid, {
110
114
  height: "32px",
111
115
  alignItems: "center"
@@ -144,7 +148,7 @@ var ChatComposer = function ChatComposer(props) {
144
148
  "data-testid": "composer-counter-area"
145
149
  }, inputMaxLength && hasError ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledCounterErrorA11y, {
146
150
  role: "alert"
147
- }, maxLengthMessage || "You have entered ".concat(inputLength, " characters and have exceeded the limit by ").concat(inputLength - inputMaxLength, ". Please limit to less than ").concat(inputMaxLength, " characters. ")), maxLengthMessage || "Please limit to less than ".concat(inputMaxLength, " characters. ")) : '', inputMaxLength ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React.createElement(Grid, null)));
151
+ }, ariaMaxLengthMessage || "You have entered ".concat(inputLength, " characters and have exceeded the limit by ").concat(inputLength - inputMaxLength, ". Please limit to less than ").concat(inputMaxLength, " characters. ")), maxLengthMessage || "Please limit to less than ".concat(inputMaxLength, " characters. ")) : '', inputMaxLength ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React.createElement(Grid, null)));
148
152
  };
149
153
 
150
154
  ChatComposer.propTypes = composerProps;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContainerComposer.js","sources":["../../../../src/parts/chat-composer/ChatContainerComposer.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { describe } from 'react-desc';\nimport { PaperAirplane } from '@elliemae/ds-icons';\nimport {\n StyledChatContainerContentComposer,\n StyledComposerInput,\n StyledComposerButton,\n StyledCounterArea,\n StyledCounterErrorA11y,\n} from './styled';\nimport { useValidateProps } from './config/useValidateProps';\n\nimport { defaultComposerPros, composerProps, ChatComposerProps } from './props';\n\nconst ChatComposer = (props: ChatComposerProps): JSX.Element => {\n useValidateProps(props, ChatComposerWithSchema.toJSON());\n\n const {\n inputValue,\n onChange,\n onResize,\n onSend,\n onFocus,\n onBlur,\n onKeyDown,\n maxHeight = 300,\n placeholder,\n inputMaxLength,\n maxLengthMessage,\n buttonDisabled,\n dataTestid,\n actionRef,\n } = props;\n\n const input = React.useRef<HTMLTextAreaElement>();\n const inputSize = React.useRef<HTMLTextAreaElement>();\n const inputSend = React.useRef<HTMLButtonElement>();\n const [height, setHeight] = React.useState(32);\n const internalMaxHeight = React.useMemo(() => maxHeight - 24, [maxHeight]);\n const [showScroll, setShowScroll] = React.useState(true);\n\n React.useEffect(() => {\n const newHeight =\n inputSize.current?.scrollHeight > internalMaxHeight ? internalMaxHeight : inputSize.current?.scrollHeight;\n onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, onResize]);\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToComposer = () => {\n input.current.focus();\n };\n actionRef.current.focusToSend = () => {\n inputSend.current.focus();\n };\n }\n }, [actionRef]);\n\n const handleChange = React.useCallback(\n (e) => {\n onChange(e.target.value);\n },\n [onChange],\n );\n const heightProps = { height, overflow: showScroll ? 'auto' : 'hidden' };\n\n const inputLength = String(inputValue || '').length;\n const hasError = React.useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid\n cols={['1fr', '24px']}\n style={{ height: heightProps.height }}\n justifyContent=\"center\"\n alignItems=\"flex-end\"\n gutter=\"xxs\"\n >\n <StyledComposerInput\n ref={input}\n onChange={handleChange}\n style={{ ...heightProps }}\n value={inputValue}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label=\"Message to send\"\n data-testid=\"chat-composer-textarea\"\n />\n\n <Grid height=\"32px\" alignItems=\"center\">\n <StyledComposerButton\n buttonType=\"text\"\n icon={<PaperAirplane width={18} height={18} />}\n onClick={onSend}\n size=\"s\"\n disabled={!inputValue || buttonDisabled || hasError}\n data-testid=\"chat-composer-send-button\"\n aria-label=\"Send\"\n innerRef={inputSend}\n />\n </Grid>\n </Grid>\n <StyledComposerInput\n ref={inputSize}\n style={{\n height: 32,\n visibility: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n width: input.current?.clientWidth,\n }}\n onChange={handleChange}\n value={inputValue}\n />\n <Grid cols={['1fr', '24px']} justifyContent=\"flex-end\" alignItems=\"center\" gutter=\"xxs\" pb=\"xxs\">\n <StyledCounterArea hasError={hasError} data-testid=\"composer-counter-area\">\n {inputMaxLength && hasError ? (\n <>\n <StyledCounterErrorA11y role=\"alert\">\n {maxLengthMessage ||\n `You have entered ${inputLength} characters and have exceeded the limit by ${\n inputLength - inputMaxLength\n }. Please limit to less than ${inputMaxLength} characters. `}\n </StyledCounterErrorA11y>\n {maxLengthMessage || `Please limit to less than ${inputMaxLength} characters. `}\n </>\n ) : (\n ''\n )}\n {inputMaxLength ? ` ${inputLength} / ${inputMaxLength}` : ''}\n </StyledCounterArea>\n <Grid />\n </Grid>\n </StyledChatContainerContentComposer>\n );\n};\n\nChatComposer.propTypes = composerProps;\nChatComposer.defaultProps = defaultComposerPros;\nconst ChatComposerWithSchema = describe(ChatComposer);\nChatComposerWithSchema.propTypes = composerProps;\n\nexport { ChatComposer, ChatComposerWithSchema };\n"],"names":["ChatComposer","props","useValidateProps","ChatComposerWithSchema","toJSON","inputValue","onChange","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","placeholder","inputMaxLength","maxLengthMessage","buttonDisabled","dataTestid","actionRef","input","React","useRef","inputSize","inputSend","useState","height","setHeight","internalMaxHeight","useMemo","showScroll","setShowScroll","useEffect","newHeight","current","scrollHeight","clientHeight","focusToComposer","focus","focusToSend","handleChange","useCallback","e","target","value","heightProps","overflow","inputLength","String","length","hasError","visibility","pointerEvents","position","top","width","clientWidth","propTypes","composerProps","defaultProps","defaultComposerPros","describe"],"mappings":";;;;;;;;;;;;;;;;;;IAgBMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAA2C;AAAA;;AAC9DC,EAAAA,gBAAgB,CAACD,KAAD,EAAQE,sBAAsB,CAACC,MAAvB,EAAR,CAAhB;AAEA,MACEC,UADF,GAeIJ,KAfJ,CACEI,UADF;AAAA,MAEEC,QAFF,GAeIL,KAfJ,CAEEK,QAFF;AAAA,MAGEC,QAHF,GAeIN,KAfJ,CAGEM,QAHF;AAAA,MAIEC,MAJF,GAeIP,KAfJ,CAIEO,MAJF;AAAA,MAKEC,OALF,GAeIR,KAfJ,CAKEQ,OALF;AAAA,MAMEC,MANF,GAeIT,KAfJ,CAMES,MANF;AAAA,MAOEC,SAP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,KAAK,CAACc,OAAR,mDAAE,eAAesB;AANjB,KAFT;AAUE,IAAA,QAAQ,EAAEhB,YAVZ;AAWE,IAAA,KAAK,EAAElC;AAXT,IAlCF,eA+CE,oBAAC,IAAD;AAAM,IAAA,IAAI,EAAE,CAAC,KAAD,EAAQ,MAAR,CAAZ;AAA6B,IAAA,cAAc,EAAC,UAA5C;AAAuD,IAAA,UAAU,EAAC,QAAlE;AAA2E,IAAA,MAAM,EAAC,KAAlF;AAAwF,IAAA,EAAE,EAAC;AAA3F,kBACE,oBAAC,iBAAD;AAAmB,IAAA,QAAQ,EAAE4C,QAA7B;AAAuC,mBAAY;AAAnD,KACGnC,cAAc,IAAImC,QAAlB,gBACC,uDACE,oBAAC,sBAAD;AAAwB,IAAA,IAAI,EAAC;AAA7B,KACGlC,gBAAgB,+BACK+B,WADL,wDAEbA,WAAW,GAAGhC,cAFD,yCAGgBA,cAHhB,kBADnB,CADF,EAOGC,gBAAgB,wCAAiCD,cAAjC,kBAPnB,CADD,GAWC,EAZJ,EAcGA,cAAc,cAAOgC,WAAP,gBAAwBhC,cAAxB,IAA2C,EAd5D,CADF,eAiBE,oBAAC,IAAD,OAjBF,CA/CF,CADF;AAqED;;AAEDd,YAAY,CAACwD,SAAb,GAAyBC,aAAzB;AACAzD,YAAY,CAAC0D,YAAb,GAA4BC,mBAA5B;IACMxD,sBAAsB,GAAGyD,QAAQ,CAAC5D,YAAD;AACvCG,sBAAsB,CAACqD,SAAvB,GAAmCC,aAAnC;;;;"}
1
+ {"version":3,"file":"ChatContainerComposer.js","sources":["../../../../src/parts/chat-composer/ChatContainerComposer.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { describe } from 'react-desc';\nimport { PaperAirplane } from '@elliemae/ds-icons';\nimport {\n StyledChatContainerContentComposer,\n StyledComposerInput,\n StyledComposerButton,\n StyledCounterArea,\n StyledCounterErrorA11y,\n} from './styled';\nimport { useValidateProps } from './config/useValidateProps';\n\nimport { defaultComposerPros, composerProps, ChatComposerProps } from './props';\n\n// eslint-disable-next-line complexity\nconst ChatComposer = (props: ChatComposerProps): JSX.Element => {\n useValidateProps(props, ChatComposerWithSchema.toJSON());\n\n const {\n inputValue,\n onChange,\n onResize,\n onSend,\n onFocus,\n onBlur,\n onKeyDown,\n maxHeight = 300,\n placeholder,\n inputMaxLength,\n maxLengthMessage,\n ariaMaxLengthMessage,\n buttonDisabled,\n dataTestid,\n actionRef,\n } = props;\n\n const COMPOSER_MIN_HEIGHT = 32;\n const input = React.useRef<HTMLTextAreaElement>();\n const inputSize = React.useRef<HTMLTextAreaElement>();\n const inputSend = React.useRef<HTMLButtonElement>();\n const [height, setHeight] = React.useState(32);\n const internalMaxHeight = React.useMemo(() => maxHeight - 24, [maxHeight]);\n const [showScroll, setShowScroll] = React.useState(true);\n\n React.useEffect(() => {\n const newHeight =\n inputSize.current?.scrollHeight > internalMaxHeight ? internalMaxHeight : inputSize.current?.scrollHeight;\n if (newHeight !== height && newHeight > COMPOSER_MIN_HEIGHT) onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, height, onResize]);\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToComposer = () => {\n input.current.focus();\n };\n actionRef.current.focusToSend = () => {\n inputSend.current.focus();\n };\n }\n }, [actionRef]);\n\n const handleChange = React.useCallback(\n (e) => {\n onChange(e.target.value);\n },\n [onChange],\n );\n const heightProps = { height, overflow: showScroll ? 'auto' : 'hidden' };\n\n const inputLength = String(inputValue || '').length;\n const hasError = React.useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid\n cols={['1fr', '24px']}\n style={{ height: heightProps.height }}\n justifyContent=\"center\"\n alignItems=\"flex-end\"\n gutter=\"xxs\"\n >\n <StyledComposerInput\n ref={input}\n onChange={handleChange}\n style={{ ...heightProps }}\n value={inputValue}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label=\"Message to send\"\n data-testid=\"chat-composer-textarea\"\n name=\"chat-composer-textarea\"\n id=\"chat-composer-textarea\"\n />\n\n <Grid height=\"32px\" alignItems=\"center\">\n <StyledComposerButton\n buttonType=\"text\"\n icon={<PaperAirplane width={18} height={18} />}\n onClick={onSend}\n size=\"s\"\n disabled={!inputValue || buttonDisabled || hasError}\n data-testid=\"chat-composer-send-button\"\n aria-label=\"Send\"\n innerRef={inputSend}\n />\n </Grid>\n </Grid>\n <StyledComposerInput\n ref={inputSize}\n style={{\n height: 32,\n visibility: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n width: input.current?.clientWidth,\n }}\n onChange={handleChange}\n value={inputValue}\n />\n <Grid cols={['1fr', '24px']} justifyContent=\"flex-end\" alignItems=\"center\" gutter=\"xxs\" pb=\"xxs\">\n <StyledCounterArea hasError={hasError} data-testid=\"composer-counter-area\">\n {inputMaxLength && hasError ? (\n <>\n <StyledCounterErrorA11y role=\"alert\">\n {ariaMaxLengthMessage ||\n `You have entered ${inputLength} characters and have exceeded the limit by ${\n inputLength - inputMaxLength\n }. Please limit to less than ${inputMaxLength} characters. `}\n </StyledCounterErrorA11y>\n {maxLengthMessage || `Please limit to less than ${inputMaxLength} characters. `}\n </>\n ) : (\n ''\n )}\n {inputMaxLength ? ` ${inputLength} / ${inputMaxLength}` : ''}\n </StyledCounterArea>\n <Grid />\n </Grid>\n </StyledChatContainerContentComposer>\n );\n};\n\nChatComposer.propTypes = composerProps;\nChatComposer.defaultProps = defaultComposerPros;\nconst ChatComposerWithSchema = describe(ChatComposer);\nChatComposerWithSchema.propTypes = composerProps;\n\nexport { ChatComposer, ChatComposerWithSchema };\n"],"names":["ChatComposer","props","useValidateProps","ChatComposerWithSchema","toJSON","inputValue","onChange","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","placeholder","inputMaxLength","maxLengthMessage","ariaMaxLengthMessage","buttonDisabled","dataTestid","actionRef","COMPOSER_MIN_HEIGHT","input","React","useRef","inputSize","inputSend","useState","height","setHeight","internalMaxHeight","useMemo","showScroll","setShowScroll","useEffect","newHeight","current","scrollHeight","clientHeight","focusToComposer","focus","focusToSend","handleChange","useCallback","e","target","value","heightProps","overflow","inputLength","String","length","hasError","visibility","pointerEvents","position","top","width","clientWidth","propTypes","composerProps","defaultProps","defaultComposerPros","describe"],"mappings":";;;;;;;;;;;;;;;;;;IAiBMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAA2C;AAAA;;AAC9DC,EAAAA,gBAAgB,CAACD,KAAD,EAAQE,sBAAsB,CAACC,MAAvB,EAAR,CAAhB;AAEA,MACEC,UADF,GAgBIJ,KAhBJ,CACEI,UADF;AAAA,MAEEC,QAFF,GAgBIL,KAhBJ,CAEEK,QAFF;AAAA,MAGEC,QAHF,GAgBIN,KAhBJ,CAGEM,QAHF;AAAA,MAIEC,MAJF,GAgBIP,KAhBJ,CAIEO,MAJF;AAAA,MAKEC,OALF,GAgBIR,KAhBJ,CAKEQ,OALF;AAAA,MAMEC,MANF,GAgBIT,KAhBJ,CAMES,MANF;AAAA,MAOEC,SAPF,GAgBIV,KAhBJ,CAOEU,SAPF;AAAA,yBAgBIV,KAhBJ,CAQEW,SARF;AAAA,MAQEA,SARF,iCAQc,GARd;AAAA,MASEC,WATF,GAgBIZ,KAhBJ,CASEY,WATF;AAAA,MAUEC,cAVF,GAgBIb,KAhBJ,CAUEa,cAVF;AAAA,MAWEC,gBAXF,GAgBId,KAhBJ,CAWEc,gBAXF;AAAA,MAYEC,oBAZF,GAgBIf,KAhBJ,CAYEe,oBAZF;AAAA,MAaEC,cAbF,GAgBIhB,KAhBJ,CAaEgB,cAbF;AAAA,MAcEC,UAdF,GAgBIjB,KAhBJ,CAcEiB,UAdF;AA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AE,CAAC,KAAD,EAAQ,MAAR,CAAZ;AAA6B,IAAA,cAAc,EAAC,UAA5C;AAAuD,IAAA,UAAU,EAAC,QAAlE;AAA2E,IAAA,MAAM,EAAC,KAAlF;AAAwF,IAAA,EAAE,EAAC;AAA3F,kBACE,oBAAC,iBAAD;AAAmB,IAAA,QAAQ,EAAE8C,QAA7B;AAAuC,mBAAY;AAAnD,KACGrC,cAAc,IAAIqC,QAAlB,gBACC,uDACE,oBAAC,sBAAD;AAAwB,IAAA,IAAI,EAAC;AAA7B,KACGnC,oBAAoB,+BACCgC,WADD,wDAEjBA,WAAW,GAAGlC,cAFG,yCAGYA,cAHZ,kBADvB,CADF,EAOGC,gBAAgB,wCAAiCD,cAAjC,kBAPnB,CADD,GAWC,EAZJ,EAcGA,cAAc,cAAOkC,WAAP,gBAAwBlC,cAAxB,IAA2C,EAd5D,CADF,eAiBE,oBAAC,IAAD,OAjBF,CAjDF,CADF;AAuED;;AAEDd,YAAY,CAAC0D,SAAb,GAAyBC,aAAzB;AACA3D,YAAY,CAAC4D,YAAb,GAA4BC,mBAA5B;IACM1D,sBAAsB,GAAG2D,QAAQ,CAAC9D,YAAD;AACvCG,sBAAsB,CAACuD,SAAvB,GAAmCC,aAAnC;;;;"}
@@ -4,6 +4,7 @@ import { noop } from 'lodash';
4
4
  var defaultComposerPros = {
5
5
  placeholder: 'Type your message',
6
6
  inputValue: '',
7
+ ariaMaxLengthMessage: '',
7
8
  onChange: noop,
8
9
  onResize: noop,
9
10
  onSend: noop,
@@ -20,6 +21,7 @@ var defaultComposerPros = {
20
21
  var composerProps = {
21
22
  placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),
22
23
  inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),
24
+ ariaMaxLengthMessage: PropTypes.string.description('Aria message for Max length message when exceeded').defaultValue(defaultComposerPros.maxLengthMessage),
23
25
  maxLengthMessage: PropTypes.string.description('Max length message').defaultValue(defaultComposerPros.maxLengthMessage),
24
26
  onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),
25
27
  onResize: PropTypes.func.description('Called the input changes his height').defaultValue(defaultComposerPros.onResize),
@@ -1 +1 @@
1
- {"version":3,"file":"props.js","sources":["../../../../src/parts/chat-composer/props.tsx"],"sourcesContent":["import React from 'react';\nimport { PropTypes } from 'react-desc';\nimport { noop } from 'lodash';\n\nexport interface TextAreaProps {\n height: string | number;\n style: React.CSSProperties;\n}\n\nexport const defaultComposerPros: ChatComposerProps = {\n placeholder: 'Type your message',\n inputValue: '',\n onChange: noop,\n onResize: noop,\n onSend: noop,\n onFocus: noop,\n onBlur: noop,\n onKeyDown: noop,\n maxHeight: 0,\n inputMaxLength: undefined,\n maxLengthMessage: undefined,\n buttonDisabled: false,\n dataTestid: 'ds-chat-composer',\n actionRef: noop,\n};\n\nexport interface ChatComposerProps {\n placeholder?: string;\n inputValue?: string;\n maxLengthMessage?: string;\n onChange: (value: string) => void;\n onResize?: (value: number) => void;\n onSend: (value: string) => void;\n onFocus?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onBlur?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onKeyDown?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n maxHeight?: number;\n inputMaxLength: number | undefined;\n buttonDisabled: boolean;\n dataTestid?: string;\n actionRef: PropTypes.func;\n}\n\nexport const composerProps = {\n placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),\n inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),\n maxLengthMessage: PropTypes.string\n .description('Max length message')\n .defaultValue(defaultComposerPros.maxLengthMessage),\n onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),\n onResize: PropTypes.func\n .description('Called the input changes his height')\n .defaultValue(defaultComposerPros.onResize),\n onSend: PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),\n onFocus: PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),\n onBlur: PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),\n onKeyDown: PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),\n maxHeight: PropTypes.number\n .description('Max height of the composer. Use 0 for no limit')\n .defaultValue(defaultComposerPros.onBlur),\n inputMaxLength: PropTypes.number\n .description('Max length of the composer. `undefined` for no limit')\n .defaultValue(defaultComposerPros.inputMaxLength),\n buttonDisabled: PropTypes.bool\n .description('Control the disabled for the send button')\n .defaultValue(defaultComposerPros.buttonDisabled),\n dataTestid: PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),\n actionRef: PropTypes.object\n .description(\n `Reference: \n { \n scrollToIndex: (n: number) => void,\n getMessagesInView: () => number[],\n focusToIndex: (n: number) => void,\n focusToList: () => void,\n focusToComposer: () => void,\n focusToSend: () => void,\n }\n \n `,\n )\n .defaultValue(defaultComposerPros.actionRef),\n};\n"],"names":["defaultComposerPros","placeholder","inputValue","onChange","noop","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","inputMaxLength","undefined","maxLengthMessage","buttonDisabled","dataTestid","actionRef","composerProps","PropTypes","string","description","defaultValue","func","number","bool","object"],"mappings":";;;IASaA,mBAAsC,GAAG;AACpDC,EAAAA,WAAW,EAAE,mBADuC;AAEpDC,EAAAA,UAAU,EAAE,EAFwC;AAGpDC,EAAAA,QAAQ,EAAEC,IAH0C;AAIpDC,EAAAA,QAAQ,EAAED,IAJ0C;AAKpDE,EAAAA,MAAM,EAAEF,IAL4C;AAMpDG,EAAAA,OAAO,EAAEH,IAN2C;AAOpDI,EAAAA,MAAM,EAAEJ,IAP4C;AAQpDK,EAAAA,SAAS,EAAEL,IARyC;AASpDM,EAAAA,SAAS,EAAE,CATyC;AAUpDC,EAAAA,cAAc,EAAEC,SAVoC;AAWpDC,EAAAA,gBAAgB,EAAED,SAXkC;AAYpDE,EAAAA,cAAc,EAAE,KAZoC;A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jF,CAbgB;AAc3BC,EAAAA,SAAS,EAAEQ,SAAS,CAACK,MAAV,CACRH,WADQ,CACI,gDADJ,EAERC,YAFQ,CAEKrB,mBAAmB,CAACQ,MAFzB,CAdgB;AAiB3BG,EAAAA,cAAc,EAAEO,SAAS,CAACK,MAAV,CACbH,WADa,CACD,sDADC,EAEbC,YAFa,CAEArB,mBAAmB,CAACW,cAFpB,CAjBW;AAoB3BG,EAAAA,cAAc,EAAEI,SAAS,CAACM,IAAV,CACbJ,WADa,CACD,0CADC,EAEbC,YAFa,CAEArB,mBAAmB,CAACc,cAFpB,CApBW;AAuB3BC,EAAAA,UAAU,EAAEG,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,aAA7B,EAA4CC,YAA5C,CAAyDrB,mBAAmB,CAACC,WAA7E,CAvBe;AAwB3Be,EAAAA,SAAS,EAAEE,SAAS,CAACO,MAAV,CACRL,WADQ,oTAcRC,YAdQ,CAcKrB,mBAAmB,CAACgB,SAdzB;AAxBgB;;;;"}
1
+ {"version":3,"file":"props.js","sources":["../../../../src/parts/chat-composer/props.tsx"],"sourcesContent":["import React from 'react';\nimport { PropTypes } from 'react-desc';\nimport { noop } from 'lodash';\n\nexport interface TextAreaProps {\n height: string | number;\n style: React.CSSProperties;\n}\n\nexport const defaultComposerPros: ChatComposerProps = {\n placeholder: 'Type your message',\n inputValue: '',\n ariaMaxLengthMessage: '',\n onChange: noop,\n onResize: noop,\n onSend: noop,\n onFocus: noop,\n onBlur: noop,\n onKeyDown: noop,\n maxHeight: 0,\n inputMaxLength: undefined,\n maxLengthMessage: undefined,\n buttonDisabled: false,\n dataTestid: 'ds-chat-composer',\n actionRef: noop,\n};\n\nexport interface ChatComposerProps {\n placeholder?: string;\n inputValue?: string;\n ariaMaxLengthMessage?: string;\n maxLengthMessage?: string;\n onChange: (value: string) => void;\n onResize?: (value: number) => void;\n onSend: (value: string) => void;\n onFocus?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onBlur?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onKeyDown?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n maxHeight?: number;\n inputMaxLength: number | undefined;\n buttonDisabled: boolean;\n dataTestid?: string;\n actionRef: PropTypes.func;\n}\n\nexport const composerProps = {\n placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),\n inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),\n ariaMaxLengthMessage: PropTypes.string\n .description('Aria message for Max length message when exceeded')\n .defaultValue(defaultComposerPros.maxLengthMessage),\n maxLengthMessage: PropTypes.string\n .description('Max length message')\n .defaultValue(defaultComposerPros.maxLengthMessage),\n onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),\n onResize: PropTypes.func\n .description('Called the input changes his height')\n .defaultValue(defaultComposerPros.onResize),\n onSend: PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),\n onFocus: PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),\n onBlur: PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),\n onKeyDown: PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),\n maxHeight: PropTypes.number\n .description('Max height of the composer. Use 0 for no limit')\n .defaultValue(defaultComposerPros.onBlur),\n inputMaxLength: PropTypes.number\n .description('Max length of the composer. `undefined` for no limit')\n .defaultValue(defaultComposerPros.inputMaxLength),\n buttonDisabled: PropTypes.bool\n .description('Control the disabled for the send button')\n .defaultValue(defaultComposerPros.buttonDisabled),\n dataTestid: PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),\n actionRef: PropTypes.object\n .description(\n `Reference: \n { \n scrollToIndex: (n: number) => void,\n getMessagesInView: () => number[],\n focusToIndex: (n: number) => void,\n focusToList: () => void,\n focusToComposer: () => void,\n focusToSend: () => void,\n }\n \n `,\n )\n .defaultValue(defaultComposerPros.actionRef),\n};\n"],"names":["defaultComposerPros","placeholder","inputValue","ariaMaxLengthMessage","onChange","noop","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","inputMaxLength","undefined","maxLengthMessage","buttonDisabled","dataTestid","actionRef","composerProps","PropTypes","string","description","defaultValue","func","number","bool","object"],"mappings":";;;IASaA,mBAAsC,GAAG;AACpDC,EAAAA,WAAW,EAAE,mBADuC;AAEpDC,EAAAA,UAAU,EAAE,EAFwC;AAGpDC,EAAAA,oBAAoB,EAAE,EAH8B;AAIpDC,EAAAA,QAAQ,EAAEC,IAJ0C;AAKpDC,EAAAA,QAAQ,EAAED,IAL0C;AAMpDE,EAAAA,MAAM,EAAEF,IAN4C;AAOpDG,EAAAA,OAAO,EAAEH,IAP2C;AAQpDI,EAAAA,MAAM,EAAEJ,IAR4C;AASpDK,EAAAA,SAAS,EAAEL,IATyC;AAUpDM,EAAAA,SAAS,EAAE,CAVyC;AAWpDC,EAAAA,cAAc,EAAEC,SAXoC;AAYpDC,EAAAA,gBAAgB,EAAED,SAZkC;AAapDE,EAAAA,cAAc,EAAE,KAboC;AAcpDC,EAAAA,UAAU,EAAE,kBAdwC;AAepDC,EAAAA,SAAS,EAAEZ;AAfyC;IAoCzCa,aAAa,GAAG;AAC3BjB,EAAAA,WAAW,EAAEkB,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,mBAA7B,EAAkDC,YAAlD,CAA+DtB,mBAAmB,CAACC,WAAnF,CADc;AAE3BC,EAAAA,UAAU,EAAEiB,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,aAA7B,EAA4CC,YAA5C,CAAyDtB,mBAAmB,CAACE,UAA7E,CAFe;AAG3BC,EAAAA,oBAAoB,EAAEgB,SAAS,CAACC,MAAV,CACnBC,WADmB,CACP,mDADO,EAEnBC,YAFmB,CAENtB,mBAAmB,CAACc,gBAFd,CAHK;AAM3BA,EAAAA,gBAAgB,EAAEK,SAAS,CAACC,MAAV,CACfC,WADe,CACH,oBADG,EAEfC,YAFe,CAE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AA6B,aAA7B,EAA4CC,YAA5C,CAAyDtB,mBAAmB,CAACC,WAA7E,CA1Be;AA2B3BgB,EAAAA,SAAS,EAAEE,SAAS,CAACO,MAAV,CACRL,WADQ,oTAcRC,YAdQ,CAcKtB,mBAAmB,CAACiB,SAdzB;AA3BgB;;;;"}
@@ -37,9 +37,10 @@ import '../system-message/config/useValidateProps.js';
37
37
  import '../chat-container-messages-list/styled.js';
38
38
  import '../chat-container-messages-list/props.js';
39
39
  import '../chat-container-messages-list/config/useValidateProps.js';
40
+ import '../chat-container-messages-list/useGetNewMessages.js';
40
41
 
41
42
  var ChatContainer = function ChatContainer(props) {
42
- var _containerRef$current;
43
+ var _messagesListProps$me2, _containerRef$current;
43
44
 
44
45
  useValidateProps(props, ChatContainerWithSchema.toTypescript());
45
46
  var sendingText = props.sendingText,
@@ -84,7 +85,9 @@ var ChatContainer = function ChatContainer(props) {
84
85
  var ref = actionRef || listRef;
85
86
 
86
87
  if (e.shiftKey && e.key === 'Tab') {
87
- if (messagesListProps.messages.length > 0) {
88
+ var _messagesListProps$me;
89
+
90
+ if (((_messagesListProps$me = messagesListProps.messages) === null || _messagesListProps$me === void 0 ? void 0 : _messagesListProps$me.length) > 0) {
88
91
  e.preventDefault();
89
92
 
90
93
  if (['top', 'bottom'].includes(bannerPosition)) {
@@ -98,7 +101,7 @@ var ChatContainer = function ChatContainer(props) {
98
101
  }
99
102
  }
100
103
  }
101
- }, [actionRef, onComposerKeyDown, bannerPosition, messagesListProps.messages.length]); // Map actions
104
+ }, [actionRef, onComposerKeyDown, bannerPosition, (_messagesListProps$me2 = messagesListProps.messages) === null || _messagesListProps$me2 === void 0 ? void 0 : _messagesListProps$me2.length]); // Map actions
102
105
 
103
106
  React.useEffect(function () {
104
107
  if (actionRef && actionRef.current) {
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContainer.js","sources":["../../../../src/parts/chat-container/ChatContainer.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React from 'react';\nimport { noop } from 'lodash';\nimport { describe } from 'react-desc';\nimport DSIndeterminateProgressIndicator from '@elliemae/ds-indeterminate-progress-indicator';\nimport DSBanner, { BANNER_TYPES } from '@elliemae/ds-banner';\nimport { ChatComposer } from '../chat-composer';\nimport { ChatContainerMessagesList } from '../chat-container-messages-list';\nimport { ChatContainerProps, defaultProps, containerProps } from './props';\nimport { StyledChatContainerContent, StyledIndicatorContainer, MobileStyledChatContainerContent } from './styled';\nimport { useValidateProps } from './config/useValidateProps';\n\nconst ChatContainer = (props: ChatContainerProps): JSX.Element => {\n useValidateProps(props, ChatContainerWithSchema.toTypescript());\n\n const {\n sendingText,\n sendingMessages,\n bannerPosition,\n bannerProps,\n messagesListProps,\n composerProps,\n composerProps: { onResize: onComposerResize, onKeyDown: onComposerKeyDown },\n actionRef,\n device,\n isLoading,\n hasMoreItems,\n getMoreMessages,\n ariaLabel,\n } = props;\n const bannerRef = React.useRef({ focusOnWrapper: noop, focusOnLink: noop });\n const containerRef = React.useRef<HTMLElement>();\n const listRef = React.useRef({ scrollToIndex: noop });\n const onResize = React.useCallback(\n (height: number) => {\n if (onComposerResize) onComposerResize(height);\n /*\n setTimeout is used to equal the animation duration from the \n composer text area when increase its size\n */\n setTimeout(() => {\n actionRef.current.scrollToIndex(messagesListProps.messages.length - 1, {\n align: 'start',\n });\n }, 50);\n },\n [onComposerResize, messagesListProps.messages, actionRef],\n );\n const Container = device === 'desktop' ? StyledChatContainerContent : MobileStyledChatContainerContent;\n const handleTabs = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (onComposerKeyDown) onComposerKeyDown(e);\n else {\n const ref = actionRef || listRef;\n if (e.shiftKey && e.key === 'Tab') {\n if (messagesListProps.messages.length > 0) {\n e.preventDefault();\n if (['top', 'bottom'].includes(bannerPosition)) {\n bannerRef.current.focusOnWrapper();\n } else {\n const last = ref.current.getMessagesInView().pop();\n ref.current?.focusToIndexWithoutScroll(last);\n }\n }\n }\n }\n },\n [actionRef, onComposerKeyDown, bannerPosition, messagesListProps.messages.length],\n );\n\n // Map actions\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusOnBanner = bannerRef.current.focusOnWrapper;\n actionRef.current.focusOnBannerLink = bannerRef.current.focusOnLink;\n }\n }, [actionRef]);\n\n return (\n <Container rows={['minmax(0, 1fr)', 'auto']} ref={containerRef} role=\"region\" aria-label={ariaLabel}>\n <div style={{ position: 'relative', overflow: 'hidden' }}>\n <ChatContainerMessagesList\n {...messagesListProps}\n actionRef={actionRef || listRef}\n isLoading={isLoading}\n hasMoreItems={hasMoreItems}\n getMoreMessages={getMoreMessages}\n sendingMessages={sendingMessages}\n sendingText={sendingText}\n bannerPosition={bannerPosition}\n bannerRef={bannerRef}\n />\n {['top', 'bottom'].includes(isLoading) ? (\n <StyledIndicatorContainer isLoading={isLoading} data-testid=\"ds-chat-loading-indicator\">\n <DSIndeterminateProgressIndicator processing title=\"Loading\" />\n </StyledIndicatorContainer>\n ) : null}\n <StyledIndicatorContainer linear isLoading={bannerPosition}>\n <DSBanner\n showCloseButton\n label={bannerProps.label || 'Unread messages'}\n containerProps={{ id: 'ds-chat-banner' }}\n actionLink={{\n label: bannerProps.viewLabel || 'View',\n onClick: bannerProps.onView,\n }}\n onClose={bannerProps.onClose}\n isOpen\n type={bannerProps.type || BANNER_TYPES.INFO}\n actionRef={bannerRef}\n />\n </StyledIndicatorContainer>\n {sendingMessages && sendingMessages.length > 0 ? (\n <StyledIndicatorContainer isLoading=\"bottom\" linear data-testid=\"ds-chat-loading-indicator\">\n <DSIndeterminateProgressIndicator processing title={sendingText} lineOnly />\n </StyledIndicatorContainer>\n ) : null}\n </div>\n <ChatComposer\n {...composerProps}\n onKeyDown={handleTabs}\n onResize={onResize}\n maxHeight={(containerRef.current?.clientHeight || 0) / 2}\n actionRef={actionRef || listRef}\n />\n </Container>\n );\n};\n\nChatContainer.propTypes = containerProps;\nChatContainer.defaultProps = defaultProps;\nconst ChatContainerWithSchema = describe(ChatContainer);\nChatContainerWithSchema.propTypes = containerProps;\n\nexport { ChatContainer, ChatContainerWithSchema };\n"],"names":["ChatContainer","props","useValidateProps","ChatContainerWithSchema","toTypescript","sendingText","sendingMessages","bannerPosition","bannerProps","messagesListProps","composerProps","onComposerResize","onResize","onComposerKeyDown","onKeyDown","actionRef","device","isLoading","hasMoreItems","getMoreMessages","ariaLabel","bannerRef","React","useRef","focusOnWrapper","noop","focusOnLink","containerRef","listRef","scrollToIndex","useCallback","height","setTimeout","current","messages","length","align","Container","StyledChatContainerContent","MobileStyledChatContainerContent","handleTabs","e","ref","shiftKey","key","preventDefault","includes","last","getMessagesInView","pop","focusToIndexWithoutScroll","useEffect","focusOnBanner","focusOnBannerLink","position","overflow","label","id","viewLabel","onClick","onView","onClose","type","BANNER_TYPES","INFO","clientHeight","propTypes","containerProps","defaultProps","describe"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAA4C;AAAA;;AAChEC,EAAAA,gBAAgB,CAACD,KAAD,EAAQE,uBAAuB,CAACC,YAAxB,EAAR,CAAhB;AAEA,MACEC,WADF,GAcIJ,KAdJ,CACEI,WADF;AAAA,MAEEC,eAFF,GAcIL,KAdJ,CAEEK,eAFF;AAAA,MAGEC,cAHF,GAcIN,KAdJ,CAGEM,cAHF;AAAA,MAIEC,WAJF,GAcIP,KAdJ,CAIEO,WAJF;AAAA,MAKEC,iBALF,GAcIR,KAdJ,CAKEQ,iBALF;AAAA,MAMEC,aANF,GAcIT,KAdJ,CAMES,aANF;AAAA,6BAcIT,KAdJ,CAOES,aAPF;AAAA,MAO6BC,gBAP7B,wBAOmBC,QAPnB;AAAA,MAO0DC,iBAP1D,wBAO+CC,SAP/C;AAAA,MAQEC,SARF,GAcId,KAdJ,CAQEc,SARF;AAAA,MASEC,MATF,GAcIf,KAdJ,CASEe,MATF;AAAA,MAUEC,SAVF,GAcIhB,KAdJ,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BAAY;AAAhE,kBACE,oBAAC,gCAAD;AAAkC,IAAA,UAAU,MAA5C;AAA6C,IAAA,KAAK,EAAE9B,WAApD;AAAiE,IAAA,QAAQ;AAAzE,IADF,CADD,GAIG,IApCN,CADF,eAuCE,oBAAC,YAAD,eACMK,aADN;AAEE,IAAA,SAAS,EAAE8B,UAFb;AAGE,IAAA,QAAQ,EAAE5B,QAHZ;AAIE,IAAA,SAAS,EAAE,CAAC,0BAAAe,YAAY,CAACM,OAAb,gFAAsBgC,YAAtB,KAAsC,CAAvC,IAA4C,CAJzD;AAKE,IAAA,SAAS,EAAElD,SAAS,IAAIa;AAL1B,KAvCF,CADF;AAiDD;;AAED5B,aAAa,CAACkE,SAAd,GAA0BC,cAA1B;AACAnE,aAAa,CAACoE,YAAd,GAA6BA,YAA7B;IACMjE,uBAAuB,GAAGkE,QAAQ,CAACrE,aAAD;AACxCG,uBAAuB,CAAC+D,SAAxB,GAAoCC,cAApC;;;;"}
1
+ {"version":3,"file":"ChatContainer.js","sources":["../../../../src/parts/chat-container/ChatContainer.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React from 'react';\nimport { noop } from 'lodash';\nimport { describe } from 'react-desc';\nimport DSIndeterminateProgressIndicator from '@elliemae/ds-indeterminate-progress-indicator';\nimport DSBanner, { BANNER_TYPES } from '@elliemae/ds-banner';\nimport { ChatComposer } from '../chat-composer';\nimport { ChatContainerMessagesList } from '../chat-container-messages-list';\nimport { ChatContainerProps, defaultProps, containerProps } from './props';\nimport { StyledChatContainerContent, StyledIndicatorContainer, MobileStyledChatContainerContent } from './styled';\nimport { useValidateProps } from './config/useValidateProps';\n\nconst ChatContainer = (props: ChatContainerProps): JSX.Element => {\n useValidateProps(props, ChatContainerWithSchema.toTypescript());\n\n const {\n sendingText,\n sendingMessages,\n bannerPosition,\n bannerProps,\n messagesListProps,\n composerProps,\n composerProps: { onResize: onComposerResize, onKeyDown: onComposerKeyDown },\n actionRef,\n device,\n isLoading,\n hasMoreItems,\n getMoreMessages,\n ariaLabel,\n } = props;\n const bannerRef = React.useRef({ focusOnWrapper: noop, focusOnLink: noop });\n const containerRef = React.useRef<HTMLElement>();\n const listRef = React.useRef({ scrollToIndex: noop });\n\n const onResize = React.useCallback(\n (height: number) => {\n if (onComposerResize) onComposerResize(height);\n /*\n setTimeout is used to equal the animation duration from the \n composer text area when increase its size\n */\n setTimeout(() => {\n actionRef.current.scrollToIndex(messagesListProps.messages.length - 1, {\n align: 'start',\n });\n }, 50);\n },\n [onComposerResize, messagesListProps.messages, actionRef],\n );\n const Container = device === 'desktop' ? StyledChatContainerContent : MobileStyledChatContainerContent;\n const handleTabs = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (onComposerKeyDown) onComposerKeyDown(e);\n else {\n const ref = actionRef || listRef;\n if (e.shiftKey && e.key === 'Tab') {\n if (messagesListProps.messages?.length > 0) {\n e.preventDefault();\n if (['top', 'bottom'].includes(bannerPosition)) {\n bannerRef.current.focusOnWrapper();\n } else {\n const last = ref.current.getMessagesInView().pop();\n ref.current?.focusToIndexWithoutScroll(last);\n }\n }\n }\n }\n },\n [actionRef, onComposerKeyDown, bannerPosition, messagesListProps.messages?.length],\n );\n\n // Map actions\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusOnBanner = bannerRef.current.focusOnWrapper;\n actionRef.current.focusOnBannerLink = bannerRef.current.focusOnLink;\n }\n }, [actionRef]);\n\n return (\n <Container rows={['minmax(0, 1fr)', 'auto']} ref={containerRef} role=\"region\" aria-label={ariaLabel}>\n <div style={{ position: 'relative', overflow: 'hidden' }}>\n <ChatContainerMessagesList\n {...messagesListProps}\n actionRef={actionRef || listRef}\n isLoading={isLoading}\n hasMoreItems={hasMoreItems}\n getMoreMessages={getMoreMessages}\n sendingMessages={sendingMessages}\n sendingText={sendingText}\n bannerPosition={bannerPosition}\n bannerRef={bannerRef}\n />\n {['top', 'bottom'].includes(isLoading) ? (\n <StyledIndicatorContainer isLoading={isLoading} data-testid=\"ds-chat-loading-indicator\">\n <DSIndeterminateProgressIndicator processing title=\"Loading\" />\n </StyledIndicatorContainer>\n ) : null}\n <StyledIndicatorContainer linear isLoading={bannerPosition}>\n <DSBanner\n showCloseButton\n label={bannerProps.label || 'Unread messages'}\n containerProps={{ id: 'ds-chat-banner' }}\n actionLink={{\n label: bannerProps.viewLabel || 'View',\n onClick: bannerProps.onView,\n }}\n onClose={bannerProps.onClose}\n isOpen\n type={bannerProps.type || BANNER_TYPES.INFO}\n actionRef={bannerRef}\n />\n </StyledIndicatorContainer>\n {sendingMessages && sendingMessages.length > 0 ? (\n <StyledIndicatorContainer isLoading=\"bottom\" linear data-testid=\"ds-chat-loading-indicator\">\n <DSIndeterminateProgressIndicator processing title={sendingText} lineOnly />\n </StyledIndicatorContainer>\n ) : null}\n </div>\n <ChatComposer\n {...composerProps}\n onKeyDown={handleTabs}\n onResize={onResize}\n maxHeight={(containerRef.current?.clientHeight || 0) / 2}\n actionRef={actionRef || listRef}\n />\n </Container>\n );\n};\n\nChatContainer.propTypes = containerProps;\nChatContainer.defaultProps = defaultProps;\nconst ChatContainerWithSchema = describe(ChatContainer);\nChatContainerWithSchema.propTypes = containerProps;\n\nexport { ChatContainer, ChatContainerWithSchema };\n"],"names":["ChatContainer","props","useValidateProps","ChatContainerWithSchema","toTypescript","sendingText","sendingMessages","bannerPosition","bannerProps","messagesListProps","composerProps","onComposerResize","onResize","onComposerKeyDown","onKeyDown","actionRef","device","isLoading","hasMoreItems","getMoreMessages","ariaLabel","bannerRef","React","useRef","focusOnWrapper","noop","focusOnLink","containerRef","listRef","scrollToIndex","useCallback","height","setTimeout","current","messages","length","align","Container","StyledChatContainerContent","MobileStyledChatContainerContent","handleTabs","e","ref","shiftKey","key","preventDefault","includes","last","getMessagesInView","pop","focusToIndexWithoutScroll","useEffect","focusOnBanner","focusOnBannerLink","position","overflow","label","id","viewLabel","onClick","onView","onClose","type","BANNER_TYPES","INFO","clientHeight","propTypes","containerProps","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AA6BA,YAA7B;IACMjE,uBAAuB,GAAGkE,QAAQ,CAACrE,aAAD;AACxCG,uBAAuB,CAAC+D,SAAxB,GAAoCC,cAApC;;;;"}
@@ -35,6 +35,7 @@ import '../system-message/config/useValidateProps.js';
35
35
  import '../chat-container-messages-list/styled.js';
36
36
  import '../chat-container-messages-list/props.js';
37
37
  import '../chat-container-messages-list/config/useValidateProps.js';
38
+ import '../chat-container-messages-list/useGetNewMessages.js';
38
39
  import './props.js';
39
40
  import './styled.js';
40
41
  import './config/useValidateProps.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -9,9 +9,10 @@ import { ChatBubble } from '../bubble/ChatBubble.js';
9
9
  import { BUBBLE_TYPES } from '../bubble/props.js';
10
10
  import { MessageDelimiter } from '../message-delimiter/MessageDelimiter.js';
11
11
  import { SystemMessage } from '../system-message/SystemMessage.js';
12
- import { ListItem, StyledWrapperListItem, StyledWrapper, StyledChatContainerContentList, StyledChatContainerContentListScroll, StyledLoadMoreContainer } from './styled.js';
12
+ import { ListItem, StyledWrapperListItem, StyledWrapper, StyledChatContainerContentList, StyledChatContainerContentListScroll, StyledLoadMoreContainer, StyledNewMessagesHiddenContainer } from './styled.js';
13
13
  import { listProps, defaultProps } from './props.js';
14
14
  import { useValidateProps } from './config/useValidateProps.js';
15
+ import { useGetNewMessages } from './useGetNewMessages.js';
15
16
  import '@elliemae/ds-icons';
16
17
  import '../bubble/styled.js';
17
18
  import 'styled-components';
@@ -26,10 +27,11 @@ import '../message-delimiter/config/useValidateProps.js';
26
27
  import '../system-message/style.js';
27
28
  import '../system-message/props.js';
28
29
  import '../system-message/config/useValidateProps.js';
30
+ import '@babel/runtime/helpers/esm/slicedToArray';
29
31
 
30
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
32
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
33
 
32
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
34
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
35
 
34
36
  var getPadding = function getPadding(_ref) {
35
37
  var hasMoreItems = _ref.hasMoreItems,
@@ -81,6 +83,7 @@ var ChatContainerMessagesList = function ChatContainerMessagesList(props) {
81
83
  totalSize = _useVirtual.totalSize,
82
84
  virtualItems = _useVirtual.virtualItems;
83
85
 
86
+ var newMessages = useGetNewMessages(messages);
84
87
  var debouncedScroll = React.useMemo(function () {
85
88
  return debounce(function () {
86
89
  var _virtualListRef$curre2;
@@ -135,6 +138,7 @@ var ChatContainerMessagesList = function ChatContainerMessagesList(props) {
135
138
  };
136
139
 
137
140
  actionRef.current.getMessagesInView = onScrollStop;
141
+ onScrollStop(); // init useMemo due to debounce use.
138
142
 
139
143
  actionRef.current.focusToIndex = function (a) {
140
144
  var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
@@ -217,7 +221,7 @@ var ChatContainerMessagesList = function ChatContainerMessagesList(props) {
217
221
 
218
222
  break;
219
223
  }
220
- }, [actionRef, bannerRef, hasMoreItems, messages.length, bannerPosition, scrollAndFocus]);
224
+ }, [bannerRef, hasMoreItems, messages.length, bannerPosition, scrollAndFocus]);
221
225
  var handleListKey = React.useCallback(function (e) {
222
226
  var key = e.key;
223
227
 
@@ -337,8 +341,6 @@ var ChatContainerMessagesList = function ChatContainerMessagesList(props) {
337
341
  return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(StyledChatContainerContentList, {
338
342
  "data-testid": "chat-thread-container",
339
343
  tabIndex: 0,
340
- "aria-live": "polite",
341
- "aria-relevant": "additions",
342
344
  ref: virtualListRef,
343
345
  role: "list",
344
346
  onKeyDown: handleListKey
@@ -352,7 +354,12 @@ var ChatContainerMessagesList = function ChatContainerMessagesList(props) {
352
354
  onClick: getMoreMessages,
353
355
  "data-testid": "ds-chat-load-more-btn",
354
356
  innerRef: loadMoreRef
355
- })) : null, render)));
357
+ })) : null, render)), /*#__PURE__*/React.createElement(StyledNewMessagesHiddenContainer, {
358
+ "aria-live": "polite",
359
+ "aria-hidden": "false"
360
+ }, newMessages.map(function (newMessage) {
361
+ return /*#__PURE__*/React.createElement("p", null, newMessage.title, " ", newMessage.time, " ", newMessage.body, " ", newMessage.errorMessage, " ", newMessage.helpMessage);
362
+ })));
356
363
  };
357
364
 
358
365
  ChatContainerMessagesList.propTypes = listProps;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContainerMessagesList.js","sources":["../../../../src/parts/chat-container-messages-list/ChatContainerMessagesList.tsx"],"sourcesContent":["/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport React, { CSSProperties } from 'react';\nimport { describe } from 'react-desc';\nimport { useVirtual } from 'react-virtual';\nimport DSButton from '@elliemae/ds-button';\nimport { debounce } from 'lodash';\nimport { ChatBubble, BUBBLE_TYPES } from '../bubble';\nimport { MessageDelimiter } from '../message-delimiter';\nimport { SystemMessage } from '../system-message';\nimport {\n StyledWrapperListItem,\n StyledChatContainerContentList,\n StyledChatContainerContentListScroll,\n StyledWrapper,\n StyledLoadMoreContainer,\n ListItem,\n} from './styled';\nimport { defaultProps, listProps, ChatContainerMessagesListProps } from './props';\nimport { useValidateProps } from './config/useValidateProps';\n\ntype getPaddingT = {\n hasMoreItems: string | undefined;\n bannerPosition: string | undefined;\n isLoading: string | undefined;\n};\nconst getPadding = ({ hasMoreItems, bannerPosition, isLoading }: 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\nconst ChatContainerMessagesList = (props: ChatContainerMessagesListProps): JSX.Element => {\n useValidateProps(props, ChatContainerMessagesListWithSchema.toTypescript());\n\n const {\n sendingText,\n bannerPosition,\n sendingMessages,\n messages,\n actionRef,\n onScrollEnds,\n getMoreMessages,\n hasMoreItems,\n isLoading,\n bannerRef,\n } = props;\n const pendingOnScroll = React.useRef(false);\n const loadMoreRef = React.useRef(null);\n const virtualListRef = React.useRef<HTMLDivElement>();\n // estimateSize should not be really required given what was stated on\n // https://github.com/tannerlinsley/react-virtual/issues/23\n const {\n scrollToIndex: vScroll,\n totalSize,\n virtualItems,\n } = useVirtual({\n size: messages.length,\n parentRef: virtualListRef,\n overscan: 15,\n ...getPadding({ hasMoreItems, bannerPosition, isLoading }),\n estimateSize: React.useCallback(() => 80, []),\n });\n\n const debouncedScroll = React.useMemo(\n () =>\n debounce((): number[] => {\n if (document.visibilityState === 'hidden') {\n pendingOnScroll.current = true;\n return [];\n }\n if (!virtualListRef.current) return [];\n pendingOnScroll.current = false;\n const { bottom, top } = virtualListRef.current?.getBoundingClientRect();\n const list = virtualListRef.current.querySelectorAll(\n '[data-element=\"chat-element-list-item\"]',\n ) as NodeListOf<HTMLDivElement>;\n const indexList = [];\n list.forEach((item: HTMLDivElement) => {\n const { top: itemTop } = item.getBoundingClientRect();\n const itemPadding = 10;\n if (itemTop + itemPadding < bottom && itemTop + itemPadding > top) indexList.push(item.dataset.index);\n });\n if (onScrollEnds) onScrollEnds(indexList);\n return indexList;\n }, 500),\n [onScrollEnds],\n );\n\n const onScrollStop = React.useCallback(debouncedScroll, [debouncedScroll]);\n\n const onlyFocus = React.useCallback((index: number) => {\n setTimeout(() => {\n (virtualListRef.current.querySelector(`[data-index=\"${index}\"]`) as HTMLDivElement).focus();\n }, 300);\n }, []);\n\n const scrollAndFocus = React.useCallback(\n (index: number, b = { align: 'center' }) => {\n vScroll(index, b);\n onlyFocus(index);\n onScrollStop();\n },\n [onScrollStop, onlyFocus, vScroll],\n );\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.scrollToIndex = (a, b = { align: 'center' }) => {\n vScroll(a, b as any);\n onScrollStop();\n };\n actionRef.current.getMessagesInView = onScrollStop;\n actionRef.current.focusToIndex = (a, b = { align: 'center' } as ScrollToOptions) => {\n scrollAndFocus(a, b);\n };\n actionRef.current.focusToIndexWithoutScroll = onlyFocus;\n actionRef.current.focusToList = () => {\n virtualListRef.current?.focus();\n };\n }\n }, [actionRef, onScrollStop, onlyFocus, scrollAndFocus, vScroll]);\n\n const handleKey = React.useCallback(\n (e: React.KeyboardEvent) => {\n const { key } = e;\n const index = Number(e.currentTarget.dataset.index);\n e.stopPropagation();\n switch (key) {\n case 'ArrowUp':\n e.preventDefault();\n if (index > 0) {\n (virtualListRef.current?.querySelector(`[data-index=\"${index - 1}\"]`) as HTMLDivElement).focus();\n } else if (hasMoreItems === 'top') {\n loadMoreRef.current?.focus();\n }\n break;\n case 'ArrowDown':\n e.preventDefault();\n if (index < messages.length - 1) {\n (virtualListRef.current.querySelector(`[data-index=\"${index + 1}\"]`) as HTMLDivElement).focus();\n }\n break;\n case 'Home':\n e.preventDefault();\n scrollAndFocus(0);\n break;\n case 'End':\n e.preventDefault();\n scrollAndFocus(messages.length - 1);\n break;\n case 'Tab':\n if (hasMoreItems === 'bottom' && !e.shiftKey) {\n e.preventDefault();\n loadMoreRef.current?.focus();\n } else if (hasMoreItems === 'top' && e.shiftKey) {\n e.preventDefault();\n loadMoreRef.current?.focus();\n } else if (!e.shiftKey) {\n if (bannerPosition) {\n e.preventDefault();\n bannerRef.current.focusOnWrapper();\n }\n } else {\n e.preventDefault();\n virtualListRef.current?.focus();\n }\n break;\n default:\n break;\n }\n },\n [actionRef, bannerRef, hasMoreItems, messages.length, bannerPosition, scrollAndFocus],\n );\n const handleListKey = React.useCallback(\n (e: React.KeyboardEvent) => {\n const { key } = e;\n switch (key) {\n case 'ArrowUp':\n e.preventDefault();\n if (document.activeElement !== loadMoreRef.current) {\n onlyFocus(onScrollStop().shift());\n }\n break;\n case 'ArrowDown':\n e.preventDefault();\n if (document.activeElement === loadMoreRef.current) {\n (virtualListRef.current.querySelector(`[data-index=\"0\"]`) as HTMLDivElement).focus();\n } else {\n onlyFocus(onScrollStop().pop());\n }\n break;\n case 'Home':\n e.preventDefault();\n scrollAndFocus(0);\n break;\n case 'End':\n e.preventDefault();\n scrollAndFocus(messages.length - 1);\n break;\n case 'Tab':\n if (document.activeElement !== loadMoreRef.current) {\n if (hasMoreItems === 'bottom' && !e.shiftKey) {\n e.preventDefault();\n loadMoreRef.current?.focus();\n } else if (hasMoreItems === 'top' && e.shiftKey) {\n // e.preventDefault();\n // loadMoreRef.current?.focus();\n } else if (!e.shiftKey) {\n e.preventDefault();\n actionRef.current.focusToComposer();\n }\n } else if (!e.shiftKey) {\n e.preventDefault();\n actionRef.current.focusToComposer();\n } else {\n e.preventDefault();\n virtualListRef.current?.focus();\n }\n break;\n default:\n break;\n }\n },\n [actionRef, hasMoreItems, messages.length, onScrollStop, onlyFocus, scrollAndFocus],\n );\n\n const checkPendingOnScroll = React.useCallback(() => {\n if (pendingOnScroll.current === true) onScrollStop();\n }, [onScrollStop]);\n\n React.useEffect(() => {\n let handlerCallback = null;\n const localVirtualRef = virtualListRef.current;\n const onScroll = () => {\n if (handlerCallback) clearTimeout(handlerCallback);\n handlerCallback = setTimeout(onScrollStop, 300);\n };\n if (onScrollEnds) {\n virtualListRef.current.addEventListener('scroll', onScroll);\n }\n document.addEventListener('visibilitychange', checkPendingOnScroll);\n return () => {\n if (handlerCallback) clearTimeout(handlerCallback);\n if (onScrollEnds) localVirtualRef.removeEventListener('scroll', onScroll);\n document.removeEventListener('visibilitychange', checkPendingOnScroll);\n };\n }, [onScrollStop, onScrollEnds, checkPendingOnScroll]);\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 // eslint-disable-next-line\n <ChatBubble {...(row as any)} helpMessage={isSending ? sendingText : row.helpMessage} />\n ) : null}\n {row.type === BUBBLE_TYPES.DELIMITER ? <MessageDelimiter {...(row as any)} /> : null}\n {row.type === BUBBLE_TYPES.SYSTEM ? <SystemMessage {...(row as any)} /> : null}\n </StyledWrapperListItem>\n </ListItem>\n );\n }),\n [virtualItems, messages, sendingMessages, handleKey, sendingText],\n );\n\n return (\n <StyledWrapper>\n <StyledChatContainerContentList\n data-testid=\"chat-thread-container\"\n tabIndex={0}\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n ref={virtualListRef}\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=\"ds-chat-load-more-btn\"\n innerRef={loadMoreRef}\n />\n </StyledLoadMoreContainer>\n ) : null}\n {render}\n </StyledChatContainerContentListScroll>\n </StyledChatContainerContentList>\n </StyledWrapper>\n );\n};\n\nChatContainerMessagesList.propTypes = listProps;\nChatContainerMessagesList.defaultProps = defaultProps;\nconst ChatContainerMessagesListWithSchema = describe(ChatContainerMessagesList);\nChatContainerMessagesListWithSchema.propTypes = listProps;\n\nexport { ChatContainerMessagesList, ChatContainerMessagesListWithSchema };\n"],"names":["getPadding","hasMoreItems","bannerPosition","isLoading","padding","paddingStart","paddingEnd","some","item","ChatContainerMessagesList","props","useValidateProps","ChatContainerMessagesListWithSchema","toTypescript","sendingText","sendingMessages","messages","actionRef","onScrollEnds","getMoreMessages","bannerRef","pendingOnScroll","React","useRef","loadMoreRef","virtualListRef","useVirtual","size","length","parentRef","overscan","estimateSize","useCallback","vScroll","scrollToIndex","totalSize","virtualItems","debouncedScroll","useMemo","debounce","document","visibilityState","current","getBoundingClientRect","bottom","top","list","querySelectorAll","indexList","forEach","itemTop","itemPadding","push","dataset","index","onScrollStop","onlyFocus","setTimeout","querySelector","focus","scrollAndFocus","b","align","useEffect","a","getMessagesInView","focusToIndex","focusToIndexWithoutScroll","focusToList","handleKey","e","key","Number","currentTarget","stopPropagation","preventDefault","shiftKey","focusOnWrapper","handleListKey","activeElement","shift","pop","focusToComposer","checkPendingOnScroll","handlerCallback","localVirtualRef","onScroll","clearTimeout","addEventListener","removeEventListener","render","map","virtualItem","measureRef","start","row","isSending","find","m","dsId","style","position","left","transform","width","type","BUBBLE_TYPES","SENDER","RECIPIENT","helpMessage","DELIMITER","SYSTEM","propTypes","listProps","defaultProps","describe"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAMA,UAAU,GAAG,SAAbA,UAAa,OAA8D;AAAA,MAA3DC,YAA2D,QAA3DA,YAA2D;AAAA,MAA7CC,cAA6C,QAA7CA,cAA6C;AAAA,MAA7BC,SAA6B,QAA7BA,SAA6B;AAC/E,MAAMC,OAAO,GAAG;AACdC,IAAAA,YAAY,EAAE,CADA;AAEdC,IAAAA,UAAU,EAAE,CAAC;AAFC,GAAhB;AAIA,MAAI,CAACL,YAAD,EAAeC,cAAf,EAA+BC,SAA/B,EAA0CI,IAA1C,CAA+C,UAACC,IAAD;AAAA,WAAUA,IAAI,KAAK,KAAnB;AAAA,GAA/C,CAAJ,EAA8EJ,OAAO,CAACC,YAAR,GAAuB,EAAvB,CAA9E,KACK,IAAI,CAACJ,YAAD,EAAeC,cAAf,EAA+BC,SAA/B,EAA0CI,IAA1C,CAA+C,UAACC,IAAD;AAAA,WAAUA,IAAI,KAAK,QAAnB;AAAA,GAA/C,CAAJ,EAAiFJ,OAAO,CAACE,UAAR,GAAqB,EAArB;AACtF,SAAOF,OAAP;AACD,CARD;;IAUMK,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,KAAD,EAAwD;AACxFC,EAAAA,gBAAgB,CAACD,KAAD,EAAQE,mCAAmC,CAACC,YAApC,EAAR,CAAhB;AAEA,MACEC,WADF,GAWIJ,KAXJ,CACEI,WADF;AAAA,MAEEZ,cAFF,GAWIQ,KAXJ,CAEER,cAFF;AAAA,MAGEa,eAHF,GAWIL,KAXJ,CAGEK,eAHF;AAAA,MAIEC,QAJF,GAWI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oBAAC,aAAD,qBACE,oBAAC,8BAAD;AACE,mBAAY,uBADd;AAEE,IAAA,QAAQ,EAAE,CAFZ;AAGE,iBAAU,QAHZ;AAIE,qBAAc,WAJhB;AAKE,IAAA,GAAG,EAAEW,cALP;AAME,IAAA,IAAI,EAAC,MANP;AAOE,IAAA,SAAS,EAAEqD;AAPb,kBASE,oBAAC,oCAAD;AAAsC,IAAA,MAAM,YAAK3C,SAAL;AAA5C,KACG,CAAChC,SAAD,IAAcF,YAAd,gBACC,oBAAC,uBAAD;AAAyB,IAAA,YAAY,EAAEA;AAAvC,kBACE,oBAAC,QAAD;AACE,IAAA,SAAS,EAAC,WADZ;AAEE,IAAA,UAAU,EAAC,WAFb;AAGE,IAAA,OAAO,EAAEkB,eAHX;AAIE,mBAAY,uBAJd;AAKE,IAAA,QAAQ,EAAEK;AALZ,IADF,CADD,GAUG,IAXN,EAYGkE,MAZH,CATF,CADF,CADF;AA4BD;;AAEDjF,yBAAyB,CAACuG,SAA1B,GAAsCC,SAAtC;AACAxG,yBAAyB,CAACyG,YAA1B,GAAyCA,YAAzC;IACMtG,mCAAmC,GAAGuG,QAAQ,CAAC1G,yBAAD;AACpDG,mCAAmC,CAACoG,SAApC,GAAgDC,SAAhD;;;;"}
1
+ {"version":3,"file":"ChatContainerMessagesList.js","sources":["../../../../src/parts/chat-container-messages-list/ChatContainerMessagesList.tsx"],"sourcesContent":["/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/* eslint-disable max-lines */\nimport React, { CSSProperties } from 'react';\nimport { describe } from 'react-desc';\nimport { useVirtual } from 'react-virtual';\nimport DSButton from '@elliemae/ds-button';\nimport { debounce } from 'lodash';\nimport { ChatBubble, BUBBLE_TYPES } from '../bubble';\nimport { MessageDelimiter } from '../message-delimiter';\nimport { SystemMessage } from '../system-message';\nimport {\n StyledWrapperListItem,\n StyledChatContainerContentList,\n StyledChatContainerContentListScroll,\n StyledWrapper,\n StyledLoadMoreContainer,\n ListItem,\n StyledNewMessagesHiddenContainer,\n} from './styled';\nimport { defaultProps, listProps, ChatContainerMessagesListProps } from './props';\nimport { useValidateProps } from './config/useValidateProps';\nimport { useGetNewMessages } from './useGetNewMessages';\n\ntype getPaddingT = {\n hasMoreItems: string | undefined;\n bannerPosition: string | undefined;\n isLoading: string | undefined;\n};\nconst getPadding = ({ hasMoreItems, bannerPosition, isLoading }: 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\nconst ChatContainerMessagesList = (props: ChatContainerMessagesListProps): JSX.Element => {\n useValidateProps(props, ChatContainerMessagesListWithSchema.toTypescript());\n\n const {\n sendingText,\n bannerPosition,\n sendingMessages,\n messages,\n actionRef,\n onScrollEnds,\n getMoreMessages,\n hasMoreItems,\n isLoading,\n bannerRef,\n } = props;\n const pendingOnScroll = React.useRef(false);\n const loadMoreRef = React.useRef(null);\n const virtualListRef = React.useRef<HTMLDivElement>();\n // estimateSize should not be really required given what was stated on\n // https://github.com/tannerlinsley/react-virtual/issues/23\n const {\n scrollToIndex: vScroll,\n totalSize,\n virtualItems,\n } = useVirtual({\n size: messages.length,\n parentRef: virtualListRef,\n overscan: 15,\n ...getPadding({ hasMoreItems, bannerPosition, isLoading }),\n estimateSize: React.useCallback(() => 80, []),\n });\n\n const newMessages = useGetNewMessages(messages);\n\n const debouncedScroll = React.useMemo(\n () =>\n debounce((): number[] => {\n console.log('debound');\n if (document.visibilityState === 'hidden') {\n pendingOnScroll.current = true;\n return [];\n }\n if (!virtualListRef.current) return [];\n pendingOnScroll.current = false;\n const { bottom, top } = virtualListRef.current?.getBoundingClientRect();\n\n const list = virtualListRef.current.querySelectorAll(\n '[data-element=\"chat-element-list-item\"]',\n ) as NodeListOf<HTMLDivElement>;\n const indexList = [];\n list.forEach((item: HTMLElement) => {\n const { top: itemTop } = item.getBoundingClientRect();\n\n const itemPadding = 10;\n if (itemTop + itemPadding < bottom && itemTop + itemPadding > top) indexList.push(item.dataset.index);\n });\n if (onScrollEnds) onScrollEnds(indexList);\n return indexList;\n }, 500),\n [onScrollEnds],\n );\n\n const onScrollStop = React.useCallback(debouncedScroll, [debouncedScroll]);\n\n const onlyFocus = React.useCallback((index: number) => {\n setTimeout(() => {\n (virtualListRef.current.querySelector(`[data-index=\"${index}\"]`) as HTMLDivElement).focus();\n }, 300);\n }, []);\n\n const scrollAndFocus = React.useCallback(\n (index: number, b = { align: 'center' }) => {\n vScroll(index, b);\n onlyFocus(index);\n onScrollStop();\n },\n [onScrollStop, onlyFocus, vScroll],\n );\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.scrollToIndex = (a, b = { align: 'center' }) => {\n vScroll(a, b as any);\n onScrollStop();\n };\n actionRef.current.getMessagesInView = onScrollStop;\n onScrollStop(); // init useMemo due to debounce use.\n actionRef.current.focusToIndex = (a, b = { align: 'center' } as ScrollToOptions) => {\n scrollAndFocus(a, b);\n };\n actionRef.current.focusToIndexWithoutScroll = onlyFocus;\n actionRef.current.focusToList = () => {\n virtualListRef.current?.focus();\n };\n }\n }, [actionRef, onScrollStop, onlyFocus, scrollAndFocus, vScroll]);\n\n const handleKey = React.useCallback(\n (e: React.KeyboardEvent) => {\n const { key } = e;\n const index = Number(e.currentTarget.dataset.index);\n e.stopPropagation();\n switch (key) {\n case 'ArrowUp':\n e.preventDefault();\n if (index > 0) {\n (virtualListRef.current?.querySelector(`[data-index=\"${index - 1}\"]`) as HTMLDivElement).focus();\n } else if (hasMoreItems === 'top') {\n loadMoreRef.current?.focus();\n }\n break;\n case 'ArrowDown':\n e.preventDefault();\n if (index < messages.length - 1) {\n (virtualListRef.current.querySelector(`[data-index=\"${index + 1}\"]`) as HTMLDivElement).focus();\n }\n break;\n case 'Home':\n e.preventDefault();\n scrollAndFocus(0);\n break;\n case 'End':\n e.preventDefault();\n scrollAndFocus(messages.length - 1);\n break;\n case 'Tab':\n if (hasMoreItems === 'bottom' && !e.shiftKey) {\n e.preventDefault();\n loadMoreRef.current?.focus();\n } else if (hasMoreItems === 'top' && e.shiftKey) {\n e.preventDefault();\n loadMoreRef.current?.focus();\n } else if (!e.shiftKey) {\n if (bannerPosition) {\n e.preventDefault();\n bannerRef.current.focusOnWrapper();\n }\n } else {\n e.preventDefault();\n virtualListRef.current?.focus();\n }\n break;\n default:\n break;\n }\n },\n [bannerRef, hasMoreItems, messages.length, bannerPosition, scrollAndFocus],\n );\n const handleListKey = React.useCallback(\n (e: React.KeyboardEvent) => {\n const { key } = e;\n switch (key) {\n case 'ArrowUp':\n e.preventDefault();\n if (document.activeElement !== loadMoreRef.current) {\n onlyFocus(onScrollStop().shift());\n }\n break;\n case 'ArrowDown':\n e.preventDefault();\n if (document.activeElement === loadMoreRef.current) {\n (virtualListRef.current.querySelector(`[data-index=\"0\"]`) as HTMLDivElement).focus();\n } else {\n onlyFocus(onScrollStop().pop());\n }\n break;\n case 'Home':\n e.preventDefault();\n scrollAndFocus(0);\n break;\n case 'End':\n e.preventDefault();\n scrollAndFocus(messages.length - 1);\n break;\n case 'Tab':\n if (document.activeElement !== loadMoreRef.current) {\n if (hasMoreItems === 'bottom' && !e.shiftKey) {\n e.preventDefault();\n loadMoreRef.current?.focus();\n } else if (hasMoreItems === 'top' && e.shiftKey) {\n // e.preventDefault();\n // loadMoreRef.current?.focus();\n } else if (!e.shiftKey) {\n e.preventDefault();\n actionRef.current.focusToComposer();\n }\n } else if (!e.shiftKey) {\n e.preventDefault();\n actionRef.current.focusToComposer();\n } else {\n e.preventDefault();\n virtualListRef.current?.focus();\n }\n break;\n default:\n break;\n }\n },\n [actionRef, hasMoreItems, messages.length, onScrollStop, onlyFocus, scrollAndFocus],\n );\n\n const checkPendingOnScroll = React.useCallback(() => {\n if (pendingOnScroll.current === true) onScrollStop();\n }, [onScrollStop]);\n\n React.useEffect(() => {\n let handlerCallback = null;\n const localVirtualRef = virtualListRef.current;\n const onScroll = () => {\n if (handlerCallback) clearTimeout(handlerCallback);\n handlerCallback = setTimeout(onScrollStop, 300);\n };\n if (onScrollEnds) {\n virtualListRef.current.addEventListener('scroll', onScroll);\n }\n document.addEventListener('visibilitychange', checkPendingOnScroll);\n return () => {\n if (handlerCallback) clearTimeout(handlerCallback);\n if (onScrollEnds) localVirtualRef.removeEventListener('scroll', onScroll);\n document.removeEventListener('visibilitychange', checkPendingOnScroll);\n };\n }, [onScrollStop, onScrollEnds, checkPendingOnScroll]);\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 // eslint-disable-next-line\n <ChatBubble {...(row as any)} helpMessage={isSending ? sendingText : row.helpMessage} />\n ) : null}\n {row.type === BUBBLE_TYPES.DELIMITER ? <MessageDelimiter {...(row as any)} /> : null}\n {row.type === BUBBLE_TYPES.SYSTEM ? <SystemMessage {...(row as any)} /> : null}\n </StyledWrapperListItem>\n </ListItem>\n );\n }),\n [virtualItems, messages, sendingMessages, handleKey, sendingText],\n );\n\n return (\n <StyledWrapper>\n <StyledChatContainerContentList\n data-testid=\"chat-thread-container\"\n tabIndex={0}\n ref={virtualListRef}\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=\"ds-chat-load-more-btn\"\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>\n {newMessage.title} {newMessage.time} {newMessage.body} {newMessage.errorMessage} {newMessage.helpMessage}\n </p>\n ))}\n </StyledNewMessagesHiddenContainer>\n </StyledWrapper>\n );\n};\n\nChatContainerMessagesList.propTypes = listProps;\nChatContainerMessagesList.defaultProps = defaultProps;\nconst ChatContainerMessagesListWithSchema = describe(ChatContainerMessagesList);\nChatContainerMessagesListWithSchema.propTypes = listProps;\n\nexport { ChatContainerMessagesList, ChatContainerMessagesListWithSchema };\n"],"names":["getPadding","hasMoreItems","bannerPosition","isLoading","padding","paddingStart","paddingEnd","some","item","ChatContainerMessagesList","props","useValidateProps","ChatContainerMessagesListWithSchema","toTypescript","sendingText","sendingMessages","messages","actionRef","onScrollEnds","getMoreMessages","bannerRef","pendingOnScroll","React","useRef","loadMoreRef","virtualListRef","useVirtual","size","length","parentRef","overscan","estimateSize","useCallback","vScroll","scrollToIndex","totalSize","virtualItems","newMessages","useGetNewMessages","debouncedScroll","useMemo","debounce","document","visibilityState","current","getBoundingClientRect","bottom","top","list","querySelectorAll","indexList","forEach","itemTop","itemPadding","push","dataset","index","onScrollStop","onlyFocus","setTimeout","querySelector","focus","scrollAndFocus","b","align","useEffect","a","getMessagesInView","focusToIndex","focusToIndexWithoutScroll","focusToList","handleKey","e","key","Number","currentTarget","stopPropagation","preventDefault","shiftKey","focusOnWrapper","handleListKey","activeElement","shift","pop","focusToComposer","checkPendingOnScroll","handlerCallback","localVirtualRef","onScroll","clearTimeout","addEventListener","removeEventListener","render","map","virtualItem","measureRef","start","row","isSending","find","m","dsId","style","position","left","transform","width","type","BUBBLE_TYPES","SENDER","RECIPIENT","helpMessage","DELIMITER","SYSTEM","newMessage","title","time","body","errorMessage","propTypes","listProps","defaultProps","describe"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAMA,UAAU,GAAG,SAAbA,UAAa,OAA8D;AAAA,MAA3DC,YAA2D,QAA3DA,YAA2D;AAAA,MAA7CC,cAA6C,QAA7CA,cAA6C;AAAA,MAA7BC,SAA6B,QAA7BA,SAA6B;AAC/E,MAAMC,OAAO,GAAG;AACdC,IAAAA,YAAY,EAAE,CADA;AAEdC,IAAAA,UAAU,EAAE,CAAC;AAFC,GAAhB;AAIA,MAAI,CAACL,YAAD,EAAeC,cAAf,EAA+BC,SAA/B,EAA0CI,IAA1C,CAA+C,UAACC,IAAD;AAAA,WAAUA,IAAI,KAAK,KAAnB;AAAA,GAA/C,CAAJ,EAA8EJ,OAAO,CAACC,YAAR,GAAuB,EAAvB,CAA9E,KACK,IAAI,CAACJ,YAAD,EAAeC,cAAf,EAA+BC,SAA/B,EAA0CI,IAA1C,CAA+C,UAACC,IAAD;AAAA,WAAUA,IAAI,KAAK,QAAnB;AAAA,GAA/C,CAAJ,EAAiFJ,OAAO,CAACE,UAAR,GAAqB,EAArB;AACtF,SAAOF,OAAP;AACD,CARD;;IAUMK,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,KAAD,EAAwD;AACxFC,EAAAA,gBAAgB,CAACD,KAAD,EAAQE,mCAAmC,CAACC,YAApC,EAAR,CAAhB;AAEA,MACEC,WADF,GAWIJ,KAXJ,CACEI,WADF;AAAA,MAEEZ,cAFF,GAWIQ,KAXJ,CAEER,cAFF;AAAA,MAGEa,eAHF,GAWIL,KAXJ,CAGEK,eAHF;AAAA,MAIEC,QAJF,GAWIN,KAXJ,CAIEM,QAJF;AAAA,MAKEC,SALF,GAWIP,KAX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ApCa,CAAf;AAuCA,sBACE,oBAAC,aAAD,qBACE,oBAAC,8BAAD;AACE,mBAAY,uBADd;AAEE,IAAA,QAAQ,EAAE,CAFZ;AAGE,IAAA,GAAG,EAAEW,cAHP;AAIE,IAAA,IAAI,EAAC,MAJP;AAKE,IAAA,SAAS,EAAEuD;AALb,kBAOE,oBAAC,oCAAD;AAAsC,IAAA,MAAM,YAAK7C,SAAL;AAA5C,KACG,CAAChC,SAAD,IAAcF,YAAd,gBACC,oBAAC,uBAAD;AAAyB,IAAA,YAAY,EAAEA;AAAvC,kBACE,oBAAC,QAAD;AACE,IAAA,SAAS,EAAC,WADZ;AAEE,IAAA,UAAU,EAAC,WAFb;AAGE,IAAA,OAAO,EAAEkB,eAHX;AAIE,mBAAY,uBAJd;AAKE,IAAA,QAAQ,EAAEK;AALZ,IADF,CADD,GAUG,IAXN,EAYGoE,MAZH,CAPF,CADF,eAwBE,oBAAC,gCAAD;AAAkC,iBAAU,QAA5C;AAAqD,mBAAY;AAAjE,KACGvD,WAAW,CAACwD,GAAZ,CAAgB,UAACqB,UAAD;AAAA,wBACf,+BACGA,UAAU,CAACC,KADd,OACsBD,UAAU,CAACE,IADjC,OACwCF,UAAU,CAACG,IADnD,OAC0DH,UAAU,CAACI,YADrE,OACoFJ,UAAU,CAACH,WAD/F,CADe;AAAA,GAAhB,CADH,CAxBF,CADF;AAkCD;;AAEDtG,yBAAyB,CAAC8G,SAA1B,GAAsCC,SAAtC;AACA/G,yBAAyB,CAACgH,YAA1B,GAAyCA,YAAzC;IACM7G,mCAAmC,GAAG8G,QAAQ,CAACjH,yBAAD;AACpDG,mCAAmC,CAAC2G,SAApC,GAAgDC,SAAhD;;;;"}
@@ -27,4 +27,6 @@ import '../system-message/config/useValidateProps.js';
27
27
  import './styled.js';
28
28
  import './props.js';
29
29
  import './config/useValidateProps.js';
30
+ import './useGetNewMessages.js';
31
+ import '@babel/runtime/helpers/esm/slicedToArray';
30
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -30,13 +30,16 @@ var StyledChatContainerContentList = /*#__PURE__*/styled.div.withConfig({
30
30
  })(["width:100%;height:100%;padding:", ";padding-bottom:0;overflow-y:auto;overflow-x:hidden;"], function (props) {
31
31
  return props.theme.space.xs;
32
32
  });
33
- var StyledChatContainerContentListScroll = /*#__PURE__*/styled.div.withConfig({
33
+ var StyledNewMessagesHiddenContainer = /*#__PURE__*/styled.div.withConfig({
34
34
  componentId: "sc-1jhprzr-3"
35
+ })(["position:absolute;width:1px;height:1px;margin:-1px;border:0;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(100%);white-space:nowrap;"]);
36
+ var StyledChatContainerContentListScroll = /*#__PURE__*/styled.div.withConfig({
37
+ componentId: "sc-1jhprzr-4"
35
38
  })(["width:100%;height:", ";position:relative;"], function (props) {
36
39
  return props.height;
37
40
  });
38
41
  var StyledLoadMoreContainer = /*#__PURE__*/styled.div.withConfig({
39
- componentId: "sc-1jhprzr-4"
42
+ componentId: "sc-1jhprzr-5"
40
43
  })(["position:absolute;width:calc(100% + ", ");padding:", ";left:-", ";right:-", ";display:grid;justify-content:center;align-items:center;", " ", ""], function (props) {
41
44
  return props.theme.space.xxs;
42
45
  }, function (props) {
@@ -51,10 +54,10 @@ var StyledLoadMoreContainer = /*#__PURE__*/styled.div.withConfig({
51
54
  return props.hasMoreItems === 'bottom' ? 'bottom: 0;' : '';
52
55
  });
53
56
  var ListItem = /*#__PURE__*/styled.div.withConfig({
54
- componentId: "sc-1jhprzr-5"
57
+ componentId: "sc-1jhprzr-6"
55
58
  })(["&:focus,&:focus-visible{outline:none;&:after{content:'';display:block;position:absolute;top:0;left:-", ";pointer-events:none;border-radius:2px;background-color:#ebedf0;width:calc(100% + 24px);border:2px solid #1e79c2;height:100%;z-index:-1;}}"], function (props) {
56
59
  return props.theme.space.xxs;
57
60
  });
58
61
 
59
- export { ListItem, StyledChatContainerContentList, StyledChatContainerContentListScroll, StyledLoadMoreContainer, StyledWrapper, StyledWrapperListItem };
62
+ export { ListItem, StyledChatContainerContentList, StyledChatContainerContentListScroll, StyledLoadMoreContainer, StyledNewMessagesHiddenContainer, StyledWrapper, StyledWrapperListItem };
60
63
  //# sourceMappingURL=styled.js.map