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

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 (66) hide show
  1. package/cjs/ChatDataTestids.js +27 -0
  2. package/cjs/parts/bubble/ChatBubbleArrow.js +3 -3
  3. package/cjs/parts/chat-container/ChatContainer.js +6 -5
  4. package/cjs/parts/chat-container/config/useValidateProps.js +2 -2
  5. package/cjs/parts/chat-container/props.js +6 -2
  6. package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +3 -3
  7. package/cjs/parts/chat-container-messages-list/config/useValidateProps.js +2 -2
  8. package/cjs/parts/floating-button/FloatingButton.js +12 -6
  9. package/cjs/parts/floating-button/props.js +6 -2
  10. package/cjs/parts/tile-button/styled.js +5 -2
  11. package/esm/ChatDataTestids.js +23 -0
  12. package/esm/parts/bubble/ChatBubbleArrow.js +3 -3
  13. package/esm/parts/chat-container/ChatContainer.js +4 -3
  14. package/esm/parts/chat-container/config/useValidateProps.js +2 -2
  15. package/esm/parts/chat-container/props.js +6 -2
  16. package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +1 -1
  17. package/esm/parts/chat-container-messages-list/config/useValidateProps.js +2 -2
  18. package/esm/parts/floating-button/FloatingButton.js +12 -6
  19. package/esm/parts/floating-button/props.js +6 -2
  20. package/esm/parts/tile-button/styled.js +5 -3
  21. package/package.json +21 -9
  22. package/types/ChatDataTestids.d.ts +21 -0
  23. package/types/parts/bubble/ChatBubble.d.ts +18 -5
  24. package/types/parts/bubble/props.d.ts +13 -4
  25. package/types/parts/bubble/styled.d.ts +9 -9
  26. package/types/parts/chat-card/ChatCard.d.ts +24 -4
  27. package/types/parts/chat-card/props.d.ts +19 -3
  28. package/types/parts/chat-card/styled.d.ts +6 -6
  29. package/types/parts/chat-composer/ChatContainerComposer.d.ts +48 -15
  30. package/types/parts/chat-composer/styled.d.ts +117 -24
  31. package/types/parts/chat-container/ChatContainer.d.ts +54 -13
  32. package/types/parts/chat-container/config/useValidateProps.d.ts +1 -1
  33. package/types/parts/chat-container/styled.d.ts +4 -4
  34. package/types/parts/chat-container/tests/ChatContainer.test.d.ts +1 -0
  35. package/types/parts/chat-container-header/styled.d.ts +3 -3
  36. package/types/parts/chat-container-messages-list/ChatContainerMessagesList.d.ts +39 -9
  37. package/types/parts/chat-container-messages-list/config/useValidateProps.d.ts +1 -1
  38. package/types/parts/chat-container-messages-list/styled.d.ts +7 -7
  39. package/types/parts/chat-empty-state/ChatEmptyState.d.ts +12 -3
  40. package/types/parts/chat-empty-state/props.d.ts +7 -2
  41. package/types/parts/chat-empty-state/styled.d.ts +2 -2
  42. package/types/parts/chat-sidebar/SideBarChat.d.ts +39 -12
  43. package/types/parts/chat-sidebar/props.d.ts +34 -11
  44. package/types/parts/chat-sidebar/styled.d.ts +2 -2
  45. package/types/parts/floating-button/FloatingButton.d.ts +11 -2
  46. package/types/parts/floating-button/props.d.ts +13 -1
  47. package/types/parts/floating-button/styled.d.ts +1 -1
  48. package/types/parts/floating-container/styled.d.ts +1 -2
  49. package/types/parts/grid-influencer/styled.d.ts +2 -2
  50. package/types/parts/message-delimiter/MessageDelimiter.d.ts +21 -4
  51. package/types/parts/message-delimiter/props.d.ts +16 -3
  52. package/types/parts/message-delimiter/styled.d.ts +3 -3
  53. package/types/parts/sidebar-button/SidebarButton.d.ts +16 -5
  54. package/types/parts/sidebar-button/props.d.ts +16 -5
  55. package/types/parts/sidebar-button/styled.d.ts +3 -3
  56. package/types/parts/system-message/SystemMessage.d.ts +12 -2
  57. package/types/parts/system-message/props.d.ts +7 -1
  58. package/types/parts/system-message/style.d.ts +5 -5
  59. package/types/parts/tile-button/TileButton.d.ts +66 -20
  60. package/types/parts/tile-button/props.d.ts +61 -19
  61. package/types/parts/tile-button/styled.d.ts +9 -9
  62. package/types/prop-types.d.ts +28 -9
  63. package/types/tests/utils.d.ts +27 -0
  64. package/types/parts/chat-composer/props.d.ts +0 -39
  65. package/types/parts/chat-container/props.d.ts +0 -41
  66. 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",
@@ -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,
@@ -55,8 +55,9 @@ const ChatContainer = props => {
55
55
  device,
56
56
  isLoading,
57
57
  hasMoreItems,
58
- getMoreMessages
59
- } = props;
58
+ getMoreMessages,
59
+ ariaLabel
60
+ } = props$1;
60
61
  const bannerRef = React__default["default"].useRef({
61
62
  focusOnWrapper: lodash.noop,
62
63
  focusOnLink: lodash.noop
@@ -102,7 +103,7 @@ const ChatContainer = props => {
102
103
  rows: ['minmax(0, 1fr)', 'auto'],
103
104
  ref: containerRef,
104
105
  role: "region",
105
- "aria-label": "chat window",
106
+ "aria-label": ariaLabel,
106
107
  children: [/*#__PURE__*/_jsx__default["default"]("div", {
107
108
  style: {
108
109
  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;
@@ -46,8 +46,8 @@ const getPadding = hasMoreItems => {
46
46
  return padding;
47
47
  };
48
48
 
49
- const ChatContainerMessagesList = props => {
50
- useValidateProps.useValidateProps(props, ChatContainerMessagesListWithSchema.toTypescript());
49
+ const ChatContainerMessagesList = props$2 => {
50
+ useValidateProps.useValidateProps(props$2, props.listProps);
51
51
  const {
52
52
  sendingText,
53
53
  bannerPosition,
@@ -59,7 +59,7 @@ const ChatContainerMessagesList = props => {
59
59
  hasMoreItems,
60
60
  isLoading,
61
61
  bannerRef
62
- } = props;
62
+ } = props$2;
63
63
  const loadMoreRef = React__default["default"].useRef(null);
64
64
  const virtualListRef = React__default["default"].useRef(); // estimateSize should not be really required given what was stated on
65
65
  // https://github.com/tannerlinsley/react-virtual/issues/23
@@ -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",
@@ -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,
@@ -43,7 +43,8 @@ const ChatContainer = props => {
43
43
  device,
44
44
  isLoading,
45
45
  hasMoreItems,
46
- getMoreMessages
46
+ getMoreMessages,
47
+ ariaLabel
47
48
  } = props;
48
49
  const bannerRef = React.useRef({
49
50
  focusOnWrapper: noop,
@@ -90,7 +91,7 @@ const ChatContainer = props => {
90
91
  rows: ['minmax(0, 1fr)', 'auto'],
91
92
  ref: containerRef,
92
93
  role: "region",
93
- "aria-label": "chat window",
94
+ "aria-label": ariaLabel,
94
95
  children: [/*#__PURE__*/_jsx("div", {
95
96
  style: {
96
97
  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 };
@@ -36,7 +36,7 @@ const getPadding = hasMoreItems => {
36
36
  };
37
37
 
38
38
  const ChatContainerMessagesList = props => {
39
- useValidateProps(props, ChatContainerMessagesListWithSchema.toTypescript());
39
+ useValidateProps(props, listProps);
40
40
  const {
41
41
  sendingText,
42
42
  bannerPosition,
@@ -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 '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-chat",
3
- "version": "2.0.0-rc.1",
3
+ "version": "2.0.0-rc.10",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Chat",
6
6
  "module": "./esm/index.js",
@@ -11,6 +11,10 @@
11
11
  "import": "./esm/index.js",
12
12
  "require": "./cjs/index.js"
13
13
  },
14
+ "./tests/utils": {
15
+ "import": "./esm/tests/utils.js",
16
+ "require": "./cjs/tests/utils.js"
17
+ },
14
18
  "./styled": {
15
19
  "import": "./esm/styled.js",
16
20
  "require": "./cjs/styled.js"
@@ -274,6 +278,10 @@
274
278
  "./parts/bubble/ChatBubble": {
275
279
  "import": "./esm/parts/bubble/ChatBubble.js",
276
280
  "require": "./cjs/parts/bubble/ChatBubble.js"
281
+ },
282
+ "./ChatDataTestids": {
283
+ "import": "./esm/ChatDataTestids.js",
284
+ "require": "./cjs/ChatDataTestids.js"
277
285
  }
278
286
  },
279
287
  "repository": {
@@ -297,19 +305,23 @@
297
305
  "generateSubmodules": true
298
306
  },
299
307
  "dependencies": {
300
- "@elliemae/ds-banner": "2.0.0-rc.1",
301
- "@elliemae/ds-basic": "2.0.0-rc.1",
302
- "@elliemae/ds-button": "2.0.0-rc.1",
303
- "@elliemae/ds-grid": "2.0.0-rc.1",
304
- "@elliemae/ds-icons": "2.0.0-rc.1",
305
- "@elliemae/ds-props-helpers": "2.0.0-rc.1",
306
- "@elliemae/ds-tooltip": "2.0.0-rc.1",
307
- "@elliemae/ds-truncated-tooltip-text": "2.0.0-rc.1",
308
+ "@elliemae/ds-banner": "2.0.0-rc.10",
309
+ "@elliemae/ds-button": "2.0.0-rc.10",
310
+ "@elliemae/ds-grid": "2.0.0-rc.10",
311
+ "@elliemae/ds-icons": "2.0.0-rc.10",
312
+ "@elliemae/ds-indeterminate-progress-indicator": "2.0.0-rc.10",
313
+ "@elliemae/ds-props-helpers": "2.0.0-rc.10",
314
+ "@elliemae/ds-system": "2.0.0-rc.10",
315
+ "@elliemae/ds-tooltip": "2.0.0-rc.10",
316
+ "@elliemae/ds-truncated-tooltip-text": "2.0.0-rc.10",
308
317
  "prop-types": "~15.7.2",
309
318
  "react-desc": "~4.1.2",
310
319
  "react-virtual": "~2.3.2"
311
320
  },
312
321
  "devDependencies": {
322
+ "@testing-library/dom": "~8.11.1",
323
+ "@testing-library/jest-dom": "~5.15.0",
324
+ "@testing-library/react": "~12.1.2",
313
325
  "styled-components": "~5.3.3"
314
326
  },
315
327
  "peerDependencies": {
@@ -0,0 +1,21 @@
1
+ export declare const ChatDataTestIds: {
2
+ COMPOSER_TEXTAREA: string;
3
+ COMPOSER_SEND_BUTTON: string;
4
+ CARD_TITLE: string;
5
+ CARD_WRAPPER: string;
6
+ CARD_TIME: string;
7
+ CARD_RIGHT_ADDON: string;
8
+ CARD_CONTENT: string;
9
+ LOADING_INDICATOR: string;
10
+ HEADER_TITLE: string;
11
+ HEADER_CHILDREN: string;
12
+ THREAD_CONTAINER: string;
13
+ LOAD_MORE_BUTTON: string;
14
+ FLOATING_BUTTON: string;
15
+ SYSTEM_MSG_TITLE: string;
16
+ SYSTEM_MSG_BODY: string;
17
+ SYSTEM_MSG_TIME: string;
18
+ BUBBLE: string;
19
+ BUBBLE_TITLE: string;
20
+ BUBBLE_BODY: string;
21
+ };
@@ -1,17 +1,30 @@
1
+ /// <reference path="../../../../../../shared/typings/react-desc.d.ts" />
1
2
  /// <reference types="react" />
2
3
  import { BubbleProps } from './props';
3
4
  declare const ChatBubble: {
4
5
  (props: BubbleProps): JSX.Element;
5
6
  propTypes: {
6
- dsId: any;
7
+ dsId: {
8
+ deprecated: import("react-desc").PropTypesDescValidator;
9
+ };
7
10
  type: any;
8
11
  title: any;
9
12
  time: any;
10
13
  body: any;
11
- onClick: any;
12
- errorMessage: any;
13
- helpMessage: any;
14
+ onClick: {
15
+ deprecated: import("react-desc").PropTypesDescValidator;
16
+ };
17
+ errorMessage: {
18
+ deprecated: import("react-desc").PropTypesDescValidator;
19
+ };
20
+ helpMessage: {
21
+ deprecated: import("react-desc").PropTypesDescValidator;
22
+ };
14
23
  };
15
24
  };
16
- declare const ChatBubbleWithSchema: any;
25
+ declare const ChatBubbleWithSchema: {
26
+ (props?: BubbleProps | undefined): JSX.Element;
27
+ propTypes: unknown;
28
+ toTypescript: () => import("react-desc").TypescriptSchema;
29
+ };
17
30
  export { ChatBubble, ChatBubbleWithSchema };
@@ -1,3 +1,4 @@
1
+ /// <reference path="../../../../../../shared/typings/react-desc.d.ts" />
1
2
  import React from 'react';
2
3
  /**
3
4
  *
@@ -24,14 +25,22 @@ export interface BubbleProps {
24
25
  }
25
26
  export declare const defaultBubbleProps: BubbleProps;
26
27
  export declare const propsBubbles: {
27
- dsId: any;
28
+ dsId: {
29
+ deprecated: import("react-desc").PropTypesDescValidator;
30
+ };
28
31
  type: any;
29
32
  title: any;
30
33
  time: any;
31
34
  body: any;
32
- onClick: any;
33
- errorMessage: any;
34
- helpMessage: any;
35
+ onClick: {
36
+ deprecated: import("react-desc").PropTypesDescValidator;
37
+ };
38
+ errorMessage: {
39
+ deprecated: import("react-desc").PropTypesDescValidator;
40
+ };
41
+ helpMessage: {
42
+ deprecated: import("react-desc").PropTypesDescValidator;
43
+ };
35
44
  };
36
45
  /**
37
46
  *
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- export declare const StyledWrapper: import("styled-components").StyledComponent<"div", any, any, never>;
3
- export declare const StyledTitleBubble: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/types").GridPropsT & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
4
- export declare const StyledTitleLeftBubble: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/types").GridPropsT & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
5
- export declare const StyledTitleRightBubble: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/types").GridPropsT & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
6
- export declare const StyleBodyWrapper: import("styled-components").StyledComponent<"div", any, any, never>;
7
- export declare const StyleErrorMessage: import("styled-components").StyledComponent<"div", any, any, never>;
8
- export declare const StyleHelpMessage: import("styled-components").StyledComponent<"div", any, any, never>;
9
- export declare const StyledBubbleArrow: import("styled-components").StyledComponent<"div", any, any, never>;
10
- export declare const StyledColoredBubble: import("styled-components").StyledComponent<"div", any, any, never>;
2
+ export declare const StyledWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, any, never>;
3
+ export declare const StyledTitleBubble: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/types").GridPropsT & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
4
+ export declare const StyledTitleLeftBubble: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/types").GridPropsT & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
5
+ export declare const StyledTitleRightBubble: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/types").GridPropsT & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
6
+ export declare const StyleBodyWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, any, never>;
7
+ export declare const StyleErrorMessage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, any, never>;
8
+ export declare const StyleHelpMessage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, any, never>;
9
+ export declare const StyledBubbleArrow: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, any, never>;
10
+ export declare const StyledColoredBubble: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, any, never>;