@elliemae/ds-chat 2.0.0-alpha.0 → 2.0.0-alpha.12

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 (168) hide show
  1. package/cjs/ChatDataTestids.js +27 -0
  2. package/cjs/index.js +1 -0
  3. package/cjs/parts/bubble/ChatBubble.js +33 -20
  4. package/cjs/parts/bubble/ChatBubbleArrow.js +64 -61
  5. package/cjs/parts/bubble/config/useValidateProps.js +31 -0
  6. package/cjs/parts/bubble/index.js +1 -0
  7. package/cjs/parts/bubble/props.js +5 -5
  8. package/cjs/parts/bubble/styled.js +12 -41
  9. package/cjs/parts/chat-card/ChatCard.js +26 -20
  10. package/cjs/parts/chat-card/config/useValidateProps.js +11 -0
  11. package/cjs/parts/chat-card/props.js +3 -3
  12. package/cjs/parts/chat-card/styled.js +6 -6
  13. package/cjs/parts/chat-composer/ChatContainerComposer.js +50 -25
  14. package/cjs/parts/chat-composer/config/useValidateProps.js +11 -0
  15. package/cjs/parts/chat-composer/props.js +10 -4
  16. package/cjs/parts/chat-composer/styled.js +8 -8
  17. package/cjs/parts/chat-container/ChatContainer.js +79 -29
  18. package/cjs/parts/chat-container/config/useValidateProps.js +11 -0
  19. package/cjs/parts/chat-container/props.js +12 -7
  20. package/cjs/parts/chat-container/styled.js +5 -5
  21. package/cjs/parts/chat-container-header/ChatContainerHeader.js +7 -7
  22. package/cjs/parts/chat-container-header/helpers.js +31 -0
  23. package/cjs/parts/chat-container-header/styled.js +6 -6
  24. package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +214 -34
  25. package/cjs/parts/chat-container-messages-list/config/useValidateProps.js +11 -0
  26. package/cjs/parts/chat-container-messages-list/props.js +6 -10
  27. package/cjs/parts/chat-container-messages-list/styled.js +11 -14
  28. package/cjs/parts/chat-empty-state/ChatEmptyState.js +22 -12
  29. package/cjs/parts/chat-empty-state/config/useValidateProps.js +11 -0
  30. package/cjs/parts/chat-empty-state/props.js +2 -1
  31. package/cjs/parts/chat-empty-state/styled.js +2 -2
  32. package/cjs/parts/chat-sidebar/SideBarChat.js +70 -36
  33. package/cjs/parts/chat-sidebar/config/useValidateProps.js +11 -0
  34. package/cjs/parts/chat-sidebar/props.js +11 -1
  35. package/cjs/parts/chat-sidebar/styled.js +4 -4
  36. package/cjs/parts/floating-button/FloatingButton.js +18 -10
  37. package/cjs/parts/floating-button/props.js +6 -2
  38. package/cjs/parts/floating-button/styled.js +1 -1
  39. package/cjs/parts/floating-container/styled.js +1 -1
  40. package/cjs/parts/grid-influencer/InfluencerContainer.js +2 -2
  41. package/cjs/parts/grid-influencer/styled.js +4 -8
  42. package/cjs/parts/message-delimiter/MessageDelimiter.js +18 -12
  43. package/cjs/parts/message-delimiter/config/useValidateProps.js +11 -0
  44. package/cjs/parts/message-delimiter/props.js +1 -1
  45. package/cjs/parts/message-delimiter/styled.js +4 -4
  46. package/cjs/parts/sidebar-button/SidebarButton.js +12 -7
  47. package/cjs/parts/sidebar-button/props.js +3 -4
  48. package/cjs/parts/sidebar-button/styled.js +4 -4
  49. package/cjs/parts/system-message/SystemMessage.js +21 -15
  50. package/cjs/parts/system-message/config/useValidateProps.js +11 -0
  51. package/cjs/parts/system-message/style.js +6 -6
  52. package/cjs/parts/tile-button/TileButton.js +40 -34
  53. package/cjs/parts/tile-button/config/useValidateProps.js +11 -0
  54. package/cjs/parts/tile-button/props.js +15 -13
  55. package/cjs/parts/tile-button/styled.js +22 -15
  56. package/cjs/styled.js +1 -1
  57. package/esm/ChatDataTestids.js +23 -0
  58. package/esm/index.js +1 -1
  59. package/esm/parts/bubble/ChatBubble.js +24 -12
  60. package/esm/parts/bubble/ChatBubbleArrow.js +64 -61
  61. package/esm/parts/bubble/config/useValidateProps.js +27 -0
  62. package/esm/parts/bubble/index.js +1 -1
  63. package/esm/parts/bubble/props.js +4 -4
  64. package/esm/parts/bubble/styled.js +3 -32
  65. package/esm/parts/chat-card/ChatCard.js +26 -20
  66. package/esm/parts/chat-card/config/useValidateProps.js +7 -0
  67. package/esm/parts/chat-card/props.js +3 -3
  68. package/esm/parts/chat-composer/ChatContainerComposer.js +33 -7
  69. package/esm/parts/chat-composer/config/useValidateProps.js +7 -0
  70. package/esm/parts/chat-composer/props.js +10 -4
  71. package/esm/parts/chat-composer/styled.js +2 -2
  72. package/esm/parts/chat-container/ChatContainer.js +68 -18
  73. package/esm/parts/chat-container/config/useValidateProps.js +7 -0
  74. package/esm/parts/chat-container/props.js +12 -7
  75. package/esm/parts/chat-container/styled.js +2 -2
  76. package/esm/parts/chat-container-header/ChatContainerHeader.js +3 -2
  77. package/esm/parts/chat-container-header/helpers.js +23 -0
  78. package/esm/parts/chat-container-header/styled.js +6 -6
  79. package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +202 -22
  80. package/esm/parts/chat-container-messages-list/config/useValidateProps.js +7 -0
  81. package/esm/parts/chat-container-messages-list/props.js +6 -10
  82. package/esm/parts/chat-container-messages-list/styled.js +6 -10
  83. package/esm/parts/chat-empty-state/ChatEmptyState.js +16 -6
  84. package/esm/parts/chat-empty-state/config/useValidateProps.js +7 -0
  85. package/esm/parts/chat-empty-state/props.js +2 -1
  86. package/esm/parts/chat-sidebar/SideBarChat.js +69 -34
  87. package/esm/parts/chat-sidebar/config/useValidateProps.js +7 -0
  88. package/esm/parts/chat-sidebar/props.js +11 -1
  89. package/esm/parts/chat-sidebar/styled.js +2 -2
  90. package/esm/parts/floating-button/FloatingButton.js +18 -9
  91. package/esm/parts/floating-button/props.js +6 -2
  92. package/esm/parts/grid-influencer/styled.js +2 -6
  93. package/esm/parts/message-delimiter/MessageDelimiter.js +18 -12
  94. package/esm/parts/message-delimiter/config/useValidateProps.js +7 -0
  95. package/esm/parts/message-delimiter/props.js +1 -1
  96. package/esm/parts/message-delimiter/styled.js +1 -1
  97. package/esm/parts/sidebar-button/SidebarButton.js +6 -1
  98. package/esm/parts/sidebar-button/props.js +1 -1
  99. package/esm/parts/sidebar-button/styled.js +1 -1
  100. package/esm/parts/system-message/SystemMessage.js +21 -15
  101. package/esm/parts/system-message/config/useValidateProps.js +7 -0
  102. package/esm/parts/system-message/style.js +1 -1
  103. package/esm/parts/tile-button/TileButton.js +35 -27
  104. package/esm/parts/tile-button/config/useValidateProps.js +7 -0
  105. package/esm/parts/tile-button/props.js +14 -7
  106. package/esm/parts/tile-button/styled.js +15 -10
  107. package/esm/styled.js +1 -1
  108. package/package.json +69 -6
  109. package/types/ChatDataTestids.d.ts +21 -0
  110. package/types/index.d.ts +1 -1
  111. package/types/parts/bubble/ChatBubble.d.ts +20 -5
  112. package/types/parts/bubble/config/useValidateProps.d.ts +2 -0
  113. package/types/parts/bubble/index.d.ts +1 -1
  114. package/types/parts/bubble/props.d.ts +13 -4
  115. package/types/parts/bubble/styled.d.ts +9 -9
  116. package/types/parts/bubble/tests/ChatBubble.test.d.ts +1 -0
  117. package/types/parts/chat-card/ChatCard.d.ts +25 -5
  118. package/types/parts/chat-card/config/useValidateProps.d.ts +2 -0
  119. package/types/parts/chat-card/props.d.ts +19 -3
  120. package/types/parts/chat-card/styled.d.ts +6 -6
  121. package/types/parts/chat-composer/ChatContainerComposer.d.ts +48 -12
  122. package/types/parts/chat-composer/config/useValidateProps.d.ts +2 -0
  123. package/types/parts/chat-composer/styled.d.ts +117 -24
  124. package/types/parts/chat-composer/tests/ChatContainerComposer.test.d.ts +1 -0
  125. package/types/parts/chat-container/ChatContainer.d.ts +54 -12
  126. package/types/parts/chat-container/config/useValidateProps.d.ts +2 -0
  127. package/types/parts/chat-container/styled.d.ts +4 -4
  128. package/types/parts/chat-container/tests/ChatContainer.test.d.ts +1 -0
  129. package/types/parts/chat-container-header/helpers.d.ts +6 -0
  130. package/types/parts/chat-container-header/styled.d.ts +3 -3
  131. package/types/parts/chat-container-messages-list/ChatContainerMessagesList.d.ts +39 -9
  132. package/types/parts/chat-container-messages-list/config/useValidateProps.d.ts +2 -0
  133. package/types/parts/chat-container-messages-list/styled.d.ts +7 -6
  134. package/types/parts/chat-empty-state/ChatEmptyState.d.ts +19 -1
  135. package/types/parts/chat-empty-state/config/useValidateProps.d.ts +2 -0
  136. package/types/parts/chat-empty-state/props.d.ts +7 -1
  137. package/types/parts/chat-empty-state/styled.d.ts +2 -2
  138. package/types/parts/chat-sidebar/SideBarChat.d.ts +40 -10
  139. package/types/parts/chat-sidebar/config/useValidateProps.d.ts +2 -0
  140. package/types/parts/chat-sidebar/props.d.ts +39 -9
  141. package/types/parts/chat-sidebar/styled.d.ts +2 -2
  142. package/types/parts/floating-button/FloatingButton.d.ts +11 -2
  143. package/types/parts/floating-button/props.d.ts +13 -1
  144. package/types/parts/floating-button/styled.d.ts +1 -1
  145. package/types/parts/floating-container/styled.d.ts +1 -2
  146. package/types/parts/grid-influencer/styled.d.ts +2 -2
  147. package/types/parts/message-delimiter/MessageDelimiter.d.ts +22 -5
  148. package/types/parts/message-delimiter/config/useValidateProps.d.ts +2 -0
  149. package/types/parts/message-delimiter/props.d.ts +16 -3
  150. package/types/parts/message-delimiter/styled.d.ts +3 -3
  151. package/types/parts/sidebar-button/SidebarButton.d.ts +16 -5
  152. package/types/parts/sidebar-button/props.d.ts +16 -5
  153. package/types/parts/sidebar-button/styled.d.ts +3 -3
  154. package/types/parts/system-message/SystemMessage.d.ts +13 -3
  155. package/types/parts/system-message/config/useValidateProps.d.ts +2 -0
  156. package/types/parts/system-message/props.d.ts +7 -1
  157. package/types/parts/system-message/style.d.ts +5 -5
  158. package/types/parts/tile-button/TileButton.d.ts +66 -17
  159. package/types/parts/tile-button/config/useValidateProps.d.ts +2 -0
  160. package/types/parts/tile-button/props.d.ts +64 -16
  161. package/types/parts/tile-button/styled.d.ts +9 -8
  162. package/types/prop-types.d.ts +28 -9
  163. package/types/tests/utils.d.ts +27 -0
  164. package/cjs/package.json +0 -4
  165. package/esm/package.json +0 -4
  166. package/types/parts/chat-composer/props.d.ts +0 -32
  167. package/types/parts/chat-container/props.d.ts +0 -38
  168. package/types/parts/chat-container-messages-list/props.d.ts +0 -31
@@ -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;
package/cjs/index.js CHANGED
@@ -20,6 +20,7 @@ var ChatCard = require('./parts/chat-card/ChatCard.js');
20
20
 
21
21
 
22
22
  exports.ChatBubble = ChatBubble.ChatBubble;
23
+ exports.ChatBubbleWithSchema = ChatBubble.ChatBubbleWithSchema;
23
24
  exports.BUBBLE_TYPES = props.BUBBLE_TYPES;
24
25
  exports.FloatingButton = FloatingButton.FloatingButton;
25
26
  exports.StyledFloatingContainer = styled.StyledFloatingContainer;
@@ -3,18 +3,26 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
- require('react');
7
- var Warning = require('@elliemae/ds-icons/WarningCircleFill');
6
+ require('core-js/modules/web.url.to-json.js');
7
+ require('core-js/modules/esnext.async-iterator.map.js');
8
+ require('core-js/modules/esnext.iterator.map.js');
9
+ var React = require('react');
10
+ var reactDesc = require('react-desc');
11
+ var dsIcons = require('@elliemae/ds-icons');
8
12
  var styled = require('./styled.js');
13
+ var props = require('./props.js');
14
+ var useValidateProps = require('./config/useValidateProps.js');
9
15
  var ChatBubbleArrow = require('./ChatBubbleArrow.js');
10
16
 
11
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
18
 
13
19
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
14
- var Warning__default = /*#__PURE__*/_interopDefaultLegacy(Warning);
20
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
+
22
+ var _br, _WarningCircleFill;
15
23
 
16
- var _Warning;
17
24
  const ChatBubble = props => {
25
+ useValidateProps.useValidateProps(props, ChatBubbleWithSchema.toJSON());
18
26
  const {
19
27
  dsId,
20
28
  type,
@@ -24,38 +32,43 @@ const ChatBubble = props => {
24
32
  errorMessage,
25
33
  helpMessage
26
34
  } = props;
27
- return /*#__PURE__*/_jsx__default['default'](styled.StyledWrapper, {
28
- "data-testid": `ds-chat-bubble-${dsId}`,
35
+ const bodyParts = React__default["default"].useMemo(() => typeof body === 'string' ? body.split('\n') : [body], [body]);
36
+ return /*#__PURE__*/_jsx__default["default"](styled.StyledWrapper, {
37
+ "data-testid": "ds-chat-bubble-".concat(dsId),
29
38
  type: type
30
- }, void 0, /*#__PURE__*/_jsx__default['default'](styled.StyledColoredBubble, {
39
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledColoredBubble, {
31
40
  type: type
32
- }, void 0, /*#__PURE__*/_jsx__default['default'](styled.StyledTitleBubble, {
41
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledTitleBubble, {
33
42
  cols: [1, 'auto'],
34
43
  gutter: "xs",
35
44
  alignItems: "flex-end",
36
45
  className: "sr-only"
37
- }, void 0, /*#__PURE__*/_jsx__default['default'](styled.StyledTitleLeftBubble, {
46
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledTitleLeftBubble, {
38
47
  alignItems: "center",
39
- "data-testid": `chat-bubble-title-${dsId}`
40
- }, void 0, title), /*#__PURE__*/_jsx__default['default'](styled.StyledTitleRightBubble, {
48
+ "data-testid": "chat-bubble-title-".concat(dsId)
49
+ }, void 0, title), /*#__PURE__*/_jsx__default["default"](styled.StyledTitleRightBubble, {
41
50
  alignItems: "center",
42
51
  type: type,
43
- "data-testid": `chat-bubble-time-${dsId}`
44
- }, void 0, time)), /*#__PURE__*/_jsx__default['default'](styled.StyleBodyWrapper, {
45
- "data-testid": `chat-bubble-body-${dsId}`
46
- }, void 0, body), /*#__PURE__*/_jsx__default['default'](ChatBubbleArrow.ChatBubbleArrow, {
52
+ "data-testid": "chat-bubble-time-".concat(dsId)
53
+ }, void 0, time)), /*#__PURE__*/_jsx__default["default"](styled.StyleBodyWrapper, {
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, {
47
56
  type: type
48
- })), errorMessage ? /*#__PURE__*/_jsx__default['default'](styled.StyleErrorMessage, {
49
- "data-testid": `chat-bubble-error-message-${dsId}`,
57
+ })), errorMessage ? /*#__PURE__*/_jsx__default["default"](styled.StyleErrorMessage, {
58
+ "data-testid": "chat-bubble-error-message-".concat(dsId),
50
59
  p: "xxs",
51
60
  gutter: "xxs",
52
61
  cols: [1, 'auto']
53
- }, 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, {
54
- "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),
55
64
  p: "xxs",
56
65
  gutter: "xxs",
57
66
  cols: [1, 'auto']
58
- }, void 0, /*#__PURE__*/_jsx__default['default']("span", {}, void 0, helpMessage)) : null);
67
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, helpMessage)) : null);
59
68
  };
60
69
 
70
+ const ChatBubbleWithSchema = reactDesc.describe(ChatBubble);
71
+ ChatBubbleWithSchema.propTypes = props.propsBubbles;
72
+
61
73
  exports.ChatBubble = ChatBubble;
74
+ exports.ChatBubbleWithSchema = ChatBubbleWithSchema;
@@ -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;
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var dsPropsHelpers = require('@elliemae/ds-props-helpers');
6
+
7
+ const throwError = message => {
8
+ throw new Error("Bubble:: ".concat(message, "\n "));
9
+ };
10
+
11
+ const useValidateProps = (props, schema) => {
12
+ dsPropsHelpers.useValidatePropTypes(props, schema);
13
+
14
+ if (typeof props.title === 'undefined') {
15
+ throwError("Please provide a title property to use this component.");
16
+ }
17
+
18
+ if (typeof props.time === 'undefined') {
19
+ throwError("Please provide a time property to use this component.");
20
+ }
21
+
22
+ if (typeof props.body === 'undefined') {
23
+ throwError("Please provide a body property to use this component.");
24
+ }
25
+
26
+ if (typeof props.type === 'undefined') {
27
+ throwError("Please provide a type property to use this component.");
28
+ }
29
+ };
30
+
31
+ exports.useValidateProps = useValidateProps;
@@ -8,4 +8,5 @@ var props = require('./props.js');
8
8
 
9
9
 
10
10
  exports.ChatBubble = ChatBubble.ChatBubble;
11
+ exports.ChatBubbleWithSchema = ChatBubble.ChatBubbleWithSchema;
11
12
  exports.BUBBLE_TYPES = props.BUBBLE_TYPES;
@@ -33,10 +33,10 @@ const defaultBubbleProps = {
33
33
  };
34
34
  const propsBubbles = {
35
35
  dsId: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('Unique id for bubble').defaultValue(defaultBubbleProps.dsId),
36
- type: reactDesc.PropTypes.oneOf([BUBBLE_TYPES.RECIPIENT, BUBBLE_TYPES.SENDER]).description('Define bubble type ').defaultValue(defaultBubbleProps.type),
37
- title: reactDesc.PropTypes.string.description('Title of the bubble').defaultValue(defaultBubbleProps.title),
38
- time: reactDesc.PropTypes.string.description('Time of the bubble').defaultValue(defaultBubbleProps.title),
39
- body: reactDesc.PropTypes.string.description('Bubble content').defaultValue(defaultBubbleProps.body),
36
+ type: reactDesc.PropTypes.oneOf([BUBBLE_TYPES.RECIPIENT, BUBBLE_TYPES.SENDER]).isRequired.description('Define bubble type ').defaultValue(defaultBubbleProps.type),
37
+ title: reactDesc.PropTypes.string.isRequired.description('Title of the bubble').defaultValue(defaultBubbleProps.title),
38
+ time: reactDesc.PropTypes.string.isRequired.description('Time of the bubble').defaultValue(defaultBubbleProps.title),
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)
@@ -48,7 +48,7 @@ const propsBubbles = {
48
48
  */
49
49
 
50
50
  const propsArrowBubble = {
51
- type: propsTypes__default['default'].oneOf([BUBBLE_TYPES.RECIPIENT, BUBBLE_TYPES.SENDER])
51
+ type: propsTypes__default["default"].oneOf([BUBBLE_TYPES.RECIPIENT, BUBBLE_TYPES.SENDER])
52
52
  };
53
53
 
54
54
  exports.BUBBLE_TYPES = BUBBLE_TYPES;
@@ -12,64 +12,35 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
12
12
 
13
13
  /* eslint-disable max-lines */
14
14
 
15
- const StyledWrapper = /*#__PURE__*/styled__default['default'].div.withConfig({
15
+ const StyledWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
16
16
  componentId: "sc-fe8e9o-0"
17
17
  })(["min-width:224px;border-radius:10px;"]); // Bubble HEADER
18
18
 
19
- const StyledTitleBubble = /*#__PURE__*/styled__default['default'](dsGrid.Grid).withConfig({
19
+ const StyledTitleBubble = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
20
20
  componentId: "sc-fe8e9o-1"
21
21
  })(["padding-top:6px;padding-left:10px;padding-right:10px;padding-bottom:4px;"]);
22
- const StyledTitleLeftBubble = /*#__PURE__*/styled__default['default'](dsGrid.Grid).withConfig({
22
+ const StyledTitleLeftBubble = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
23
23
  componentId: "sc-fe8e9o-2"
24
24
  })(["font-size:13px;font-weight:600;"]);
25
- const StyledTitleRightBubble = /*#__PURE__*/styled__default['default'](dsGrid.Grid).withConfig({
25
+ const StyledTitleRightBubble = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
26
26
  componentId: "sc-fe8e9o-3"
27
27
  })(["font-size:13px;font-weight:400;color:", ";"], props$1 => props$1.type === props.BUBBLE_TYPES.SENDER ? '#FFF' : '#657489');
28
- const StyleBodyWrapper = /*#__PURE__*/styled__default['default'].div.withConfig({
28
+ const StyleBodyWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
29
29
  componentId: "sc-fe8e9o-4"
30
- })(["font-size:13px;font-weight:400;line-height:15px;min-height:32px;padding:0px 10px 8px 10px;"]);
31
- const StyleErrorMessage = /*#__PURE__*/styled__default['default'].div.withConfig({
30
+ })(["font-size:13px;font-weight:400;line-height:15px;min-height:18px;padding:0px 10px 8px 10px;"]);
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]);
34
- const StyleHelpMessage = /*#__PURE__*/styled__default['default'](StyleErrorMessage).withConfig({
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
+ 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
37
37
 
38
- const StyledBubbleArrow = /*#__PURE__*/styled__default['default'].div.withConfig({
38
+ const StyledBubbleArrow = /*#__PURE__*/styled__default["default"].div.withConfig({
39
39
  componentId: "sc-fe8e9o-7"
40
40
  })(["display:block;content:'';position:absolute;bottom:10px;height:15px;"]);
41
- const StyledColoredBubble = /*#__PURE__*/styled__default['default'].div.withConfig({
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;
@@ -3,35 +3,41 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
+ require('core-js/modules/web.url.to-json.js');
6
7
  require('react');
7
8
  var reactDesc = require('react-desc');
8
- var props = require('./props.js');
9
9
  var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
10
+ var props = require('./props.js');
11
+ var useValidateProps = require('./config/useValidateProps.js');
10
12
  var styled = require('./styled.js');
11
13
 
12
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
15
 
14
16
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
15
17
 
16
- const ChatCard = ({
17
- title,
18
- content,
19
- time,
20
- rightAddon
21
- }) => /*#__PURE__*/_jsx__default['default'](styled.Wrapper, {
22
- cols: ['1fr', 'auto'],
23
- "data-testid": "chat-card-wrapper"
24
- }, void 0, /*#__PURE__*/_jsx__default['default'](styled.MainContent, {}, void 0, /*#__PURE__*/_jsx__default['default'](styled.Title, {
25
- "data-testid": "chat-card-title"
26
- }, void 0, title), /*#__PURE__*/_jsx__default['default'](styled.Content, {
27
- "data-testid": "chat-card-content"
28
- }, void 0, /*#__PURE__*/_jsx__default['default'](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
29
- value: content
30
- })), time && /*#__PURE__*/_jsx__default['default'](styled.Time, {
31
- "data-testid": "chat-card-time"
32
- }, void 0, time)), rightAddon && /*#__PURE__*/_jsx__default['default'](styled.RightAddon, {
33
- "data-testid": "chat-card-right-addon"
34
- }, void 0, rightAddon));
18
+ const ChatCard = props => {
19
+ useValidateProps.useValidateProps(props, ChatCardWithSchema.toJSON());
20
+ const {
21
+ title,
22
+ content,
23
+ time,
24
+ rightAddon
25
+ } = props;
26
+ return /*#__PURE__*/_jsx__default["default"](styled.Wrapper, {
27
+ cols: ['1fr', 'auto'],
28
+ "data-testid": "chat-card-wrapper"
29
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styled.MainContent, {}, void 0, /*#__PURE__*/_jsx__default["default"](styled.Title, {
30
+ "data-testid": "chat-card-title"
31
+ }, void 0, title), /*#__PURE__*/_jsx__default["default"](styled.Content, {
32
+ "data-testid": "chat-card-content"
33
+ }, void 0, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
34
+ value: content
35
+ })), time && /*#__PURE__*/_jsx__default["default"](styled.Time, {
36
+ "data-testid": "chat-card-time"
37
+ }, void 0, time)), rightAddon && /*#__PURE__*/_jsx__default["default"](styled.RightAddon, {
38
+ "data-testid": "chat-card-right-addon"
39
+ }, void 0, rightAddon));
40
+ };
35
41
 
36
42
  const ChatCardWithSchema = reactDesc.describe(ChatCard);
37
43
  ChatCardWithSchema.propTypes = props.propTypes;
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var dsPropsHelpers = require('@elliemae/ds-props-helpers');
6
+
7
+ const useValidateProps = (props, schema) => {
8
+ dsPropsHelpers.useValidatePropTypes(props, schema);
9
+ };
10
+
11
+ exports.useValidateProps = useValidateProps;
@@ -5,10 +5,10 @@ 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
- rightAddon: reactDesc.PropTypes.node.description('Right addon, badge or icon')
11
+ rightAddon: reactDesc.PropTypes.element.description('Right addon, badge or icon')
12
12
  };
13
13
 
14
14
  exports.propTypes = propTypes;
@@ -9,22 +9,22 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
9
9
 
10
10
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
11
11
 
12
- const Wrapper = /*#__PURE__*/styled__default['default'](dsGrid.Grid).withConfig({
12
+ const Wrapper = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
13
13
  componentId: "sc-s0g4hn-0"
14
14
  })(["min-width:248px;border:1px;border-bottom:1px solid #ccc;padding:12px 12px;"]);
15
- const MainContent = /*#__PURE__*/styled__default['default'].div.withConfig({
15
+ const MainContent = /*#__PURE__*/styled__default["default"].div.withConfig({
16
16
  componentId: "sc-s0g4hn-1"
17
17
  })([""]);
18
- const Title = /*#__PURE__*/styled__default['default'].p.withConfig({
18
+ const Title = /*#__PURE__*/styled__default["default"].p.withConfig({
19
19
  componentId: "sc-s0g4hn-2"
20
20
  })(["font-size:16px;font-weight:600;margin:0;"]);
21
- const Content = /*#__PURE__*/styled__default['default'].p.withConfig({
21
+ const Content = /*#__PURE__*/styled__default["default"].p.withConfig({
22
22
  componentId: "sc-s0g4hn-3"
23
23
  })(["font-size:12px;font-weight:400;line-height:1;margin:0;"]);
24
- const Time = /*#__PURE__*/styled__default['default'].p.withConfig({
24
+ const Time = /*#__PURE__*/styled__default["default"].p.withConfig({
25
25
  componentId: "sc-s0g4hn-4"
26
26
  })(["font-size:12px;font-weight:100;margin:0;margin-top:8px;font-weight:", ";color:", ";"], props => props.theme.fontWeights.regular, props => props.theme.colors.neutral['500']);
27
- const RightAddon = /*#__PURE__*/styled__default['default'].div.withConfig({
27
+ const RightAddon = /*#__PURE__*/styled__default["default"].div.withConfig({
28
28
  componentId: "sc-s0g4hn-5"
29
29
  })(["height:fit-content;margin-left:12px;"]);
30
30