@elliemae/ds-chat 2.0.0-rc.1 → 2.0.0-rc.13

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 (68) hide show
  1. package/cjs/ChatDataTestids.js +27 -0
  2. package/cjs/parts/bubble/ChatBubbleArrow.js +3 -3
  3. package/cjs/parts/chat-composer/styled.js +1 -1
  4. package/cjs/parts/chat-container/ChatContainer.js +17 -11
  5. package/cjs/parts/chat-container/config/useValidateProps.js +2 -2
  6. package/cjs/parts/chat-container/props.js +6 -2
  7. package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +18 -7
  8. package/cjs/parts/chat-container-messages-list/config/useValidateProps.js +2 -2
  9. package/cjs/parts/floating-button/FloatingButton.js +12 -6
  10. package/cjs/parts/floating-button/props.js +6 -2
  11. package/cjs/parts/tile-button/styled.js +5 -2
  12. package/esm/ChatDataTestids.js +23 -0
  13. package/esm/parts/bubble/ChatBubbleArrow.js +3 -3
  14. package/esm/parts/chat-composer/styled.js +1 -1
  15. package/esm/parts/chat-container/ChatContainer.js +15 -9
  16. package/esm/parts/chat-container/config/useValidateProps.js +2 -2
  17. package/esm/parts/chat-container/props.js +6 -2
  18. package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +16 -5
  19. package/esm/parts/chat-container-messages-list/config/useValidateProps.js +2 -2
  20. package/esm/parts/floating-button/FloatingButton.js +12 -6
  21. package/esm/parts/floating-button/props.js +6 -2
  22. package/esm/parts/tile-button/styled.js +5 -3
  23. package/package.json +22 -9
  24. package/types/ChatDataTestids.d.ts +21 -0
  25. package/types/parts/bubble/ChatBubble.d.ts +18 -5
  26. package/types/parts/bubble/props.d.ts +13 -4
  27. package/types/parts/bubble/styled.d.ts +9 -9
  28. package/types/parts/chat-card/ChatCard.d.ts +24 -4
  29. package/types/parts/chat-card/props.d.ts +19 -3
  30. package/types/parts/chat-card/styled.d.ts +6 -6
  31. package/types/parts/chat-composer/ChatContainerComposer.d.ts +48 -15
  32. package/types/parts/chat-composer/styled.d.ts +117 -24
  33. package/types/parts/chat-container/ChatContainer.d.ts +54 -13
  34. package/types/parts/chat-container/config/useValidateProps.d.ts +1 -1
  35. package/types/parts/chat-container/styled.d.ts +4 -4
  36. package/types/parts/chat-container/tests/ChatContainer.test.d.ts +1 -0
  37. package/types/parts/chat-container-header/styled.d.ts +3 -3
  38. package/types/parts/chat-container-messages-list/ChatContainerMessagesList.d.ts +39 -9
  39. package/types/parts/chat-container-messages-list/config/useValidateProps.d.ts +1 -1
  40. package/types/parts/chat-container-messages-list/styled.d.ts +7 -7
  41. package/types/parts/chat-empty-state/ChatEmptyState.d.ts +12 -3
  42. package/types/parts/chat-empty-state/props.d.ts +7 -2
  43. package/types/parts/chat-empty-state/styled.d.ts +2 -2
  44. package/types/parts/chat-sidebar/SideBarChat.d.ts +39 -12
  45. package/types/parts/chat-sidebar/props.d.ts +34 -11
  46. package/types/parts/chat-sidebar/styled.d.ts +2 -2
  47. package/types/parts/floating-button/FloatingButton.d.ts +11 -2
  48. package/types/parts/floating-button/props.d.ts +13 -1
  49. package/types/parts/floating-button/styled.d.ts +1 -1
  50. package/types/parts/floating-container/styled.d.ts +1 -2
  51. package/types/parts/grid-influencer/styled.d.ts +2 -2
  52. package/types/parts/message-delimiter/MessageDelimiter.d.ts +21 -4
  53. package/types/parts/message-delimiter/props.d.ts +16 -3
  54. package/types/parts/message-delimiter/styled.d.ts +3 -3
  55. package/types/parts/sidebar-button/SidebarButton.d.ts +16 -5
  56. package/types/parts/sidebar-button/props.d.ts +16 -5
  57. package/types/parts/sidebar-button/styled.d.ts +3 -3
  58. package/types/parts/system-message/SystemMessage.d.ts +12 -2
  59. package/types/parts/system-message/props.d.ts +7 -1
  60. package/types/parts/system-message/style.d.ts +5 -5
  61. package/types/parts/tile-button/TileButton.d.ts +66 -20
  62. package/types/parts/tile-button/props.d.ts +61 -19
  63. package/types/parts/tile-button/styled.d.ts +9 -9
  64. package/types/prop-types.d.ts +28 -9
  65. package/types/tests/utils.d.ts +27 -0
  66. package/types/parts/chat-composer/props.d.ts +0 -39
  67. package/types/parts/chat-container/props.d.ts +0 -41
  68. package/types/parts/chat-container-messages-list/props.d.ts +0 -29
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const ChatDataTestIds = {
6
+ COMPOSER_TEXTAREA: 'chat-composer-textarea',
7
+ COMPOSER_SEND_BUTTON: 'chat-composer-send-button',
8
+ CARD_TITLE: 'chat-card-title',
9
+ CARD_WRAPPER: 'chat-card-wrapper',
10
+ CARD_TIME: 'chat-card-time',
11
+ CARD_RIGHT_ADDON: 'chat-right-addon',
12
+ CARD_CONTENT: 'chat-card-content',
13
+ LOADING_INDICATOR: 'ds-chat-loading-indicator',
14
+ HEADER_TITLE: 'chat-header-title',
15
+ HEADER_CHILDREN: 'chat-header-children',
16
+ THREAD_CONTAINER: 'chat-thread-container',
17
+ LOAD_MORE_BUTTON: 'ds-chat-load-more-btn',
18
+ FLOATING_BUTTON: 'chat-floating-button',
19
+ SYSTEM_MSG_TITLE: 'chat-system-message-title',
20
+ SYSTEM_MSG_BODY: 'chat-system-message-body',
21
+ SYSTEM_MSG_TIME: 'chat-system-message-time',
22
+ BUBBLE: 'ds-chat-bubble',
23
+ BUBBLE_TITLE: 'chat-bubble-title',
24
+ BUBBLE_BODY: 'chat-bubble-body'
25
+ };
26
+
27
+ exports.ChatDataTestIds = ChatDataTestIds;
@@ -22,7 +22,7 @@ const ChatBubbleArrow = _ref => {
22
22
  viewBox: "0 0 15 14"
23
23
  }, void 0, /*#__PURE__*/_jsx__default["default"]("defs", {}, void 0, /*#__PURE__*/_jsx__default["default"]("path", {
24
24
  d: "M12,8.5 C12,7.9373169 11.6782751,7.4856453 11.2282104,7.196228 C11.2286673,7.1967363 3,2 3,2 L3,10 L10.5627441,10 L10.5658569,9.9933472 C11.3630371,9.9580688 12,9.3058472 12,8.5 Z",
25
- id: "path-1"
25
+ id: "path-chat-bubble"
26
26
  }), /*#__PURE__*/_jsx__default["default"]("filter", {
27
27
  x: "-55.6%",
28
28
  y: "-50.0%",
@@ -56,11 +56,11 @@ const ChatBubbleArrow = _ref => {
56
56
  fill: "black",
57
57
  fillOpacity: "1",
58
58
  filter: "url(#filter-2)",
59
- xlinkHref: "#path-1"
59
+ xlinkHref: "#path-chat-bubble"
60
60
  }), /*#__PURE__*/_jsx__default["default"]("use", {
61
61
  fill: "#FFFFFF",
62
62
  fillRule: "evenodd",
63
- xlinkHref: "#path-1"
63
+ xlinkHref: "#path-chat-bubble"
64
64
  }))))) : _svg2 || (_svg2 = /*#__PURE__*/_jsx__default["default"]("svg", {
65
65
  width: "9px",
66
66
  height: "8px",
@@ -16,7 +16,7 @@ const StyledChatContainerContentComposer = /*#__PURE__*/styled__default["default
16
16
  })(["width:100%;min-height:56px;background:", ";padding:", ";padding-bottom:3px;padding-top:6px;padding-left:", ";max-height:", ";border-top:1px solid #cbcfd7;"], props => props.theme.colors.neutral['050'], props => props.theme.space.xxs, props => props.theme.space.xs, props => props.maxHeight);
17
17
  const StyledComposerInput = /*#__PURE__*/styled__default["default"].textarea.withConfig({
18
18
  componentId: "sc-1ahwpce-1"
19
- })(["padding:", ";resize:none;min-height:32px;border-radius:2px;border:solid 1px #cbcfd7;color:#25292f;height:", ";min-width:244px;overflow-y:auto;font-size:13px;font-weight:400;line-height:1;transition:height 0.3s;&:focus{outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px #8cc2ed;border-radius:2px;}"], props => props.theme.space.xxs, props => typeof props.height === 'number' ? "".concat(props.height, "px") : props.height, props => props.theme.colors.brand[600]);
19
+ })(["padding:", ";resize:none;min-height:32px;border-radius:2px;border:solid 1px #cbcfd7;color:#25292f;height:", ";min-width:244px;overflow-y:auto;font-size:13px;font-weight:400;line-height:1;transition:height 0.05s;&:focus{outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px #8cc2ed;border-radius:2px;}"], props => props.theme.space.xxs, props => typeof props.height === 'number' ? "".concat(props.height, "px") : props.height, props => props.theme.colors.brand[600]);
20
20
  const StyledComposerButton = /*#__PURE__*/styled__default["default"](DSButton.DSButton).withConfig({
21
21
  componentId: "sc-1ahwpce-2"
22
22
  })(["&:disabled{background:none;svg{fill:#5d6775;}}svg{fill:", ";}&:focus{background:", ";}"], props => props.theme.colors.brand[600], props => props.theme.colors.brand[200]);
@@ -35,10 +35,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
35
35
 
36
36
  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__default["default"](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; }
37
37
 
38
- const ChatContainer = props => {
38
+ const ChatContainer = props$1 => {
39
39
  var _containerRef$current;
40
40
 
41
- useValidateProps.useValidateProps(props, ChatContainerWithSchema.toTypescript());
41
+ useValidateProps.useValidateProps(props$1, props.containerProps);
42
42
  const {
43
43
  sendingText,
44
44
  sendingMessages,
@@ -51,12 +51,12 @@ const ChatContainer = props => {
51
51
  onKeyDown: onComposerKeyDown
52
52
  },
53
53
  actionRef,
54
- autoScroll,
55
54
  device,
56
55
  isLoading,
57
56
  hasMoreItems,
58
- getMoreMessages
59
- } = props;
57
+ getMoreMessages,
58
+ ariaLabel
59
+ } = props$1;
60
60
  const bannerRef = React__default["default"].useRef({
61
61
  focusOnWrapper: lodash.noop,
62
62
  focusOnLink: lodash.noop
@@ -68,12 +68,18 @@ const ChatContainer = props => {
68
68
  const onResize = React__default["default"].useCallback(height => {
69
69
  if (onComposerResize) onComposerResize(height);
70
70
 
71
- if (autoScroll) {
72
- listRef.current.scrollToIndex(messagesListProps.messages.length - 1, {
73
- align: 'end'
74
- });
71
+ if (height > 30) {
72
+ /*
73
+ setTimeout is used to equal the animation duration from the
74
+ composer text area when increase its size
75
+ */
76
+ setTimeout(() => {
77
+ actionRef.current.scrollToIndex(messagesListProps.messages.length - 1, {
78
+ align: 'start'
79
+ });
80
+ }, 50);
75
81
  }
76
- }, [onComposerResize, messagesListProps.messages, autoScroll]);
82
+ }, [onComposerResize, messagesListProps.messages, actionRef]);
77
83
  const Container = device === 'desktop' ? styled.StyledChatContainerContent : styled.MobileStyledChatContainerContent;
78
84
  const handleTabs = React__default["default"].useCallback(e => {
79
85
  if (onComposerKeyDown) onComposerKeyDown(e);else {
@@ -102,7 +108,7 @@ const ChatContainer = props => {
102
108
  rows: ['minmax(0, 1fr)', 'auto'],
103
109
  ref: containerRef,
104
110
  role: "region",
105
- "aria-label": "chat window",
111
+ "aria-label": ariaLabel,
106
112
  children: [/*#__PURE__*/_jsx__default["default"]("div", {
107
113
  style: {
108
114
  position: 'relative',
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var dsPropsHelpers = require('@elliemae/ds-props-helpers');
6
6
 
7
- const useValidateProps = (props, schema) => {
8
- dsPropsHelpers.useValidateTypescriptPropTypes(props, schema);
7
+ const useValidateProps = (props, propTypes) => {
8
+ dsPropsHelpers.useValidateTypescriptPropTypes(props, propTypes);
9
9
  };
10
10
 
11
11
  exports.useValidateProps = useValidateProps;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var reactDesc = require('react-desc');
6
6
  var lodash = require('lodash');
7
+ var DSBanner = require('@elliemae/ds-banner');
7
8
  var props = require('../chat-container-messages-list/props.js');
8
9
  var props$1 = require('../chat-composer/props.js');
9
10
 
@@ -18,13 +19,15 @@ const defaultProps = {
18
19
  getMoreMessages: lodash.noop,
19
20
  bannerPosition: undefined,
20
21
  bannerProps: {
22
+ type: DSBanner.BANNER_TYPES.INFO,
21
23
  label: 'Unread Messages',
22
24
  viewLabel: 'View',
23
25
  onView: lodash.noop,
24
26
  onClose: lodash.noop
25
27
  },
26
28
  sendingMessages: undefined,
27
- sendingText: 'Sending'
29
+ sendingText: 'Sending',
30
+ ariaLabel: 'Chat window'
28
31
  };
29
32
  const containerProps = {
30
33
  messagesListProps: reactDesc.PropTypes.object.description('ChatMessageList props "messages" / "onScrollEnds"').defaultValue(defaultProps.messagesListProps),
@@ -38,7 +41,8 @@ const containerProps = {
38
41
  bannerProps: reactDesc.PropTypes.object.description("Banner configuration:\n label: string;\n viewLabel: string;\n type: BANNER_TYPES;\n onView: () => void;\n onClose: () => void;\n ").defaultValue(defaultProps.bannerProps),
39
42
  sendingMessages: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.string), reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.number)]).description('Array of ids of sending messages').defaultValue(defaultProps.sendingMessages),
40
43
  sendingText: reactDesc.PropTypes.string.description('Label description for messages in sending status').defaultValue(defaultProps.sendingText),
41
- actionRef: reactDesc.PropTypes.object.description("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 ").defaultValue(defaultProps.actionRef)
44
+ actionRef: reactDesc.PropTypes.object.description("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 ").defaultValue(defaultProps.actionRef),
45
+ ariaLabel: reactDesc.PropTypes.string.description('Aria Label description for chat container').defaultValue(defaultProps.ariaLabel)
42
46
  };
43
47
 
44
48
  exports.containerProps = containerProps;
@@ -4,8 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
- require('core-js/modules/esnext.async-iterator.for-each.js');
7
+ require('core-js/modules/esnext.async-iterator.some.js');
8
8
  require('core-js/modules/esnext.iterator.constructor.js');
9
+ require('core-js/modules/esnext.iterator.some.js');
10
+ require('core-js/modules/esnext.async-iterator.for-each.js');
9
11
  require('core-js/modules/esnext.iterator.for-each.js');
10
12
  require('core-js/modules/esnext.async-iterator.map.js');
11
13
  require('core-js/modules/esnext.iterator.map.js');
@@ -37,17 +39,22 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
37
39
 
38
40
  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__default["default"](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; }
39
41
 
40
- const getPadding = hasMoreItems => {
42
+ const getPadding = _ref => {
43
+ let {
44
+ hasMoreItems,
45
+ bannerPosition,
46
+ isLoading
47
+ } = _ref;
41
48
  const padding = {
42
49
  paddingStart: 0,
43
50
  paddingEnd: -5
44
51
  };
45
- if (hasMoreItems === 'top') padding.paddingStart = 42;else if (hasMoreItems === 'bottom') padding.paddingEnd = 42;
52
+ if ([hasMoreItems, bannerPosition, isLoading].some(item => item === 'top')) padding.paddingStart = 42;else if ([hasMoreItems, bannerPosition, isLoading].some(item => item === 'bottom')) padding.paddingEnd = 42;
46
53
  return padding;
47
54
  };
48
55
 
49
- const ChatContainerMessagesList = props => {
50
- useValidateProps.useValidateProps(props, ChatContainerMessagesListWithSchema.toTypescript());
56
+ const ChatContainerMessagesList = props$2 => {
57
+ useValidateProps.useValidateProps(props$2, props.listProps);
51
58
  const {
52
59
  sendingText,
53
60
  bannerPosition,
@@ -59,7 +66,7 @@ const ChatContainerMessagesList = props => {
59
66
  hasMoreItems,
60
67
  isLoading,
61
68
  bannerRef
62
- } = props;
69
+ } = props$2;
63
70
  const loadMoreRef = React__default["default"].useRef(null);
64
71
  const virtualListRef = React__default["default"].useRef(); // estimateSize should not be really required given what was stated on
65
72
  // https://github.com/tannerlinsley/react-virtual/issues/23
@@ -72,7 +79,11 @@ const ChatContainerMessagesList = props => {
72
79
  size: messages.length,
73
80
  parentRef: virtualListRef,
74
81
  overscan: 15
75
- }, getPadding(hasMoreItems)), {}, {
82
+ }, getPadding({
83
+ hasMoreItems,
84
+ bannerPosition,
85
+ isLoading
86
+ })), {}, {
76
87
  estimateSize: React__default["default"].useCallback(() => 80, [])
77
88
  }));
78
89
  const onScrollStop = React__default["default"].useCallback(() => {
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var dsPropsHelpers = require('@elliemae/ds-props-helpers');
6
6
 
7
- const useValidateProps = (props, schema) => {
8
- dsPropsHelpers.useValidateTypescriptPropTypes(props, schema);
7
+ const useValidateProps = (props, propTypes) => {
8
+ dsPropsHelpers.useValidateTypescriptPropTypes(props, propTypes);
9
9
  };
10
10
 
11
11
  exports.useValidateProps = useValidateProps;
@@ -7,6 +7,7 @@ require('react');
7
7
  var dsIcons = require('@elliemae/ds-icons');
8
8
  var styled = require('./styled.js');
9
9
  var props = require('./props.js');
10
+ var jsxRuntime = require('react/jsx-runtime');
10
11
 
11
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
13
 
@@ -15,14 +16,19 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
15
16
  var _Comments;
16
17
  const FloatingButton = _ref => {
17
18
  let {
18
- onClick
19
+ onClick,
20
+ onFocus,
21
+ innerRef
19
22
  } = _ref;
20
- return /*#__PURE__*/_jsx__default["default"](styled.StyledFloatingButton, {
23
+ return /*#__PURE__*/jsxRuntime.jsx(styled.StyledFloatingButton, {
24
+ onFocus: onFocus,
25
+ ref: innerRef,
21
26
  "data-testid": "chat-floating-button",
22
- onClick: onClick
23
- }, void 0, _Comments || (_Comments = /*#__PURE__*/_jsx__default["default"](dsIcons.Comments, {
24
- size: "l"
25
- })));
27
+ onClick: onClick,
28
+ children: _Comments || (_Comments = /*#__PURE__*/_jsx__default["default"](dsIcons.Comments, {
29
+ size: "l"
30
+ }))
31
+ });
26
32
  };
27
33
  FloatingButton.defaultProps = props.defaultFloatingButton;
28
34
 
@@ -6,10 +6,14 @@ var reactDesc = require('react-desc');
6
6
  var lodash = require('lodash');
7
7
 
8
8
  const defaultFloatingButton = {
9
- onClick: lodash.noop
9
+ onClick: lodash.noop,
10
+ onFocus: lodash.noop,
11
+ innerRef: null
10
12
  };
11
13
  const propsFloatingButton = {
12
- onClick: reactDesc.PropTypes.func.description('The function to call when the chat is opened via the footer').defaultValue(defaultFloatingButton.onClick)
14
+ onClick: reactDesc.PropTypes.func.description('The function to call when the chat is opened via the footer').defaultValue(defaultFloatingButton.onClick),
15
+ onFocus: reactDesc.PropTypes.func.description('The function to call when button is being focused').defaultValue(defaultFloatingButton.onFocus),
16
+ innerRef: reactDesc.PropTypes.object.description('Ref to the component container').defaultValue(null)
13
17
  };
14
18
 
15
19
  exports.defaultFloatingButton = defaultFloatingButton;
@@ -2,14 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
5
6
  var styled = require('styled-components');
7
+ var dsSystem = require('@elliemae/ds-system');
6
8
  var dsGrid = require('@elliemae/ds-grid');
7
9
 
8
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
11
 
12
+ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
10
13
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
11
14
 
12
- /* eslint-disable indent */
15
+ var _templateObject;
13
16
  const MIN_WIDTH_SIDEBAR = 48;
14
17
  const BUTTON_SIDEBAR_HEIGHT = 48; // Buttons
15
18
 
@@ -72,7 +75,7 @@ const StyledTileButton = /*#__PURE__*/styled__default["default"].button.withConf
72
75
  }
73
76
  }, StyledWrapperLeftBorder, props => props.theme.colors.brand[800], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.brand[800], props => props.theme.colors.neutral['050'], StyledWrapperLeftBorder, props => props.theme.colors.brand[600], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.brand[600], StyledStatusBadge, props => props.theme.colors.neutral['050'], props => props.theme.colors.neutral['080'], StyledWrapperLeftBorder, props => props.theme.colors.neutral['400'], StyledStatusBadge, props => props.theme.colors.neutral['500'], props => props.theme.colors.neutral['080'], StyledTileButtonIcon, props => props.theme.colors.neutral[400], StyledTileButtonLabel, props => props.theme.colors.neutral[400], props => {
74
77
  if (props.selected) {
75
- return styled.css(["& ", "{background:", ";}"], StyledWrapperLeftBorder, nestedProps => nestedProps.theme.colors.brand[600]);
78
+ return dsSystem.css(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n & ", " {\n background: ", ";\n }\n "])), StyledWrapperLeftBorder, nestedProps => nestedProps.theme.colors.brand[600]);
76
79
  }
77
80
 
78
81
  return '';
@@ -0,0 +1,23 @@
1
+ const ChatDataTestIds = {
2
+ COMPOSER_TEXTAREA: 'chat-composer-textarea',
3
+ COMPOSER_SEND_BUTTON: 'chat-composer-send-button',
4
+ CARD_TITLE: 'chat-card-title',
5
+ CARD_WRAPPER: 'chat-card-wrapper',
6
+ CARD_TIME: 'chat-card-time',
7
+ CARD_RIGHT_ADDON: 'chat-right-addon',
8
+ CARD_CONTENT: 'chat-card-content',
9
+ LOADING_INDICATOR: 'ds-chat-loading-indicator',
10
+ HEADER_TITLE: 'chat-header-title',
11
+ HEADER_CHILDREN: 'chat-header-children',
12
+ THREAD_CONTAINER: 'chat-thread-container',
13
+ LOAD_MORE_BUTTON: 'ds-chat-load-more-btn',
14
+ FLOATING_BUTTON: 'chat-floating-button',
15
+ SYSTEM_MSG_TITLE: 'chat-system-message-title',
16
+ SYSTEM_MSG_BODY: 'chat-system-message-body',
17
+ SYSTEM_MSG_TIME: 'chat-system-message-time',
18
+ BUBBLE: 'ds-chat-bubble',
19
+ BUBBLE_TITLE: 'chat-bubble-title',
20
+ BUBBLE_BODY: 'chat-bubble-body'
21
+ };
22
+
23
+ export { ChatDataTestIds };
@@ -14,7 +14,7 @@ const ChatBubbleArrow = _ref => {
14
14
  viewBox: "0 0 15 14"
15
15
  }, void 0, /*#__PURE__*/_jsx("defs", {}, void 0, /*#__PURE__*/_jsx("path", {
16
16
  d: "M12,8.5 C12,7.9373169 11.6782751,7.4856453 11.2282104,7.196228 C11.2286673,7.1967363 3,2 3,2 L3,10 L10.5627441,10 L10.5658569,9.9933472 C11.3630371,9.9580688 12,9.3058472 12,8.5 Z",
17
- id: "path-1"
17
+ id: "path-chat-bubble"
18
18
  }), /*#__PURE__*/_jsx("filter", {
19
19
  x: "-55.6%",
20
20
  y: "-50.0%",
@@ -48,11 +48,11 @@ const ChatBubbleArrow = _ref => {
48
48
  fill: "black",
49
49
  fillOpacity: "1",
50
50
  filter: "url(#filter-2)",
51
- xlinkHref: "#path-1"
51
+ xlinkHref: "#path-chat-bubble"
52
52
  }), /*#__PURE__*/_jsx("use", {
53
53
  fill: "#FFFFFF",
54
54
  fillRule: "evenodd",
55
- xlinkHref: "#path-1"
55
+ xlinkHref: "#path-chat-bubble"
56
56
  }))))) : _svg2 || (_svg2 = /*#__PURE__*/_jsx("svg", {
57
57
  width: "9px",
58
58
  height: "8px",
@@ -8,7 +8,7 @@ const StyledChatContainerContentComposer = /*#__PURE__*/styled(Grid).withConfig(
8
8
  })(["width:100%;min-height:56px;background:", ";padding:", ";padding-bottom:3px;padding-top:6px;padding-left:", ";max-height:", ";border-top:1px solid #cbcfd7;"], props => props.theme.colors.neutral['050'], props => props.theme.space.xxs, props => props.theme.space.xs, props => props.maxHeight);
9
9
  const StyledComposerInput = /*#__PURE__*/styled.textarea.withConfig({
10
10
  componentId: "sc-1ahwpce-1"
11
- })(["padding:", ";resize:none;min-height:32px;border-radius:2px;border:solid 1px #cbcfd7;color:#25292f;height:", ";min-width:244px;overflow-y:auto;font-size:13px;font-weight:400;line-height:1;transition:height 0.3s;&:focus{outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px #8cc2ed;border-radius:2px;}"], props => props.theme.space.xxs, props => typeof props.height === 'number' ? "".concat(props.height, "px") : props.height, props => props.theme.colors.brand[600]);
11
+ })(["padding:", ";resize:none;min-height:32px;border-radius:2px;border:solid 1px #cbcfd7;color:#25292f;height:", ";min-width:244px;overflow-y:auto;font-size:13px;font-weight:400;line-height:1;transition:height 0.05s;&:focus{outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px #8cc2ed;border-radius:2px;}"], props => props.theme.space.xxs, props => typeof props.height === 'number' ? "".concat(props.height, "px") : props.height, props => props.theme.colors.brand[600]);
12
12
  const StyledComposerButton = /*#__PURE__*/styled(DSButton).withConfig({
13
13
  componentId: "sc-1ahwpce-2"
14
14
  })(["&:disabled{background:none;svg{fill:#5d6775;}}svg{fill:", ";}&:focus{background:", ";}"], props => props.theme.colors.brand[600], props => props.theme.colors.brand[200]);
@@ -26,7 +26,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
26
26
  const ChatContainer = props => {
27
27
  var _containerRef$current;
28
28
 
29
- useValidateProps(props, ChatContainerWithSchema.toTypescript());
29
+ useValidateProps(props, containerProps);
30
30
  const {
31
31
  sendingText,
32
32
  sendingMessages,
@@ -39,11 +39,11 @@ const ChatContainer = props => {
39
39
  onKeyDown: onComposerKeyDown
40
40
  },
41
41
  actionRef,
42
- autoScroll,
43
42
  device,
44
43
  isLoading,
45
44
  hasMoreItems,
46
- getMoreMessages
45
+ getMoreMessages,
46
+ ariaLabel
47
47
  } = props;
48
48
  const bannerRef = React.useRef({
49
49
  focusOnWrapper: noop,
@@ -56,12 +56,18 @@ const ChatContainer = props => {
56
56
  const onResize = React.useCallback(height => {
57
57
  if (onComposerResize) onComposerResize(height);
58
58
 
59
- if (autoScroll) {
60
- listRef.current.scrollToIndex(messagesListProps.messages.length - 1, {
61
- align: 'end'
62
- });
59
+ if (height > 30) {
60
+ /*
61
+ setTimeout is used to equal the animation duration from the
62
+ composer text area when increase its size
63
+ */
64
+ setTimeout(() => {
65
+ actionRef.current.scrollToIndex(messagesListProps.messages.length - 1, {
66
+ align: 'start'
67
+ });
68
+ }, 50);
63
69
  }
64
- }, [onComposerResize, messagesListProps.messages, autoScroll]);
70
+ }, [onComposerResize, messagesListProps.messages, actionRef]);
65
71
  const Container = device === 'desktop' ? StyledChatContainerContent : MobileStyledChatContainerContent;
66
72
  const handleTabs = React.useCallback(e => {
67
73
  if (onComposerKeyDown) onComposerKeyDown(e);else {
@@ -90,7 +96,7 @@ const ChatContainer = props => {
90
96
  rows: ['minmax(0, 1fr)', 'auto'],
91
97
  ref: containerRef,
92
98
  role: "region",
93
- "aria-label": "chat window",
99
+ "aria-label": ariaLabel,
94
100
  children: [/*#__PURE__*/_jsx("div", {
95
101
  style: {
96
102
  position: 'relative',
@@ -1,7 +1,7 @@
1
1
  import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
2
2
 
3
- const useValidateProps = (props, schema) => {
4
- useValidateTypescriptPropTypes(props, schema);
3
+ const useValidateProps = (props, propTypes) => {
4
+ useValidateTypescriptPropTypes(props, propTypes);
5
5
  };
6
6
 
7
7
  export { useValidateProps };
@@ -1,5 +1,6 @@
1
1
  import { PropTypes } from 'react-desc';
2
2
  import { noop } from 'lodash';
3
+ import { BANNER_TYPES } from '@elliemae/ds-banner';
3
4
  import { defaultProps as defaultProps$1 } from '../chat-container-messages-list/props.js';
4
5
  import { defaultComposerPros } from '../chat-composer/props.js';
5
6
 
@@ -14,13 +15,15 @@ const defaultProps = {
14
15
  getMoreMessages: noop,
15
16
  bannerPosition: undefined,
16
17
  bannerProps: {
18
+ type: BANNER_TYPES.INFO,
17
19
  label: 'Unread Messages',
18
20
  viewLabel: 'View',
19
21
  onView: noop,
20
22
  onClose: noop
21
23
  },
22
24
  sendingMessages: undefined,
23
- sendingText: 'Sending'
25
+ sendingText: 'Sending',
26
+ ariaLabel: 'Chat window'
24
27
  };
25
28
  const containerProps = {
26
29
  messagesListProps: PropTypes.object.description('ChatMessageList props "messages" / "onScrollEnds"').defaultValue(defaultProps.messagesListProps),
@@ -34,7 +37,8 @@ const containerProps = {
34
37
  bannerProps: PropTypes.object.description("Banner configuration:\n label: string;\n viewLabel: string;\n type: BANNER_TYPES;\n onView: () => void;\n onClose: () => void;\n ").defaultValue(defaultProps.bannerProps),
35
38
  sendingMessages: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.number)]).description('Array of ids of sending messages').defaultValue(defaultProps.sendingMessages),
36
39
  sendingText: PropTypes.string.description('Label description for messages in sending status').defaultValue(defaultProps.sendingText),
37
- actionRef: PropTypes.object.description("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 ").defaultValue(defaultProps.actionRef)
40
+ actionRef: PropTypes.object.description("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 ").defaultValue(defaultProps.actionRef),
41
+ ariaLabel: PropTypes.string.description('Aria Label description for chat container').defaultValue(defaultProps.ariaLabel)
38
42
  };
39
43
 
40
44
  export { containerProps, defaultProps };
@@ -2,8 +2,10 @@ import 'core-js/modules/esnext.async-iterator.filter.js';
2
2
  import 'core-js/modules/esnext.iterator.filter.js';
3
3
  import _jsx from '@babel/runtime/helpers/esm/jsx';
4
4
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
5
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
+ import 'core-js/modules/esnext.async-iterator.some.js';
6
6
  import 'core-js/modules/esnext.iterator.constructor.js';
7
+ import 'core-js/modules/esnext.iterator.some.js';
8
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
7
9
  import 'core-js/modules/esnext.iterator.for-each.js';
8
10
  import 'core-js/modules/esnext.async-iterator.map.js';
9
11
  import 'core-js/modules/esnext.iterator.map.js';
@@ -26,17 +28,22 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
26
28
 
27
29
  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; }
28
30
 
29
- const getPadding = hasMoreItems => {
31
+ const getPadding = _ref => {
32
+ let {
33
+ hasMoreItems,
34
+ bannerPosition,
35
+ isLoading
36
+ } = _ref;
30
37
  const padding = {
31
38
  paddingStart: 0,
32
39
  paddingEnd: -5
33
40
  };
34
- if (hasMoreItems === 'top') padding.paddingStart = 42;else if (hasMoreItems === 'bottom') padding.paddingEnd = 42;
41
+ if ([hasMoreItems, bannerPosition, isLoading].some(item => item === 'top')) padding.paddingStart = 42;else if ([hasMoreItems, bannerPosition, isLoading].some(item => item === 'bottom')) padding.paddingEnd = 42;
35
42
  return padding;
36
43
  };
37
44
 
38
45
  const ChatContainerMessagesList = props => {
39
- useValidateProps(props, ChatContainerMessagesListWithSchema.toTypescript());
46
+ useValidateProps(props, listProps);
40
47
  const {
41
48
  sendingText,
42
49
  bannerPosition,
@@ -61,7 +68,11 @@ const ChatContainerMessagesList = props => {
61
68
  size: messages.length,
62
69
  parentRef: virtualListRef,
63
70
  overscan: 15
64
- }, getPadding(hasMoreItems)), {}, {
71
+ }, getPadding({
72
+ hasMoreItems,
73
+ bannerPosition,
74
+ isLoading
75
+ })), {}, {
65
76
  estimateSize: React.useCallback(() => 80, [])
66
77
  }));
67
78
  const onScrollStop = React.useCallback(() => {
@@ -1,7 +1,7 @@
1
1
  import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
2
2
 
3
- const useValidateProps = (props, schema) => {
4
- useValidateTypescriptPropTypes(props, schema);
3
+ const useValidateProps = (props, propTypes) => {
4
+ useValidateTypescriptPropTypes(props, propTypes);
5
5
  };
6
6
 
7
7
  export { useValidateProps };
@@ -3,18 +3,24 @@ import 'react';
3
3
  import { Comments } from '@elliemae/ds-icons';
4
4
  import { StyledFloatingButton } from './styled.js';
5
5
  import { defaultFloatingButton } from './props.js';
6
+ import { jsx } from 'react/jsx-runtime';
6
7
 
7
8
  var _Comments;
8
9
  const FloatingButton = _ref => {
9
10
  let {
10
- onClick
11
+ onClick,
12
+ onFocus,
13
+ innerRef
11
14
  } = _ref;
12
- return /*#__PURE__*/_jsx(StyledFloatingButton, {
15
+ return /*#__PURE__*/jsx(StyledFloatingButton, {
16
+ onFocus: onFocus,
17
+ ref: innerRef,
13
18
  "data-testid": "chat-floating-button",
14
- onClick: onClick
15
- }, void 0, _Comments || (_Comments = /*#__PURE__*/_jsx(Comments, {
16
- size: "l"
17
- })));
19
+ onClick: onClick,
20
+ children: _Comments || (_Comments = /*#__PURE__*/_jsx(Comments, {
21
+ size: "l"
22
+ }))
23
+ });
18
24
  };
19
25
  FloatingButton.defaultProps = defaultFloatingButton;
20
26
 
@@ -2,10 +2,14 @@ import { PropTypes } from 'react-desc';
2
2
  import { noop } from 'lodash';
3
3
 
4
4
  const defaultFloatingButton = {
5
- onClick: noop
5
+ onClick: noop,
6
+ onFocus: noop,
7
+ innerRef: null
6
8
  };
7
9
  const propsFloatingButton = {
8
- onClick: PropTypes.func.description('The function to call when the chat is opened via the footer').defaultValue(defaultFloatingButton.onClick)
10
+ onClick: PropTypes.func.description('The function to call when the chat is opened via the footer').defaultValue(defaultFloatingButton.onClick),
11
+ onFocus: PropTypes.func.description('The function to call when button is being focused').defaultValue(defaultFloatingButton.onFocus),
12
+ innerRef: PropTypes.object.description('Ref to the component container').defaultValue(null)
9
13
  };
10
14
 
11
15
  export { defaultFloatingButton, propsFloatingButton };
@@ -1,7 +1,9 @@
1
- import styled, { css } from 'styled-components';
1
+ import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
+ import styled from 'styled-components';
3
+ import { css } from '@elliemae/ds-system';
2
4
  import { Grid } from '@elliemae/ds-grid';
3
5
 
4
- /* eslint-disable indent */
6
+ var _templateObject;
5
7
  const MIN_WIDTH_SIDEBAR = 48;
6
8
  const BUTTON_SIDEBAR_HEIGHT = 48; // Buttons
7
9
 
@@ -64,7 +66,7 @@ const StyledTileButton = /*#__PURE__*/styled.button.withConfig({
64
66
  }
65
67
  }, StyledWrapperLeftBorder, props => props.theme.colors.brand[800], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.brand[800], props => props.theme.colors.neutral['050'], StyledWrapperLeftBorder, props => props.theme.colors.brand[600], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.brand[600], StyledStatusBadge, props => props.theme.colors.neutral['050'], props => props.theme.colors.neutral['080'], StyledWrapperLeftBorder, props => props.theme.colors.neutral['400'], StyledStatusBadge, props => props.theme.colors.neutral['500'], props => props.theme.colors.neutral['080'], StyledTileButtonIcon, props => props.theme.colors.neutral[400], StyledTileButtonLabel, props => props.theme.colors.neutral[400], props => {
66
68
  if (props.selected) {
67
- return css(["& ", "{background:", ";}"], StyledWrapperLeftBorder, nestedProps => nestedProps.theme.colors.brand[600]);
69
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & ", " {\n background: ", ";\n }\n "])), StyledWrapperLeftBorder, nestedProps => nestedProps.theme.colors.brand[600]);
68
70
  }
69
71
 
70
72
  return '';