@elliemae/ds-chat 2.0.0-alpha.1 → 2.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ChatDataTestids.js +27 -0
- package/cjs/index.js +1 -0
- package/cjs/parts/bubble/ChatBubble.js +33 -20
- package/cjs/parts/bubble/ChatBubbleArrow.js +64 -61
- package/cjs/parts/bubble/config/useValidateProps.js +31 -0
- package/cjs/parts/bubble/index.js +1 -0
- package/cjs/parts/bubble/props.js +5 -5
- package/cjs/parts/bubble/styled.js +12 -41
- package/cjs/parts/chat-card/ChatCard.js +26 -20
- package/cjs/parts/chat-card/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-card/props.js +3 -3
- package/cjs/parts/chat-card/styled.js +6 -6
- package/cjs/parts/chat-composer/ChatContainerComposer.js +50 -25
- package/cjs/parts/chat-composer/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-composer/props.js +10 -4
- package/cjs/parts/chat-composer/styled.js +8 -8
- package/cjs/parts/chat-container/ChatContainer.js +79 -29
- package/cjs/parts/chat-container/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-container/props.js +12 -7
- package/cjs/parts/chat-container/styled.js +5 -5
- package/cjs/parts/chat-container-header/ChatContainerHeader.js +7 -7
- package/cjs/parts/chat-container-header/helpers.js +31 -0
- package/cjs/parts/chat-container-header/styled.js +6 -6
- package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +214 -34
- package/cjs/parts/chat-container-messages-list/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-container-messages-list/props.js +6 -10
- package/cjs/parts/chat-container-messages-list/styled.js +11 -14
- package/cjs/parts/chat-empty-state/ChatEmptyState.js +22 -12
- package/cjs/parts/chat-empty-state/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-empty-state/props.js +2 -1
- package/cjs/parts/chat-empty-state/styled.js +2 -2
- package/cjs/parts/chat-sidebar/SideBarChat.js +70 -36
- package/cjs/parts/chat-sidebar/config/useValidateProps.js +11 -0
- package/cjs/parts/chat-sidebar/props.js +11 -1
- package/cjs/parts/chat-sidebar/styled.js +4 -4
- package/cjs/parts/floating-button/FloatingButton.js +18 -10
- package/cjs/parts/floating-button/props.js +6 -2
- package/cjs/parts/floating-button/styled.js +1 -1
- package/cjs/parts/floating-container/styled.js +1 -1
- package/cjs/parts/grid-influencer/InfluencerContainer.js +2 -2
- package/cjs/parts/grid-influencer/styled.js +4 -8
- package/cjs/parts/message-delimiter/MessageDelimiter.js +18 -12
- package/cjs/parts/message-delimiter/config/useValidateProps.js +11 -0
- package/cjs/parts/message-delimiter/props.js +1 -1
- package/cjs/parts/message-delimiter/styled.js +4 -4
- package/cjs/parts/sidebar-button/SidebarButton.js +12 -7
- package/cjs/parts/sidebar-button/props.js +3 -4
- package/cjs/parts/sidebar-button/styled.js +4 -4
- package/cjs/parts/system-message/SystemMessage.js +21 -15
- package/cjs/parts/system-message/config/useValidateProps.js +11 -0
- package/cjs/parts/system-message/style.js +6 -6
- package/cjs/parts/tile-button/TileButton.js +40 -34
- package/cjs/parts/tile-button/config/useValidateProps.js +11 -0
- package/cjs/parts/tile-button/props.js +15 -13
- package/cjs/parts/tile-button/styled.js +22 -15
- package/cjs/styled.js +1 -1
- package/esm/ChatDataTestids.js +23 -0
- package/esm/index.js +1 -1
- package/esm/parts/bubble/ChatBubble.js +24 -12
- package/esm/parts/bubble/ChatBubbleArrow.js +64 -61
- package/esm/parts/bubble/config/useValidateProps.js +27 -0
- package/esm/parts/bubble/index.js +1 -1
- package/esm/parts/bubble/props.js +4 -4
- package/esm/parts/bubble/styled.js +3 -32
- package/esm/parts/chat-card/ChatCard.js +26 -20
- package/esm/parts/chat-card/config/useValidateProps.js +7 -0
- package/esm/parts/chat-card/props.js +3 -3
- package/esm/parts/chat-composer/ChatContainerComposer.js +33 -7
- package/esm/parts/chat-composer/config/useValidateProps.js +7 -0
- package/esm/parts/chat-composer/props.js +10 -4
- package/esm/parts/chat-composer/styled.js +2 -2
- package/esm/parts/chat-container/ChatContainer.js +68 -18
- package/esm/parts/chat-container/config/useValidateProps.js +7 -0
- package/esm/parts/chat-container/props.js +12 -7
- package/esm/parts/chat-container/styled.js +2 -2
- package/esm/parts/chat-container-header/ChatContainerHeader.js +3 -2
- package/esm/parts/chat-container-header/helpers.js +23 -0
- package/esm/parts/chat-container-header/styled.js +6 -6
- package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +202 -22
- package/esm/parts/chat-container-messages-list/config/useValidateProps.js +7 -0
- package/esm/parts/chat-container-messages-list/props.js +6 -10
- package/esm/parts/chat-container-messages-list/styled.js +6 -10
- package/esm/parts/chat-empty-state/ChatEmptyState.js +16 -6
- package/esm/parts/chat-empty-state/config/useValidateProps.js +7 -0
- package/esm/parts/chat-empty-state/props.js +2 -1
- package/esm/parts/chat-sidebar/SideBarChat.js +69 -34
- package/esm/parts/chat-sidebar/config/useValidateProps.js +7 -0
- package/esm/parts/chat-sidebar/props.js +11 -1
- package/esm/parts/chat-sidebar/styled.js +2 -2
- package/esm/parts/floating-button/FloatingButton.js +18 -9
- package/esm/parts/floating-button/props.js +6 -2
- package/esm/parts/grid-influencer/styled.js +2 -6
- package/esm/parts/message-delimiter/MessageDelimiter.js +18 -12
- package/esm/parts/message-delimiter/config/useValidateProps.js +7 -0
- package/esm/parts/message-delimiter/props.js +1 -1
- package/esm/parts/message-delimiter/styled.js +1 -1
- package/esm/parts/sidebar-button/SidebarButton.js +6 -1
- package/esm/parts/sidebar-button/props.js +1 -1
- package/esm/parts/sidebar-button/styled.js +1 -1
- package/esm/parts/system-message/SystemMessage.js +21 -15
- package/esm/parts/system-message/config/useValidateProps.js +7 -0
- package/esm/parts/system-message/style.js +1 -1
- package/esm/parts/tile-button/TileButton.js +35 -27
- package/esm/parts/tile-button/config/useValidateProps.js +7 -0
- package/esm/parts/tile-button/props.js +14 -7
- package/esm/parts/tile-button/styled.js +15 -10
- package/esm/styled.js +1 -1
- package/package.json +69 -6
- package/types/ChatDataTestids.d.ts +21 -0
- package/types/index.d.ts +1 -1
- package/types/parts/bubble/ChatBubble.d.ts +20 -5
- package/types/parts/bubble/config/useValidateProps.d.ts +2 -0
- package/types/parts/bubble/index.d.ts +1 -1
- package/types/parts/bubble/props.d.ts +13 -4
- package/types/parts/bubble/styled.d.ts +9 -9
- package/types/parts/bubble/tests/ChatBubble.test.d.ts +1 -0
- package/types/parts/chat-card/ChatCard.d.ts +25 -5
- package/types/parts/chat-card/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-card/props.d.ts +19 -3
- package/types/parts/chat-card/styled.d.ts +6 -6
- package/types/parts/chat-composer/ChatContainerComposer.d.ts +48 -12
- package/types/parts/chat-composer/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-composer/styled.d.ts +117 -24
- package/types/parts/chat-composer/tests/ChatContainerComposer.test.d.ts +1 -0
- package/types/parts/chat-container/ChatContainer.d.ts +54 -12
- package/types/parts/chat-container/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-container/styled.d.ts +4 -4
- package/types/parts/chat-container/tests/ChatContainer.test.d.ts +1 -0
- package/types/parts/chat-container-header/helpers.d.ts +6 -0
- package/types/parts/chat-container-header/styled.d.ts +3 -3
- package/types/parts/chat-container-messages-list/ChatContainerMessagesList.d.ts +39 -9
- package/types/parts/chat-container-messages-list/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-container-messages-list/styled.d.ts +7 -6
- package/types/parts/chat-empty-state/ChatEmptyState.d.ts +19 -1
- package/types/parts/chat-empty-state/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-empty-state/props.d.ts +7 -1
- package/types/parts/chat-empty-state/styled.d.ts +2 -2
- package/types/parts/chat-sidebar/SideBarChat.d.ts +40 -10
- package/types/parts/chat-sidebar/config/useValidateProps.d.ts +2 -0
- package/types/parts/chat-sidebar/props.d.ts +39 -9
- package/types/parts/chat-sidebar/styled.d.ts +2 -2
- package/types/parts/floating-button/FloatingButton.d.ts +11 -2
- package/types/parts/floating-button/props.d.ts +13 -1
- package/types/parts/floating-button/styled.d.ts +1 -1
- package/types/parts/floating-container/styled.d.ts +1 -2
- package/types/parts/grid-influencer/styled.d.ts +2 -2
- package/types/parts/message-delimiter/MessageDelimiter.d.ts +22 -5
- package/types/parts/message-delimiter/config/useValidateProps.d.ts +2 -0
- package/types/parts/message-delimiter/props.d.ts +16 -3
- package/types/parts/message-delimiter/styled.d.ts +3 -3
- package/types/parts/sidebar-button/SidebarButton.d.ts +16 -5
- package/types/parts/sidebar-button/props.d.ts +16 -5
- package/types/parts/sidebar-button/styled.d.ts +3 -3
- package/types/parts/system-message/SystemMessage.d.ts +13 -3
- package/types/parts/system-message/config/useValidateProps.d.ts +2 -0
- package/types/parts/system-message/props.d.ts +7 -1
- package/types/parts/system-message/style.d.ts +5 -5
- package/types/parts/tile-button/TileButton.d.ts +66 -17
- package/types/parts/tile-button/config/useValidateProps.d.ts +2 -0
- package/types/parts/tile-button/props.d.ts +64 -16
- package/types/parts/tile-button/styled.d.ts +9 -8
- package/types/prop-types.d.ts +28 -9
- package/types/tests/utils.d.ts +27 -0
- package/cjs/package.json +0 -4
- package/esm/package.json +0 -4
- package/types/parts/chat-composer/props.d.ts +0 -32
- package/types/parts/chat-container/props.d.ts +0 -38
- package/types/parts/chat-container-messages-list/props.d.ts +0 -31
|
@@ -4,11 +4,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
+
require('core-js/modules/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');
|
|
7
14
|
var React = require('react');
|
|
8
15
|
var dsGrid = require('@elliemae/ds-grid');
|
|
9
16
|
var reactDesc = require('react-desc');
|
|
10
|
-
var
|
|
17
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
11
18
|
var styled = require('./styled.js');
|
|
19
|
+
var useValidateProps = require('./config/useValidateProps.js');
|
|
12
20
|
var props = require('./props.js');
|
|
13
21
|
var jsxRuntime = require('react/jsx-runtime');
|
|
14
22
|
|
|
@@ -17,17 +25,17 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
17
25
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
26
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
19
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
|
-
var PaperAirplane__default = /*#__PURE__*/_interopDefaultLegacy(PaperAirplane);
|
|
21
28
|
|
|
22
29
|
var _PaperAirplane, _Grid;
|
|
23
30
|
|
|
24
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
25
32
|
|
|
26
|
-
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[
|
|
33
|
+
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; }
|
|
27
34
|
|
|
28
35
|
const ChatComposer = props => {
|
|
29
36
|
var _input$current;
|
|
30
37
|
|
|
38
|
+
useValidateProps.useValidateProps(props, ChatComposerWithSchema.toJSON());
|
|
31
39
|
const {
|
|
32
40
|
inputValue,
|
|
33
41
|
onChange,
|
|
@@ -35,26 +43,41 @@ const ChatComposer = props => {
|
|
|
35
43
|
onSend,
|
|
36
44
|
onFocus,
|
|
37
45
|
onBlur,
|
|
46
|
+
onKeyDown,
|
|
38
47
|
maxHeight = 300,
|
|
39
48
|
placeholder,
|
|
40
49
|
inputMaxLength,
|
|
50
|
+
maxLengthMessage,
|
|
41
51
|
buttonDisabled,
|
|
42
|
-
dataTestid
|
|
52
|
+
dataTestid,
|
|
53
|
+
actionRef
|
|
43
54
|
} = props;
|
|
44
|
-
const input = React__default[
|
|
45
|
-
const inputSize = React__default[
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
React__default[
|
|
55
|
+
const input = React__default["default"].useRef();
|
|
56
|
+
const inputSize = React__default["default"].useRef();
|
|
57
|
+
const inputSend = React__default["default"].useRef();
|
|
58
|
+
const [height, setHeight] = React__default["default"].useState(32);
|
|
59
|
+
const internalMaxHeight = React__default["default"].useMemo(() => maxHeight - 24, [maxHeight]);
|
|
60
|
+
const [showScroll, setShowScroll] = React__default["default"].useState(true);
|
|
61
|
+
React__default["default"].useEffect(() => {
|
|
50
62
|
var _inputSize$current, _inputSize$current2, _inputSize$current3, _inputSize$current4;
|
|
51
63
|
|
|
52
64
|
const newHeight = ((_inputSize$current = inputSize.current) === null || _inputSize$current === void 0 ? void 0 : _inputSize$current.scrollHeight) > internalMaxHeight ? internalMaxHeight : (_inputSize$current2 = inputSize.current) === null || _inputSize$current2 === void 0 ? void 0 : _inputSize$current2.scrollHeight;
|
|
53
65
|
onResize(newHeight);
|
|
54
66
|
setHeight(newHeight);
|
|
55
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);
|
|
56
|
-
}, [inputValue, internalMaxHeight]);
|
|
57
|
-
|
|
68
|
+
}, [inputValue, internalMaxHeight, onResize]);
|
|
69
|
+
React__default["default"].useEffect(() => {
|
|
70
|
+
if (actionRef && actionRef.current) {
|
|
71
|
+
actionRef.current.focusToComposer = () => {
|
|
72
|
+
input.current.focus();
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
actionRef.current.focusToSend = () => {
|
|
76
|
+
inputSend.current.focus();
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}, [actionRef]);
|
|
80
|
+
const handleChange = React__default["default"].useCallback(e => {
|
|
58
81
|
onChange(e.target.value);
|
|
59
82
|
}, [onChange]);
|
|
60
83
|
const heightProps = {
|
|
@@ -62,12 +85,12 @@ const ChatComposer = props => {
|
|
|
62
85
|
overflow: showScroll ? 'auto' : 'hidden'
|
|
63
86
|
};
|
|
64
87
|
const inputLength = String(inputValue || '').length;
|
|
65
|
-
const hasError = React__default[
|
|
66
|
-
return /*#__PURE__*/_jsx__default[
|
|
88
|
+
const hasError = React__default["default"].useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);
|
|
89
|
+
return /*#__PURE__*/_jsx__default["default"](styled.StyledChatContainerContentComposer, {
|
|
67
90
|
rows: ['auto', '15px'],
|
|
68
|
-
maxHeight:
|
|
91
|
+
maxHeight: "".concat(maxHeight, "px"),
|
|
69
92
|
"data-testid": dataTestid
|
|
70
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
93
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
71
94
|
cols: ['1fr', '24px'],
|
|
72
95
|
justifyContent: "center",
|
|
73
96
|
alignItems: "flex-end",
|
|
@@ -79,15 +102,16 @@ const ChatComposer = props => {
|
|
|
79
102
|
value: inputValue,
|
|
80
103
|
onFocus: onFocus,
|
|
81
104
|
onBlur: onBlur,
|
|
105
|
+
onKeyDown: onKeyDown,
|
|
82
106
|
placeholder: placeholder,
|
|
83
107
|
"aria-label": "Message to send",
|
|
84
108
|
"data-testid": "chat-composer-textarea"
|
|
85
|
-
}), /*#__PURE__*/_jsx__default[
|
|
109
|
+
}), /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
86
110
|
height: "32px",
|
|
87
111
|
alignItems: "center"
|
|
88
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
112
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledComposerButton, {
|
|
89
113
|
buttonType: "text",
|
|
90
|
-
icon: _PaperAirplane || (_PaperAirplane = /*#__PURE__*/_jsx__default[
|
|
114
|
+
icon: _PaperAirplane || (_PaperAirplane = /*#__PURE__*/_jsx__default["default"](dsIcons.PaperAirplane, {
|
|
91
115
|
width: 18,
|
|
92
116
|
height: 18
|
|
93
117
|
})),
|
|
@@ -95,7 +119,8 @@ const ChatComposer = props => {
|
|
|
95
119
|
size: "s",
|
|
96
120
|
disabled: !inputValue || buttonDisabled || hasError,
|
|
97
121
|
"data-testid": "chat-composer-send-button",
|
|
98
|
-
"aria-label": "Send"
|
|
122
|
+
"aria-label": "Send",
|
|
123
|
+
innerRef: inputSend
|
|
99
124
|
}))), /*#__PURE__*/jsxRuntime.jsx(styled.StyledComposerInput, {
|
|
100
125
|
ref: inputSize,
|
|
101
126
|
style: {
|
|
@@ -109,20 +134,20 @@ const ChatComposer = props => {
|
|
|
109
134
|
onChange: handleChange,
|
|
110
135
|
value: inputValue // maxLength={inputMaxLength}
|
|
111
136
|
|
|
112
|
-
}), /*#__PURE__*/_jsx__default[
|
|
137
|
+
}), /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
113
138
|
cols: ['1fr', '24px'],
|
|
114
139
|
justifyContent: "flex-end",
|
|
115
140
|
alignItems: "center",
|
|
116
141
|
gutter: "xxs",
|
|
117
142
|
pb: "xxs"
|
|
118
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
143
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledCounterArea, {
|
|
119
144
|
hasError: hasError,
|
|
120
145
|
"data-testid": "composer-counter-area"
|
|
121
146
|
}, void 0, inputMaxLength && hasError ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
122
|
-
children: [/*#__PURE__*/_jsx__default[
|
|
147
|
+
children: [/*#__PURE__*/_jsx__default["default"](styled.StyledCounterErrorA11y, {
|
|
123
148
|
role: "alert"
|
|
124
|
-
}, void 0, "You have exceeded the character limit by "
|
|
125
|
-
}) : '', inputMaxLength ?
|
|
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, {}))));
|
|
126
151
|
};
|
|
127
152
|
|
|
128
153
|
ChatComposer.defaultProps = props.defaultComposerPros;
|
|
@@ -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;
|
|
@@ -13,23 +13,29 @@ 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
|
-
dataTestid: 'ds-chat-composer'
|
|
21
|
+
dataTestid: 'ds-chat-composer',
|
|
22
|
+
actionRef: lodash.noop
|
|
20
23
|
};
|
|
21
24
|
const composerProps = {
|
|
22
25
|
placeholder: reactDesc.PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),
|
|
23
26
|
inputValue: reactDesc.PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),
|
|
27
|
+
maxLengthMessage: reactDesc.PropTypes.string.description('Max length message').defaultValue(defaultComposerPros.maxLengthMessage),
|
|
24
28
|
onChange: reactDesc.PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),
|
|
25
29
|
onResize: reactDesc.PropTypes.func.description('Called the input changes his height').defaultValue(defaultComposerPros.onResize),
|
|
26
30
|
onSend: reactDesc.PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),
|
|
27
31
|
onFocus: reactDesc.PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),
|
|
28
|
-
onBlur: reactDesc.PropTypes.
|
|
32
|
+
onBlur: reactDesc.PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),
|
|
33
|
+
onKeyDown: reactDesc.PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),
|
|
29
34
|
maxHeight: reactDesc.PropTypes.number.description('Max height of the composer. Use 0 for no limit').defaultValue(defaultComposerPros.onBlur),
|
|
30
35
|
inputMaxLength: reactDesc.PropTypes.number.description('Max length of the composer. `undefined` for no limit').defaultValue(defaultComposerPros.inputMaxLength),
|
|
31
|
-
buttonDisabled: reactDesc.PropTypes.
|
|
32
|
-
dataTestid: reactDesc.PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder)
|
|
36
|
+
buttonDisabled: reactDesc.PropTypes.bool.description('Control the disabled for the send button').defaultValue(defaultComposerPros.buttonDisabled),
|
|
37
|
+
dataTestid: reactDesc.PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),
|
|
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)
|
|
33
39
|
};
|
|
34
40
|
|
|
35
41
|
exports.composerProps = composerProps;
|
|
@@ -4,26 +4,26 @@ 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
|
|
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
|
|
|
11
11
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
12
12
|
|
|
13
13
|
// Composer
|
|
14
|
-
const StyledChatContainerContentComposer = /*#__PURE__*/styled__default[
|
|
14
|
+
const StyledChatContainerContentComposer = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
15
15
|
componentId: "sc-1ahwpce-0"
|
|
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
|
-
const StyledComposerInput = /*#__PURE__*/styled__default[
|
|
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.
|
|
20
|
-
const StyledComposerButton = /*#__PURE__*/styled__default[
|
|
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
|
-
const StyledCounterArea = /*#__PURE__*/styled__default[
|
|
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 ?
|
|
26
|
-
const StyledCounterErrorA11y = /*#__PURE__*/styled__default[
|
|
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
|
+
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);"]);
|
|
29
29
|
|
|
@@ -2,17 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
11
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
12
|
var React = require('react');
|
|
8
13
|
var lodash = require('lodash');
|
|
9
14
|
var reactDesc = require('react-desc');
|
|
10
|
-
var DSIndeterminateProgressIndicator = require('@elliemae/ds-
|
|
15
|
+
var DSIndeterminateProgressIndicator = require('@elliemae/ds-indeterminate-progress-indicator');
|
|
11
16
|
var DSBanner = require('@elliemae/ds-banner');
|
|
12
17
|
var ChatContainerComposer = require('../chat-composer/ChatContainerComposer.js');
|
|
13
18
|
var ChatContainerMessagesList = require('../chat-container-messages-list/ChatContainerMessagesList.js');
|
|
14
19
|
var props = require('./props.js');
|
|
15
20
|
var styled = require('./styled.js');
|
|
21
|
+
var useValidateProps = require('./config/useValidateProps.js');
|
|
16
22
|
var jsxRuntime = require('react/jsx-runtime');
|
|
17
23
|
|
|
18
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -27,11 +33,12 @@ var _DSIndeterminateProgr, _StyledIndicatorConta;
|
|
|
27
33
|
|
|
28
34
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
29
35
|
|
|
30
|
-
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[
|
|
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; }
|
|
31
37
|
|
|
32
|
-
const ChatContainer = props => {
|
|
38
|
+
const ChatContainer = props$1 => {
|
|
33
39
|
var _containerRef$current;
|
|
34
40
|
|
|
41
|
+
useValidateProps.useValidateProps(props$1, props.containerProps);
|
|
35
42
|
const {
|
|
36
43
|
sendingText,
|
|
37
44
|
sendingMessages,
|
|
@@ -40,37 +47,72 @@ const ChatContainer = props => {
|
|
|
40
47
|
messagesListProps,
|
|
41
48
|
composerProps,
|
|
42
49
|
composerProps: {
|
|
43
|
-
onResize: onComposerResize
|
|
50
|
+
onResize: onComposerResize,
|
|
51
|
+
onKeyDown: onComposerKeyDown
|
|
44
52
|
},
|
|
45
53
|
actionRef,
|
|
46
|
-
autoScroll,
|
|
47
54
|
device,
|
|
48
55
|
isLoading,
|
|
49
56
|
hasMoreItems,
|
|
50
|
-
getMoreMessages
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
57
|
+
getMoreMessages,
|
|
58
|
+
ariaLabel
|
|
59
|
+
} = props$1;
|
|
60
|
+
const bannerRef = React__default["default"].useRef({
|
|
61
|
+
focusOnWrapper: lodash.noop,
|
|
62
|
+
focusOnLink: lodash.noop
|
|
63
|
+
});
|
|
64
|
+
const containerRef = React__default["default"].useRef();
|
|
65
|
+
const listRef = React__default["default"].useRef({
|
|
54
66
|
scrollToIndex: lodash.noop
|
|
55
67
|
});
|
|
56
|
-
const onResize = React__default[
|
|
68
|
+
const onResize = React__default["default"].useCallback(height => {
|
|
57
69
|
if (onComposerResize) onComposerResize(height);
|
|
58
70
|
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
if (height > 30) {
|
|
72
|
+
/*
|
|
73
|
+
setTimeout is used to equal the animation duration from the
|
|
74
|
+
composer text area when increase its size
|
|
75
|
+
*/
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
actionRef.current.scrollToIndex(messagesListProps.messages.length - 1, {
|
|
78
|
+
align: 'start'
|
|
79
|
+
});
|
|
80
|
+
}, 50);
|
|
63
81
|
}
|
|
64
|
-
}, [onComposerResize, messagesListProps.messages,
|
|
82
|
+
}, [onComposerResize, messagesListProps.messages, actionRef]);
|
|
65
83
|
const Container = device === 'desktop' ? styled.StyledChatContainerContent : styled.MobileStyledChatContainerContent;
|
|
84
|
+
const handleTabs = React__default["default"].useCallback(e => {
|
|
85
|
+
if (onComposerKeyDown) onComposerKeyDown(e);else {
|
|
86
|
+
const ref = actionRef || listRef;
|
|
87
|
+
|
|
88
|
+
if (e.shiftKey && e.key === 'Tab') {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
|
|
91
|
+
if (['top', 'bottom'].includes(bannerPosition)) {
|
|
92
|
+
bannerRef.current.focusOnWrapper();
|
|
93
|
+
} else {
|
|
94
|
+
const last = ref.current.getMessagesInView().pop();
|
|
95
|
+
ref.current.focusToIndexWithoutScroll(last);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, [actionRef, onComposerKeyDown, bannerPosition]); // Map actions
|
|
100
|
+
|
|
101
|
+
React__default["default"].useEffect(() => {
|
|
102
|
+
if (actionRef && actionRef.current) {
|
|
103
|
+
actionRef.current.focusOnBanner = bannerRef.current.focusOnWrapper;
|
|
104
|
+
actionRef.current.focusOnBannerLink = bannerRef.current.focusOnLink;
|
|
105
|
+
}
|
|
106
|
+
}, [actionRef]);
|
|
66
107
|
return /*#__PURE__*/jsxRuntime.jsxs(Container, {
|
|
67
108
|
rows: ['minmax(0, 1fr)', 'auto'],
|
|
68
109
|
ref: containerRef,
|
|
69
110
|
role: "region",
|
|
70
|
-
"aria-label":
|
|
71
|
-
children: [/*#__PURE__*/_jsx__default[
|
|
111
|
+
"aria-label": ariaLabel,
|
|
112
|
+
children: [/*#__PURE__*/_jsx__default["default"]("div", {
|
|
72
113
|
style: {
|
|
73
|
-
position: 'relative'
|
|
114
|
+
position: 'relative',
|
|
115
|
+
overflow: 'hidden'
|
|
74
116
|
}
|
|
75
117
|
}, void 0, /*#__PURE__*/jsxRuntime.jsx(ChatContainerMessagesList.ChatContainerMessagesList, _objectSpread(_objectSpread({}, messagesListProps), {}, {
|
|
76
118
|
actionRef: actionRef || listRef,
|
|
@@ -78,15 +120,19 @@ const ChatContainer = props => {
|
|
|
78
120
|
hasMoreItems: hasMoreItems,
|
|
79
121
|
getMoreMessages: getMoreMessages,
|
|
80
122
|
sendingMessages: sendingMessages,
|
|
81
|
-
sendingText: sendingText
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
123
|
+
sendingText: sendingText,
|
|
124
|
+
bannerPosition: bannerPosition,
|
|
125
|
+
bannerRef: bannerRef
|
|
126
|
+
})), ['top', 'bottom'].includes(isLoading) ? /*#__PURE__*/_jsx__default["default"](styled.StyledIndicatorContainer, {
|
|
127
|
+
isLoading: isLoading,
|
|
128
|
+
"data-testid": "ds-chat-loading-indicator"
|
|
129
|
+
}, void 0, _DSIndeterminateProgr || (_DSIndeterminateProgr = /*#__PURE__*/_jsx__default["default"](DSIndeterminateProgressIndicator__default["default"], {
|
|
85
130
|
processing: true,
|
|
86
131
|
title: "Loading"
|
|
87
|
-
}))) : null,
|
|
132
|
+
}))) : null, /*#__PURE__*/_jsx__default["default"](styled.StyledIndicatorContainer, {
|
|
133
|
+
linear: true,
|
|
88
134
|
isLoading: bannerPosition
|
|
89
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
135
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](DSBanner__default["default"], {
|
|
90
136
|
showCloseButton: true,
|
|
91
137
|
label: bannerProps.label || 'Unread messages',
|
|
92
138
|
containerProps: {
|
|
@@ -98,17 +144,21 @@ const ChatContainer = props => {
|
|
|
98
144
|
},
|
|
99
145
|
onClose: bannerProps.onClose,
|
|
100
146
|
isOpen: true,
|
|
101
|
-
type: DSBanner.BANNER_TYPES.INFO
|
|
102
|
-
|
|
147
|
+
type: bannerProps.type || DSBanner.BANNER_TYPES.INFO,
|
|
148
|
+
actionRef: bannerRef
|
|
149
|
+
})), sendingMessages && sendingMessages.length > 0 ? _StyledIndicatorConta || (_StyledIndicatorConta = /*#__PURE__*/_jsx__default["default"](styled.StyledIndicatorContainer, {
|
|
103
150
|
isLoading: "bottom",
|
|
104
|
-
linear: true
|
|
105
|
-
|
|
151
|
+
linear: true,
|
|
152
|
+
"data-testid": "ds-chat-loading-indicator"
|
|
153
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](DSIndeterminateProgressIndicator__default["default"], {
|
|
106
154
|
processing: true,
|
|
107
155
|
title: "Loading",
|
|
108
156
|
lineOnly: true
|
|
109
157
|
}))) : null), /*#__PURE__*/jsxRuntime.jsx(ChatContainerComposer.ChatComposer, _objectSpread(_objectSpread({}, composerProps), {}, {
|
|
158
|
+
onKeyDown: handleTabs,
|
|
110
159
|
onResize: onResize,
|
|
111
|
-
maxHeight: (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientHeight) || 0) / 2
|
|
160
|
+
maxHeight: (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientHeight) || 0) / 2,
|
|
161
|
+
actionRef: actionRef || listRef
|
|
112
162
|
}))]
|
|
113
163
|
});
|
|
114
164
|
};
|
|
@@ -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, propTypes) => {
|
|
8
|
+
dsPropsHelpers.useValidateTypescriptPropTypes(props, propTypes);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.useValidateProps = useValidateProps;
|
|
@@ -4,13 +4,14 @@ 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
|
|
|
10
11
|
const defaultProps = {
|
|
11
12
|
messagesListProps: props.defaultProps,
|
|
12
13
|
composerProps: props$1.defaultComposerPros,
|
|
13
|
-
actionRef:
|
|
14
|
+
actionRef: undefined,
|
|
14
15
|
autoScroll: false,
|
|
15
16
|
device: 'desktop',
|
|
16
17
|
isLoading: undefined,
|
|
@@ -18,26 +19,30 @@ 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
|
-
messagesListProps: reactDesc.PropTypes.
|
|
31
|
-
composerProps: reactDesc.PropTypes.
|
|
33
|
+
messagesListProps: reactDesc.PropTypes.object.description('ChatMessageList props "messages" / "onScrollEnds"').defaultValue(defaultProps.messagesListProps),
|
|
34
|
+
composerProps: reactDesc.PropTypes.object.description('Composer configuration').defaultValue(defaultProps.composerProps),
|
|
32
35
|
autoScroll: reactDesc.PropTypes.bool.description('Auto scroll to bottom on resize').defaultValue(defaultProps.autoScroll),
|
|
33
36
|
device: reactDesc.PropTypes.string.description('Option to render mobile or desktop style composer').defaultValue(defaultProps.device),
|
|
34
37
|
isLoading: reactDesc.PropTypes.oneOf(['top', 'bottom', undefined]).description('Show Loading messages indicator at the `top` or `bottom` of the container'),
|
|
35
38
|
hasMoreItems: reactDesc.PropTypes.oneOf(['top', 'bottom', undefined]).description('Show Load More button at the `top` or `bottom` of the container'),
|
|
36
39
|
getMoreMessages: reactDesc.PropTypes.func.description('Called when the user clicks on load more').defaultValue(defaultProps.getMoreMessages),
|
|
37
40
|
bannerPosition: reactDesc.PropTypes.oneOf(['top', 'bottom', undefined]).description('Show Loading messages indicator at the `top` or `bottom` of the container'),
|
|
38
|
-
bannerProps: reactDesc.PropTypes.
|
|
39
|
-
sendingMessages: reactDesc.PropTypes.
|
|
40
|
-
sendingText: reactDesc.PropTypes.string.description('Label description for messages in sending status').defaultValue(defaultProps.sendingText)
|
|
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),
|
|
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),
|
|
43
|
+
sendingText: reactDesc.PropTypes.string.description('Label description for messages in sending status').defaultValue(defaultProps.sendingText),
|
|
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)
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
exports.containerProps = containerProps;
|
|
@@ -13,15 +13,15 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
14
14
|
|
|
15
15
|
const CONTAINER_WIDTH = 300;
|
|
16
|
-
const StyledChatContainerContent = /*#__PURE__*/styled__default[
|
|
16
|
+
const StyledChatContainerContent = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
17
17
|
componentId: "sc-d732wo-0"
|
|
18
18
|
})(["height:100%;min-width:", "px;overflow:hidden;background:", ";position:relative;"], CONTAINER_WIDTH, props => props.theme.colors.neutral['050']);
|
|
19
|
-
const StyledIndicatorContainer = /*#__PURE__*/styled__default[
|
|
19
|
+
const StyledIndicatorContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
20
20
|
componentId: "sc-d732wo-1"
|
|
21
|
-
})(["position:absolute;width:
|
|
22
|
-
const MobileStyledChatContainerContent = /*#__PURE__*/styled__default[
|
|
21
|
+
})(["transition:0.4s ease-in-out;position:absolute;visibility:hidden;pointer-events:none;width:100%;padding:0 ", ";left:0;right:0;background:", ";", " ", " & div,a{font-size:13px;}"], props => !props.linear ? props.theme.space.xxs : 0, props => props.theme.colors.neutral['000'], props => props.isLoading === 'top' ? "\n top: -41px;\n transform: translate(0, 41px);\n visibility: visible;\n pointer-events: auto\n " : '', props => props.isLoading === 'bottom' ? "\n bottom: -41px;\n transform: translate(0, -41px);\n visibility: visible;\n pointer-events: auto;\n " : '');
|
|
22
|
+
const MobileStyledChatContainerContent = /*#__PURE__*/styled__default["default"](StyledChatContainerContent).withConfig({
|
|
23
23
|
componentId: "sc-d732wo-2"
|
|
24
|
-
})(["", ",", "{font-size:16px;}", "{font-size:13px;}", "{background-color:#fff;box-shadow:-0 1px 3px rgba(53,60,70,0.8);}", ",", "{font-size:16px;text-align:left;}", "{font-size:13px;}", "{font-size:16px;}"], styled$1.StyledTitleLeftBubble, styled$1.StyleBodyWrapper, styled$1.StyledTitleRightBubble, style.Wrapper, style.Title, style.Message, style.Time, styled$2.StyledComposerInput);
|
|
24
|
+
})(["", ",", "{font-size:16px;}", "{font-size:13px;}", "{background-color:#fff;box-shadow:-0 1px 3px rgba(53,60,70,0.8);}", ",", "{font-size:16px;text-align:left;}", "{font-size:13px;}", "{font-size:16px;}", "{font-size:16px;}"], styled$1.StyledTitleLeftBubble, styled$1.StyleBodyWrapper, styled$1.StyledTitleRightBubble, style.Wrapper, style.Title, style.Message, style.Time, styled$2.StyledComposerInput, StyledIndicatorContainer);
|
|
25
25
|
|
|
26
26
|
exports.CONTAINER_WIDTH = CONTAINER_WIDTH;
|
|
27
27
|
exports.MobileStyledChatContainerContent = MobileStyledChatContainerContent;
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
|
|
6
|
+
require('react');
|
|
7
7
|
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
8
8
|
var styled = require('./styled.js');
|
|
9
|
+
var helpers = require('./helpers.js');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
12
|
|
|
12
13
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
13
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
14
|
|
|
15
15
|
const ChatContainerHeader = props => {
|
|
16
16
|
const {
|
|
@@ -18,19 +18,19 @@ const ChatContainerHeader = props => {
|
|
|
18
18
|
floating,
|
|
19
19
|
children
|
|
20
20
|
} = props;
|
|
21
|
-
return /*#__PURE__*/_jsx__default[
|
|
21
|
+
return /*#__PURE__*/_jsx__default["default"](styled.StyledChatContainerContentHeader, {
|
|
22
22
|
alignItems: "center",
|
|
23
23
|
cols: ['minmax(calc(100% - 64px), 1fr)', children ? 'auto' : '0px'],
|
|
24
24
|
floating: floating,
|
|
25
25
|
role: "heading"
|
|
26
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
26
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledChatContainerContentHeaderLabel, {
|
|
27
27
|
"data-testid": "chat-container-header-title",
|
|
28
28
|
pl: "xxs",
|
|
29
29
|
pr: "xxs"
|
|
30
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
30
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
31
31
|
value: title
|
|
32
|
-
})), /*#__PURE__*/_jsx__default[
|
|
33
|
-
cols:
|
|
32
|
+
})), /*#__PURE__*/_jsx__default["default"](styled.StyledChatContainerContentHeaderActions, {
|
|
33
|
+
cols: helpers.validHeaderChilds(children),
|
|
34
34
|
justifyContent: "flex-end",
|
|
35
35
|
"data-testid": "chat-container-header-children"
|
|
36
36
|
}, void 0, children));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.to-array.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.to-array.js');
|
|
13
|
+
var React = require('react');
|
|
14
|
+
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
|
+
|
|
19
|
+
const validHeaderChilds = children => React__default["default"].Children.toArray(children).filter(e => {
|
|
20
|
+
if (Array.isArray(e.props.children)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (e.props.children === undefined && e.$$typeof.toString() === 'Symbol(react.element)') {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return !!e.props.children;
|
|
29
|
+
}).map(() => '32px');
|
|
30
|
+
|
|
31
|
+
exports.validHeaderChilds = validHeaderChilds;
|
|
@@ -9,15 +9,15 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const StyledChatContainerContentHeaderActions = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
13
13
|
componentId: "sc-jmynvr-0"
|
|
14
|
-
})(["width:
|
|
15
|
-
const
|
|
14
|
+
})(["max-width:80px;"]);
|
|
15
|
+
const StyledChatContainerContentHeader = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
16
16
|
componentId: "sc-jmynvr-1"
|
|
17
|
-
})(["
|
|
18
|
-
const
|
|
17
|
+
})(["width:100%;min-height:48px;border-bottom:1px solid ", ";background:", ";", "{& button{background:transparent;}}"], props => props.theme.colors.neutral['200'], props => props.theme.colors.neutral['050'], StyledChatContainerContentHeaderActions);
|
|
18
|
+
const StyledChatContainerContentHeaderLabel = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
19
19
|
componentId: "sc-jmynvr-2"
|
|
20
|
-
})(["
|
|
20
|
+
})(["justify-content:center;align-items:center;font-weight:bold;font-size:18px;color:", ";"], props => props.theme.colors.neutral['700']);
|
|
21
21
|
|
|
22
22
|
exports.StyledChatContainerContentHeader = StyledChatContainerContentHeader;
|
|
23
23
|
exports.StyledChatContainerContentHeaderActions = StyledChatContainerContentHeaderActions;
|