@elliemae/ds-chat 2.0.0-alpha.10 → 2.0.0-alpha.14

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 (123) hide show
  1. package/cjs/ChatDataTestids.js +27 -0
  2. package/cjs/parts/bubble/ChatBubble.js +15 -12
  3. package/cjs/parts/bubble/ChatBubbleArrow.js +64 -61
  4. package/cjs/parts/bubble/config/useValidateProps.js +5 -6
  5. package/cjs/parts/bubble/props.js +1 -1
  6. package/cjs/parts/bubble/styled.js +2 -31
  7. package/cjs/parts/chat-card/props.js +2 -2
  8. package/cjs/parts/chat-composer/ChatContainerComposer.js +16 -8
  9. package/cjs/parts/chat-composer/props.js +5 -11
  10. package/cjs/parts/chat-composer/styled.js +4 -4
  11. package/cjs/parts/chat-container/ChatContainer.js +67 -20
  12. package/cjs/parts/chat-container/config/useValidateProps.js +2 -2
  13. package/cjs/parts/chat-container/props.js +7 -13
  14. package/cjs/parts/chat-container/styled.js +2 -2
  15. package/cjs/parts/chat-container-header/ChatContainerHeader.js +3 -3
  16. package/cjs/parts/chat-container-header/helpers.js +31 -0
  17. package/cjs/parts/chat-container-header/styled.js +6 -6
  18. package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +156 -40
  19. package/cjs/parts/chat-container-messages-list/config/useValidateProps.js +2 -2
  20. package/cjs/parts/chat-container-messages-list/props.js +5 -13
  21. package/cjs/parts/chat-container-messages-list/styled.js +2 -6
  22. package/cjs/parts/chat-empty-state/ChatEmptyState.js +2 -3
  23. package/cjs/parts/chat-sidebar/SideBarChat.js +57 -29
  24. package/cjs/parts/chat-sidebar/props.js +11 -1
  25. package/cjs/parts/chat-sidebar/styled.js +2 -2
  26. package/cjs/parts/floating-button/FloatingButton.js +18 -10
  27. package/cjs/parts/floating-button/props.js +6 -2
  28. package/cjs/parts/grid-influencer/styled.js +2 -6
  29. package/cjs/parts/message-delimiter/styled.js +1 -1
  30. package/cjs/parts/sidebar-button/SidebarButton.js +6 -1
  31. package/cjs/parts/sidebar-button/props.js +2 -3
  32. package/cjs/parts/system-message/style.js +1 -1
  33. package/cjs/parts/tile-button/TileButton.js +31 -28
  34. package/cjs/parts/tile-button/props.js +12 -8
  35. package/cjs/parts/tile-button/styled.js +12 -5
  36. package/cjs/styled.js +1 -1
  37. package/esm/ChatDataTestids.js +23 -0
  38. package/esm/parts/bubble/ChatBubble.js +14 -11
  39. package/esm/parts/bubble/ChatBubbleArrow.js +64 -61
  40. package/esm/parts/bubble/config/useValidateProps.js +5 -6
  41. package/esm/parts/bubble/props.js +1 -1
  42. package/esm/parts/bubble/styled.js +2 -31
  43. package/esm/parts/chat-card/props.js +2 -2
  44. package/esm/parts/chat-composer/ChatContainerComposer.js +15 -6
  45. package/esm/parts/chat-composer/props.js +5 -11
  46. package/esm/parts/chat-composer/styled.js +2 -2
  47. package/esm/parts/chat-container/ChatContainer.js +65 -18
  48. package/esm/parts/chat-container/config/useValidateProps.js +2 -2
  49. package/esm/parts/chat-container/props.js +7 -13
  50. package/esm/parts/chat-container/styled.js +2 -2
  51. package/esm/parts/chat-container-header/ChatContainerHeader.js +3 -2
  52. package/esm/parts/chat-container-header/helpers.js +23 -0
  53. package/esm/parts/chat-container-header/styled.js +6 -6
  54. package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +154 -38
  55. package/esm/parts/chat-container-messages-list/config/useValidateProps.js +2 -2
  56. package/esm/parts/chat-container-messages-list/props.js +5 -13
  57. package/esm/parts/chat-container-messages-list/styled.js +2 -6
  58. package/esm/parts/chat-empty-state/ChatEmptyState.js +1 -1
  59. package/esm/parts/chat-sidebar/SideBarChat.js +57 -28
  60. package/esm/parts/chat-sidebar/props.js +11 -1
  61. package/esm/parts/chat-sidebar/styled.js +2 -2
  62. package/esm/parts/floating-button/FloatingButton.js +18 -9
  63. package/esm/parts/floating-button/props.js +6 -2
  64. package/esm/parts/grid-influencer/styled.js +2 -6
  65. package/esm/parts/message-delimiter/styled.js +1 -1
  66. package/esm/parts/sidebar-button/SidebarButton.js +6 -1
  67. package/esm/parts/sidebar-button/props.js +1 -1
  68. package/esm/parts/system-message/style.js +1 -1
  69. package/esm/parts/tile-button/TileButton.js +32 -27
  70. package/esm/parts/tile-button/props.js +11 -3
  71. package/esm/parts/tile-button/styled.js +12 -7
  72. package/esm/styled.js +1 -1
  73. package/package.json +29 -6
  74. package/types/ChatDataTestids.d.ts +21 -0
  75. package/types/parts/bubble/ChatBubble.d.ts +18 -5
  76. package/types/parts/bubble/props.d.ts +13 -4
  77. package/types/parts/bubble/styled.d.ts +9 -9
  78. package/types/parts/bubble/tests/ChatBubble.test.d.ts +1 -0
  79. package/types/parts/chat-card/ChatCard.d.ts +24 -4
  80. package/types/parts/chat-card/props.d.ts +19 -3
  81. package/types/parts/chat-card/styled.d.ts +6 -6
  82. package/types/parts/chat-composer/ChatContainerComposer.d.ts +48 -13
  83. package/types/parts/chat-composer/styled.d.ts +117 -24
  84. package/types/parts/chat-composer/tests/ChatContainerComposer.test.d.ts +1 -0
  85. package/types/parts/chat-container/ChatContainer.d.ts +54 -13
  86. package/types/parts/chat-container/config/useValidateProps.d.ts +1 -1
  87. package/types/parts/chat-container/styled.d.ts +4 -4
  88. package/types/parts/chat-container/tests/ChatContainer.test.d.ts +1 -0
  89. package/types/parts/chat-container-header/helpers.d.ts +6 -0
  90. package/types/parts/chat-container-header/styled.d.ts +3 -3
  91. package/types/parts/chat-container-messages-list/ChatContainerMessagesList.d.ts +39 -9
  92. package/types/parts/chat-container-messages-list/config/useValidateProps.d.ts +1 -1
  93. package/types/parts/chat-container-messages-list/styled.d.ts +7 -7
  94. package/types/parts/chat-empty-state/ChatEmptyState.d.ts +12 -3
  95. package/types/parts/chat-empty-state/props.d.ts +7 -2
  96. package/types/parts/chat-empty-state/styled.d.ts +2 -2
  97. package/types/parts/chat-sidebar/SideBarChat.d.ts +39 -9
  98. package/types/parts/chat-sidebar/props.d.ts +39 -9
  99. package/types/parts/chat-sidebar/styled.d.ts +2 -2
  100. package/types/parts/floating-button/FloatingButton.d.ts +11 -2
  101. package/types/parts/floating-button/props.d.ts +13 -1
  102. package/types/parts/floating-button/styled.d.ts +1 -1
  103. package/types/parts/floating-container/styled.d.ts +1 -2
  104. package/types/parts/grid-influencer/styled.d.ts +2 -2
  105. package/types/parts/message-delimiter/MessageDelimiter.d.ts +21 -4
  106. package/types/parts/message-delimiter/props.d.ts +16 -3
  107. package/types/parts/message-delimiter/styled.d.ts +3 -3
  108. package/types/parts/sidebar-button/SidebarButton.d.ts +16 -5
  109. package/types/parts/sidebar-button/props.d.ts +16 -5
  110. package/types/parts/sidebar-button/styled.d.ts +3 -3
  111. package/types/parts/system-message/SystemMessage.d.ts +12 -2
  112. package/types/parts/system-message/props.d.ts +7 -1
  113. package/types/parts/system-message/style.d.ts +5 -5
  114. package/types/parts/tile-button/TileButton.d.ts +66 -17
  115. package/types/parts/tile-button/props.d.ts +64 -16
  116. package/types/parts/tile-button/styled.d.ts +9 -8
  117. package/types/prop-types.d.ts +28 -9
  118. package/types/tests/utils.d.ts +27 -0
  119. package/cjs/package.json +0 -4
  120. package/esm/package.json +0 -4
  121. package/types/parts/chat-composer/props.d.ts +0 -35
  122. package/types/parts/chat-container/props.d.ts +0 -39
  123. package/types/parts/chat-container-messages-list/props.d.ts +0 -23
@@ -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;
@@ -4,9 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  require('core-js/modules/web.url.to-json.js');
7
- require('react');
7
+ require('core-js/modules/esnext.async-iterator.map.js');
8
+ require('core-js/modules/esnext.iterator.map.js');
9
+ var React = require('react');
8
10
  var reactDesc = require('react-desc');
9
- var Warning = require('@elliemae/ds-icons/WarningCircleFill');
11
+ var dsIcons = require('@elliemae/ds-icons');
10
12
  var styled = require('./styled.js');
11
13
  var props = require('./props.js');
12
14
  var useValidateProps = require('./config/useValidateProps.js');
@@ -15,9 +17,9 @@ var ChatBubbleArrow = require('./ChatBubbleArrow.js');
15
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
18
 
17
19
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
18
- var Warning__default = /*#__PURE__*/_interopDefaultLegacy(Warning);
20
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
21
 
20
- var _Warning;
22
+ var _br, _WarningCircleFill;
21
23
 
22
24
  const ChatBubble = props => {
23
25
  useValidateProps.useValidateProps(props, ChatBubbleWithSchema.toJSON());
@@ -30,8 +32,9 @@ const ChatBubble = props => {
30
32
  errorMessage,
31
33
  helpMessage
32
34
  } = props;
35
+ const bodyParts = React__default["default"].useMemo(() => typeof body === 'string' ? body.split('\n') : [body], [body]);
33
36
  return /*#__PURE__*/_jsx__default["default"](styled.StyledWrapper, {
34
- "data-testid": `ds-chat-bubble-${dsId}`,
37
+ "data-testid": "ds-chat-bubble-".concat(dsId),
35
38
  type: type
36
39
  }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledColoredBubble, {
37
40
  type: type
@@ -42,22 +45,22 @@ const ChatBubble = props => {
42
45
  className: "sr-only"
43
46
  }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledTitleLeftBubble, {
44
47
  alignItems: "center",
45
- "data-testid": `chat-bubble-title-${dsId}`
48
+ "data-testid": "chat-bubble-title-".concat(dsId)
46
49
  }, void 0, title), /*#__PURE__*/_jsx__default["default"](styled.StyledTitleRightBubble, {
47
50
  alignItems: "center",
48
51
  type: type,
49
- "data-testid": `chat-bubble-time-${dsId}`
52
+ "data-testid": "chat-bubble-time-".concat(dsId)
50
53
  }, void 0, time)), /*#__PURE__*/_jsx__default["default"](styled.StyleBodyWrapper, {
51
- "data-testid": `chat-bubble-body-${dsId}`
52
- }, void 0, body), /*#__PURE__*/_jsx__default["default"](ChatBubbleArrow.ChatBubbleArrow, {
54
+ "data-testid": "chat-bubble-body-".concat(dsId)
55
+ }, void 0, bodyParts.map((item, index) => /*#__PURE__*/_jsx__default["default"](React__default["default"].Fragment, {}, "".concat(item, "-").concat(index), item, index < bodyParts.length - 1 ? _br || (_br = /*#__PURE__*/_jsx__default["default"]("br", {})) : null))), /*#__PURE__*/_jsx__default["default"](ChatBubbleArrow.ChatBubbleArrow, {
53
56
  type: type
54
57
  })), errorMessage ? /*#__PURE__*/_jsx__default["default"](styled.StyleErrorMessage, {
55
- "data-testid": `chat-bubble-error-message-${dsId}`,
58
+ "data-testid": "chat-bubble-error-message-".concat(dsId),
56
59
  p: "xxs",
57
60
  gutter: "xxs",
58
61
  cols: [1, 'auto']
59
- }, void 0, /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, errorMessage), _Warning || (_Warning = /*#__PURE__*/_jsx__default["default"](Warning__default["default"], {}))) : null, helpMessage ? /*#__PURE__*/_jsx__default["default"](styled.StyleHelpMessage, {
60
- "data-testid": `chat-bubble-help-message-${dsId}`,
62
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, errorMessage), _WarningCircleFill || (_WarningCircleFill = /*#__PURE__*/_jsx__default["default"](dsIcons.WarningCircleFill, {}))) : null, helpMessage ? /*#__PURE__*/_jsx__default["default"](styled.StyleHelpMessage, {
63
+ "data-testid": "chat-bubble-help-message-".concat(dsId),
61
64
  p: "xxs",
62
65
  gutter: "xxs",
63
66
  cols: [1, 'auto']
@@ -12,66 +12,69 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
12
12
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
13
13
 
14
14
  var _svg, _svg2;
15
- const ChatBubbleArrow = ({
16
- type
17
- }) => /*#__PURE__*/_jsx__default["default"](styled.StyledBubbleArrow, {}, void 0, type === props.BUBBLE_TYPES.RECIPIENT ? _svg || (_svg = /*#__PURE__*/_jsx__default["default"]("svg", {
18
- width: "15px",
19
- height: "14px",
20
- viewBox: "0 0 15 14"
21
- }, void 0, /*#__PURE__*/_jsx__default["default"]("defs", {}, void 0, /*#__PURE__*/_jsx__default["default"]("path", {
22
- 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",
23
- id: "path-1"
24
- }), /*#__PURE__*/_jsx__default["default"]("filter", {
25
- x: "-55.6%",
26
- y: "-50.0%",
27
- width: "211.1%",
28
- height: "225.0%",
29
- filterUnits: "objectBoundingBox",
30
- id: "filter-2"
31
- }, void 0, /*#__PURE__*/_jsx__default["default"]("feOffset", {
32
- dx: "2.3",
33
- dy: "1.2",
34
- in: "SourceAlpha",
35
- result: "shadowOffsetOuter1"
36
- }), /*#__PURE__*/_jsx__default["default"]("feGaussianBlur", {
37
- stdDeviation: "1.5",
38
- in: "shadowOffsetOuter1",
39
- result: "shadowBlurOuter1"
40
- }), /*#__PURE__*/_jsx__default["default"]("feColorMatrix", {
41
- values: "0 0 0 0 0.207843137 0 0 0 0 0.235294118 0 0 0 0 0.274509804 0 0 0 0.8 0",
42
- type: "matrix",
43
- in: "shadowBlurOuter1"
44
- }))), /*#__PURE__*/_jsx__default["default"]("g", {
45
- id: "[DSK]-Visual-Design",
46
- stroke: "none",
47
- strokeWidth: "1",
48
- fill: "none",
49
- fillRule: "evenodd"
50
- }, void 0, /*#__PURE__*/_jsx__default["default"]("g", {
51
- id: "Path-Copy",
52
- transform: "translate(7.500000, 6.000000) scale(-1, 1) translate(-7.500000, -6.000000) "
53
- }, void 0, /*#__PURE__*/_jsx__default["default"]("use", {
54
- fill: "black",
55
- fillOpacity: "1",
56
- filter: "url(#filter-2)",
57
- xlinkHref: "#path-1"
58
- }), /*#__PURE__*/_jsx__default["default"]("use", {
59
- fill: "#FFFFFF",
60
- fillRule: "evenodd",
61
- xlinkHref: "#path-1"
62
- }))))) : _svg2 || (_svg2 = /*#__PURE__*/_jsx__default["default"]("svg", {
63
- width: "9px",
64
- height: "8px",
65
- viewBox: "0 0 9 8"
66
- }, void 0, /*#__PURE__*/_jsx__default["default"]("g", {
67
- stroke: "none",
68
- strokeWidth: "1",
69
- fill: "none",
70
- fillRule: "evenodd"
71
- }, void 0, /*#__PURE__*/_jsx__default["default"]("path", {
72
- d: "M9,6.5 C9,5.9373169 8.6782751,5.4856453 8.2282104,5.196228 C8.2286673,5.1967363 0,0 0,0 L0,8 L7.5627441,8 L7.5658569,7.9933472 C8.3630371,7.9580688 9,7.3058472 9,6.5 Z",
73
- id: "Path",
74
- fill: "#1E79C2"
75
- })))));
15
+ const ChatBubbleArrow = _ref => {
16
+ let {
17
+ type
18
+ } = _ref;
19
+ return /*#__PURE__*/_jsx__default["default"](styled.StyledBubbleArrow, {}, void 0, type === props.BUBBLE_TYPES.RECIPIENT ? _svg || (_svg = /*#__PURE__*/_jsx__default["default"]("svg", {
20
+ width: "15px",
21
+ height: "14px",
22
+ viewBox: "0 0 15 14"
23
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("defs", {}, void 0, /*#__PURE__*/_jsx__default["default"]("path", {
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-chat-bubble"
26
+ }), /*#__PURE__*/_jsx__default["default"]("filter", {
27
+ x: "-55.6%",
28
+ y: "-50.0%",
29
+ width: "211.1%",
30
+ height: "225.0%",
31
+ filterUnits: "objectBoundingBox",
32
+ id: "filter-2"
33
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("feOffset", {
34
+ dx: "2.3",
35
+ dy: "1.2",
36
+ in: "SourceAlpha",
37
+ result: "shadowOffsetOuter1"
38
+ }), /*#__PURE__*/_jsx__default["default"]("feGaussianBlur", {
39
+ stdDeviation: "1.5",
40
+ in: "shadowOffsetOuter1",
41
+ result: "shadowBlurOuter1"
42
+ }), /*#__PURE__*/_jsx__default["default"]("feColorMatrix", {
43
+ values: "0 0 0 0 0.207843137 0 0 0 0 0.235294118 0 0 0 0 0.274509804 0 0 0 0.8 0",
44
+ type: "matrix",
45
+ in: "shadowBlurOuter1"
46
+ }))), /*#__PURE__*/_jsx__default["default"]("g", {
47
+ id: "[DSK]-Visual-Design",
48
+ stroke: "none",
49
+ strokeWidth: "1",
50
+ fill: "none",
51
+ fillRule: "evenodd"
52
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("g", {
53
+ id: "Path-Copy",
54
+ transform: "translate(7.500000, 6.000000) scale(-1, 1) translate(-7.500000, -6.000000) "
55
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("use", {
56
+ fill: "black",
57
+ fillOpacity: "1",
58
+ filter: "url(#filter-2)",
59
+ xlinkHref: "#path-chat-bubble"
60
+ }), /*#__PURE__*/_jsx__default["default"]("use", {
61
+ fill: "#FFFFFF",
62
+ fillRule: "evenodd",
63
+ xlinkHref: "#path-chat-bubble"
64
+ }))))) : _svg2 || (_svg2 = /*#__PURE__*/_jsx__default["default"]("svg", {
65
+ width: "9px",
66
+ height: "8px",
67
+ viewBox: "0 0 9 8"
68
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("g", {
69
+ stroke: "none",
70
+ strokeWidth: "1",
71
+ fill: "none",
72
+ fillRule: "evenodd"
73
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("path", {
74
+ d: "M9,6.5 C9,5.9373169 8.6782751,5.4856453 8.2282104,5.196228 C8.2286673,5.1967363 0,0 0,0 L0,8 L7.5627441,8 L7.5658569,7.9933472 C8.3630371,7.9580688 9,7.3058472 9,6.5 Z",
75
+ id: "Path",
76
+ fill: "#1E79C2"
77
+ })))));
78
+ };
76
79
 
77
80
  exports.ChatBubbleArrow = ChatBubbleArrow;
@@ -5,27 +5,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var dsPropsHelpers = require('@elliemae/ds-props-helpers');
6
6
 
7
7
  const throwError = message => {
8
- throw new Error(`Bubble:: ${message}
9
- `);
8
+ throw new Error("Bubble:: ".concat(message, "\n "));
10
9
  };
11
10
 
12
11
  const useValidateProps = (props, schema) => {
13
12
  dsPropsHelpers.useValidatePropTypes(props, schema);
14
13
 
15
14
  if (typeof props.title === 'undefined') {
16
- throwError(`Please provide a title property to use this component.`);
15
+ throwError("Please provide a title property to use this component.");
17
16
  }
18
17
 
19
18
  if (typeof props.time === 'undefined') {
20
- throwError(`Please provide a time property to use this component.`);
19
+ throwError("Please provide a time property to use this component.");
21
20
  }
22
21
 
23
22
  if (typeof props.body === 'undefined') {
24
- throwError(`Please provide a body property to use this component.`);
23
+ throwError("Please provide a body property to use this component.");
25
24
  }
26
25
 
27
26
  if (typeof props.type === 'undefined') {
28
- throwError(`Please provide a type property to use this component.`);
27
+ throwError("Please provide a type property to use this component.");
29
28
  }
30
29
  };
31
30
 
@@ -36,7 +36,7 @@ const propsBubbles = {
36
36
  type: reactDesc.PropTypes.oneOf([BUBBLE_TYPES.RECIPIENT, BUBBLE_TYPES.SENDER]).isRequired.description('Define bubble type ').defaultValue(defaultBubbleProps.type),
37
37
  title: reactDesc.PropTypes.string.isRequired.description('Title of the bubble').defaultValue(defaultBubbleProps.title),
38
38
  time: reactDesc.PropTypes.string.isRequired.description('Time of the bubble').defaultValue(defaultBubbleProps.title),
39
- body: reactDesc.PropTypes.oneOf(['string', 'element']).isRequired.description('Bubble content').defaultValue(defaultBubbleProps.body),
39
+ body: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.element]).isRequired.description('Bubble content').defaultValue(defaultBubbleProps.body),
40
40
  onClick: reactDesc.PropTypes.string.description('Callback when the bubble is tapped').defaultValue(defaultBubbleProps.onClick),
41
41
  errorMessage: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.element]).description('Error message to display at bottom of the bubble').defaultValue(defaultBubbleProps.onClick),
42
42
  helpMessage: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.element]).description('Help message to display at bottom of the bubble').defaultValue(defaultBubbleProps.onClick)
@@ -30,7 +30,7 @@ const StyleBodyWrapper = /*#__PURE__*/styled__default["default"].div.withConfig(
30
30
  })(["font-size:13px;font-weight:400;line-height:15px;min-height:18px;padding:0px 10px 8px 10px;"]);
31
31
  const StyleErrorMessage = /*#__PURE__*/styled__default["default"].div.withConfig({
32
32
  componentId: "sc-fe8e9o-5"
33
- })(["font-size:12px;font-weight:400;padding-top:", ";padding-bottom:", ";color:", ";align-items:flex-end;justify-content:center;text-align:right;line-height:15px;svg{fill:", ";}a{font-size:12px;color:", ";}.em-ds-icon{margin-left:8px;}"], props => props.theme.space.xxxs, props => props.theme.space.xxxs, props => props.theme.colors.danger[900], props => props.theme.colors.danger[900], props => props.theme.colors.danger[900]);
33
+ })(["font-size:12px;font-weight:400;padding-top:", ";color:", ";align-items:flex-end;justify-content:center;text-align:right;line-height:15px;svg{fill:", ";}a{font-size:12px;color:", ";}.em-ds-icon{margin-left:8px;}"], props => props.theme.space.xxxs, props => props.theme.colors.danger[900], props => props.theme.colors.danger[900], props => props.theme.colors.danger[900]);
34
34
  const StyleHelpMessage = /*#__PURE__*/styled__default["default"](StyleErrorMessage).withConfig({
35
35
  componentId: "sc-fe8e9o-6"
36
36
  })(["font-size:12px;line-height:15px;color:", ";svg{fill:", ";}a{font-size:12px;color:", ";}"], props => props.theme.colors.neutral[500], props => props.theme.colors.danger[500], props => props.theme.colors.danger[500]); // bubble sender/ recipient
@@ -40,36 +40,7 @@ const StyledBubbleArrow = /*#__PURE__*/styled__default["default"].div.withConfig
40
40
  })(["display:block;content:'';position:absolute;bottom:10px;height:15px;"]);
41
41
  const StyledColoredBubble = /*#__PURE__*/styled__default["default"].div.withConfig({
42
42
  componentId: "sc-fe8e9o-8"
43
- })(["min-width:224px;border-radius:10px;position:relative;", ""], props$1 => props$1.type === props.BUBBLE_TYPES.SENDER ? `
44
- border: 1px solid ${props$1.theme.colors.brand['700']};
45
- background: ${props$1.theme.colors.brand[600]};
46
- color: ${props$1.theme.colors.neutral['000']};
47
- ${StyledBubbleArrow}{
48
- right: -9px;
49
- bottom: 6px;
50
- svg{
51
- fill: ${props$1.theme.colors.brand[600]};
52
- }
53
- }
54
-
55
- a {
56
- color: #FFF;
57
- }
58
-
59
- ` : `
60
- box-shadow: 0 1px 3px 0 rgba(53,60,70,0.80);
61
- background: ${props$1.theme.colors.neutral['000']};
62
- color: ${props$1.theme.colors.neutral[700]};
63
-
64
- ${StyledBubbleArrow}{
65
- left: -11px;
66
- bottom: 6px;
67
- svg{
68
- fill: ${props$1.theme.colors.neutral['000']};
69
- }
70
- }
71
-
72
- `);
43
+ })(["min-width:224px;border-radius:10px;position:relative;", ""], props$1 => props$1.type === props.BUBBLE_TYPES.SENDER ? "\n border: 1px solid ".concat(props$1.theme.colors.brand['700'], ";\n background: ").concat(props$1.theme.colors.brand[600], ";\n color: ").concat(props$1.theme.colors.neutral['000'], ";\n ").concat(StyledBubbleArrow, "{ \n right: -9px;\n bottom: 6px;\n svg{\n fill: ").concat(props$1.theme.colors.brand[600], ";\n }\n }\n\n a {\n color: #FFF;\n }\n\n ") : "\n box-shadow: 0 1px 3px 0 rgba(53,60,70,0.80);\n background: ".concat(props$1.theme.colors.neutral['000'], ";\n color: ").concat(props$1.theme.colors.neutral[700], ";\n\n ").concat(StyledBubbleArrow, "{ \n left: -11px;\n bottom: 6px;\n svg{\n fill: ").concat(props$1.theme.colors.neutral['000'], ";\n }\n }\n\n "));
73
44
 
74
45
  exports.StyleBodyWrapper = StyleBodyWrapper;
75
46
  exports.StyleErrorMessage = StyleErrorMessage;
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var reactDesc = require('react-desc');
6
6
 
7
7
  const propTypes = {
8
- title: reactDesc.PropTypes.string.isRequired.description(`Card's title`),
9
- content: reactDesc.PropTypes.string.description(`Card's content`),
8
+ title: reactDesc.PropTypes.string.isRequired.description("Card's title"),
9
+ content: reactDesc.PropTypes.string.description("Card's content"),
10
10
  time: reactDesc.PropTypes.string.description('Time'),
11
11
  rightAddon: reactDesc.PropTypes.element.description('Right addon, badge or icon')
12
12
  };
@@ -5,10 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
7
  require('core-js/modules/web.url.to-json.js');
8
+ require('core-js/modules/web.dom-collections.iterator.js');
9
+ require('core-js/modules/esnext.async-iterator.filter.js');
10
+ require('core-js/modules/esnext.iterator.constructor.js');
11
+ require('core-js/modules/esnext.iterator.filter.js');
12
+ require('core-js/modules/esnext.async-iterator.for-each.js');
13
+ require('core-js/modules/esnext.iterator.for-each.js');
8
14
  var React = require('react');
9
15
  var dsGrid = require('@elliemae/ds-grid');
10
16
  var reactDesc = require('react-desc');
11
- var PaperAirplane = require('@elliemae/ds-icons/PaperAirplane');
17
+ var dsIcons = require('@elliemae/ds-icons');
12
18
  var styled = require('./styled.js');
13
19
  var useValidateProps = require('./config/useValidateProps.js');
14
20
  var props = require('./props.js');
@@ -19,7 +25,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
25
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
20
26
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
21
27
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
- var PaperAirplane__default = /*#__PURE__*/_interopDefaultLegacy(PaperAirplane);
23
28
 
24
29
  var _PaperAirplane, _Grid;
25
30
 
@@ -38,9 +43,11 @@ const ChatComposer = props => {
38
43
  onSend,
39
44
  onFocus,
40
45
  onBlur,
46
+ onKeyDown,
41
47
  maxHeight = 300,
42
48
  placeholder,
43
49
  inputMaxLength,
50
+ maxLengthMessage,
44
51
  buttonDisabled,
45
52
  dataTestid,
46
53
  actionRef
@@ -58,7 +65,7 @@ const ChatComposer = props => {
58
65
  onResize(newHeight);
59
66
  setHeight(newHeight);
60
67
  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);
61
- }, [inputValue, internalMaxHeight]);
68
+ }, [inputValue, internalMaxHeight, onResize]);
62
69
  React__default["default"].useEffect(() => {
63
70
  if (actionRef && actionRef.current) {
64
71
  actionRef.current.focusToComposer = () => {
@@ -69,7 +76,7 @@ const ChatComposer = props => {
69
76
  inputSend.current.focus();
70
77
  };
71
78
  }
72
- }, [actionRef.current]);
79
+ }, [actionRef]);
73
80
  const handleChange = React__default["default"].useCallback(e => {
74
81
  onChange(e.target.value);
75
82
  }, [onChange]);
@@ -81,7 +88,7 @@ const ChatComposer = props => {
81
88
  const hasError = React__default["default"].useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);
82
89
  return /*#__PURE__*/_jsx__default["default"](styled.StyledChatContainerContentComposer, {
83
90
  rows: ['auto', '15px'],
84
- maxHeight: `${maxHeight}px`,
91
+ maxHeight: "".concat(maxHeight, "px"),
85
92
  "data-testid": dataTestid
86
93
  }, void 0, /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
87
94
  cols: ['1fr', '24px'],
@@ -95,6 +102,7 @@ const ChatComposer = props => {
95
102
  value: inputValue,
96
103
  onFocus: onFocus,
97
104
  onBlur: onBlur,
105
+ onKeyDown: onKeyDown,
98
106
  placeholder: placeholder,
99
107
  "aria-label": "Message to send",
100
108
  "data-testid": "chat-composer-textarea"
@@ -103,7 +111,7 @@ const ChatComposer = props => {
103
111
  alignItems: "center"
104
112
  }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledComposerButton, {
105
113
  buttonType: "text",
106
- icon: _PaperAirplane || (_PaperAirplane = /*#__PURE__*/_jsx__default["default"](PaperAirplane__default["default"], {
114
+ icon: _PaperAirplane || (_PaperAirplane = /*#__PURE__*/_jsx__default["default"](dsIcons.PaperAirplane, {
107
115
  width: 18,
108
116
  height: 18
109
117
  })),
@@ -138,8 +146,8 @@ const ChatComposer = props => {
138
146
  }, void 0, inputMaxLength && hasError ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
139
147
  children: [/*#__PURE__*/_jsx__default["default"](styled.StyledCounterErrorA11y, {
140
148
  role: "alert"
141
- }, void 0, "You have exceeded the character limit by ", inputLength - inputMaxLength), "Please limit to less than ", inputMaxLength, " characters.", ' ']
142
- }) : '', inputMaxLength ? `${inputLength} / ${inputMaxLength}` : ''), _Grid || (_Grid = /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {}))));
149
+ }, void 0, maxLengthMessage || "You have exceeded the character limit by ".concat(inputLength - inputMaxLength)), maxLengthMessage || "Please limit to less than ".concat(inputMaxLength, " characters. ")]
150
+ }) : '', inputMaxLength ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), _Grid || (_Grid = /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {}))));
143
151
  };
144
152
 
145
153
  ChatComposer.defaultProps = props.defaultComposerPros;
@@ -13,8 +13,10 @@ const defaultComposerPros = {
13
13
  onSend: lodash.noop,
14
14
  onFocus: lodash.noop,
15
15
  onBlur: lodash.noop,
16
+ onKeyDown: lodash.noop,
16
17
  maxHeight: 0,
17
18
  inputMaxLength: undefined,
19
+ maxLengthMessage: undefined,
18
20
  buttonDisabled: false,
19
21
  dataTestid: 'ds-chat-composer',
20
22
  actionRef: lodash.noop
@@ -22,26 +24,18 @@ const defaultComposerPros = {
22
24
  const composerProps = {
23
25
  placeholder: reactDesc.PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),
24
26
  inputValue: reactDesc.PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),
27
+ maxLengthMessage: reactDesc.PropTypes.string.description('Max length message').defaultValue(defaultComposerPros.maxLengthMessage),
25
28
  onChange: reactDesc.PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),
26
29
  onResize: reactDesc.PropTypes.func.description('Called the input changes his height').defaultValue(defaultComposerPros.onResize),
27
30
  onSend: reactDesc.PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),
28
31
  onFocus: reactDesc.PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),
29
32
  onBlur: reactDesc.PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),
33
+ onKeyDown: reactDesc.PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),
30
34
  maxHeight: reactDesc.PropTypes.number.description('Max height of the composer. Use 0 for no limit').defaultValue(defaultComposerPros.onBlur),
31
35
  inputMaxLength: reactDesc.PropTypes.number.description('Max length of the composer. `undefined` for no limit').defaultValue(defaultComposerPros.inputMaxLength),
32
36
  buttonDisabled: reactDesc.PropTypes.bool.description('Control the disabled for the send button').defaultValue(defaultComposerPros.buttonDisabled),
33
37
  dataTestid: reactDesc.PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),
34
- actionRef: reactDesc.PropTypes.object.description(`Reference:
35
- {
36
- scrollToIndex: (n: number) => void,
37
- getMessagesInView: () => number[],
38
- focusToIndex: (n: number) => void,
39
- focusToList: () => void,
40
- focusToComposer: () => void,
41
- focusToSend: () => void,
42
- }
43
-
44
- `).defaultValue(defaultComposerPros.actionRef)
38
+ 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(defaultComposerPros.actionRef)
45
39
  };
46
40
 
47
41
  exports.composerProps = composerProps;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var styled = require('styled-components');
6
6
  var dsGrid = require('@elliemae/ds-grid');
7
- var dsButton = require('@elliemae/ds-button');
7
+ var DSButton = require('@elliemae/ds-button');
8
8
 
9
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
10
 
@@ -16,13 +16,13 @@ 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' ? `${props.height}px` : props.height, props => props.theme.colors.brand[600]);
20
- const StyledComposerButton = /*#__PURE__*/styled__default["default"](dsButton.DSButton).withConfig({
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
+ 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]);
23
23
  const StyledCounterArea = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
24
24
  componentId: "sc-1ahwpce-3"
25
- })(["text-align:right;font-size:11px;height:15px;align-items:center;font-style:italic;", " position:relative;"], props => props.hasError ? `color:${props.theme.colors.danger[900]};` : '');
25
+ })(["text-align:right;font-size:11px;height:15px;align-items:center;font-style:italic;", " position:relative;"], props => props.hasError ? "color:".concat(props.theme.colors.danger[900], ";") : '');
26
26
  const StyledCounterErrorA11y = /*#__PURE__*/styled__default["default"].span.withConfig({
27
27
  componentId: "sc-1ahwpce-4"
28
28
  })(["width:1px;height:1px;position:absolute;clip:rect(1px,1px,1px,1px);"]);