@elliemae/ds-chat 2.0.0-next.1 → 2.0.0-next.6
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/parts/bubble/ChatBubble.js +6 -6
- package/cjs/parts/bubble/config/useValidateProps.js +5 -6
- package/cjs/parts/bubble/styled.js +1 -30
- package/cjs/parts/chat-card/props.js +2 -2
- package/cjs/parts/chat-composer/ChatContainerComposer.js +3 -2
- package/cjs/parts/chat-composer/props.js +1 -11
- package/cjs/parts/chat-composer/styled.js +2 -2
- package/cjs/parts/chat-container/props.js +1 -11
- package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +6 -6
- package/cjs/parts/chat-container-messages-list/props.js +2 -12
- package/cjs/parts/chat-container-messages-list/styled.js +1 -5
- package/cjs/parts/grid-influencer/styled.js +2 -6
- package/cjs/parts/message-delimiter/styled.js +1 -1
- package/cjs/parts/sidebar-button/SidebarButton.js +1 -1
- package/cjs/parts/tile-button/TileButton.js +3 -3
- package/cjs/parts/tile-button/styled.js +1 -1
- package/cjs/styled.js +1 -1
- package/esm/parts/bubble/ChatBubble.js +6 -6
- package/esm/parts/bubble/config/useValidateProps.js +5 -6
- package/esm/parts/bubble/styled.js +1 -30
- package/esm/parts/chat-card/props.js +2 -2
- package/esm/parts/chat-composer/ChatContainerComposer.js +3 -2
- package/esm/parts/chat-composer/props.js +1 -11
- package/esm/parts/chat-composer/styled.js +2 -2
- package/esm/parts/chat-container/props.js +1 -11
- package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +6 -6
- package/esm/parts/chat-container-messages-list/props.js +2 -12
- package/esm/parts/chat-container-messages-list/styled.js +1 -5
- package/esm/parts/grid-influencer/styled.js +2 -6
- package/esm/parts/message-delimiter/styled.js +1 -1
- package/esm/parts/sidebar-button/SidebarButton.js +1 -1
- package/esm/parts/tile-button/TileButton.js +3 -3
- package/esm/parts/tile-button/styled.js +1 -1
- package/esm/styled.js +1 -1
- package/package.json +4 -4
- package/cjs/package.json +0 -4
- package/esm/package.json +0 -4
|
@@ -31,7 +31,7 @@ const ChatBubble = props => {
|
|
|
31
31
|
helpMessage
|
|
32
32
|
} = props;
|
|
33
33
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledWrapper, {
|
|
34
|
-
"data-testid":
|
|
34
|
+
"data-testid": "ds-chat-bubble-".concat(dsId),
|
|
35
35
|
type: type
|
|
36
36
|
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledColoredBubble, {
|
|
37
37
|
type: type
|
|
@@ -42,22 +42,22 @@ const ChatBubble = props => {
|
|
|
42
42
|
className: "sr-only"
|
|
43
43
|
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledTitleLeftBubble, {
|
|
44
44
|
alignItems: "center",
|
|
45
|
-
"data-testid":
|
|
45
|
+
"data-testid": "chat-bubble-title-".concat(dsId)
|
|
46
46
|
}, void 0, title), /*#__PURE__*/_jsx__default["default"](styled.StyledTitleRightBubble, {
|
|
47
47
|
alignItems: "center",
|
|
48
48
|
type: type,
|
|
49
|
-
"data-testid":
|
|
49
|
+
"data-testid": "chat-bubble-time-".concat(dsId)
|
|
50
50
|
}, void 0, time)), /*#__PURE__*/_jsx__default["default"](styled.StyleBodyWrapper, {
|
|
51
|
-
"data-testid":
|
|
51
|
+
"data-testid": "chat-bubble-body-".concat(dsId)
|
|
52
52
|
}, void 0, body), /*#__PURE__*/_jsx__default["default"](ChatBubbleArrow.ChatBubbleArrow, {
|
|
53
53
|
type: type
|
|
54
54
|
})), errorMessage ? /*#__PURE__*/_jsx__default["default"](styled.StyleErrorMessage, {
|
|
55
|
-
"data-testid":
|
|
55
|
+
"data-testid": "chat-bubble-error-message-".concat(dsId),
|
|
56
56
|
p: "xxs",
|
|
57
57
|
gutter: "xxs",
|
|
58
58
|
cols: [1, 'auto']
|
|
59
59
|
}, void 0, /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, errorMessage), _Warning || (_Warning = /*#__PURE__*/_jsx__default["default"](Warning__default["default"], {}))) : null, helpMessage ? /*#__PURE__*/_jsx__default["default"](styled.StyleHelpMessage, {
|
|
60
|
-
"data-testid":
|
|
60
|
+
"data-testid": "chat-bubble-help-message-".concat(dsId),
|
|
61
61
|
p: "xxs",
|
|
62
62
|
gutter: "xxs",
|
|
63
63
|
cols: [1, 'auto']
|
|
@@ -5,27 +5,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
6
6
|
|
|
7
7
|
const throwError = message => {
|
|
8
|
-
throw new Error(
|
|
9
|
-
`);
|
|
8
|
+
throw new Error("Bubble:: ".concat(message, "\n "));
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
const useValidateProps = (props, schema) => {
|
|
13
12
|
dsPropsHelpers.useValidatePropTypes(props, schema);
|
|
14
13
|
|
|
15
14
|
if (typeof props.title === 'undefined') {
|
|
16
|
-
throwError(
|
|
15
|
+
throwError("Please provide a title property to use this component.");
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
if (typeof props.time === 'undefined') {
|
|
20
|
-
throwError(
|
|
19
|
+
throwError("Please provide a time property to use this component.");
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
if (typeof props.body === 'undefined') {
|
|
24
|
-
throwError(
|
|
23
|
+
throwError("Please provide a body property to use this component.");
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
if (typeof props.type === 'undefined') {
|
|
28
|
-
throwError(
|
|
27
|
+
throwError("Please provide a type property to use this component.");
|
|
29
28
|
}
|
|
30
29
|
};
|
|
31
30
|
|
|
@@ -40,36 +40,7 @@ const StyledBubbleArrow = /*#__PURE__*/styled__default["default"].div.withConfig
|
|
|
40
40
|
})(["display:block;content:'';position:absolute;bottom:10px;height:15px;"]);
|
|
41
41
|
const StyledColoredBubble = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
42
42
|
componentId: "sc-fe8e9o-8"
|
|
43
|
-
})(["min-width:224px;border-radius:10px;position:relative;", ""], props$1 => props$1.type === props.BUBBLE_TYPES.SENDER ?
|
|
44
|
-
border: 1px solid ${props$1.theme.colors.brand['700']};
|
|
45
|
-
background: ${props$1.theme.colors.brand[600]};
|
|
46
|
-
color: ${props$1.theme.colors.neutral['000']};
|
|
47
|
-
${StyledBubbleArrow}{
|
|
48
|
-
right: -9px;
|
|
49
|
-
bottom: 6px;
|
|
50
|
-
svg{
|
|
51
|
-
fill: ${props$1.theme.colors.brand[600]};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
a {
|
|
56
|
-
color: #FFF;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
` : `
|
|
60
|
-
box-shadow: 0 1px 3px 0 rgba(53,60,70,0.80);
|
|
61
|
-
background: ${props$1.theme.colors.neutral['000']};
|
|
62
|
-
color: ${props$1.theme.colors.neutral[700]};
|
|
63
|
-
|
|
64
|
-
${StyledBubbleArrow}{
|
|
65
|
-
left: -11px;
|
|
66
|
-
bottom: 6px;
|
|
67
|
-
svg{
|
|
68
|
-
fill: ${props$1.theme.colors.neutral['000']};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
`);
|
|
43
|
+
})(["min-width:224px;border-radius:10px;position:relative;", ""], props$1 => props$1.type === props.BUBBLE_TYPES.SENDER ? "\n border: 1px solid ".concat(props$1.theme.colors.brand['700'], ";\n background: ").concat(props$1.theme.colors.brand[600], ";\n color: ").concat(props$1.theme.colors.neutral['000'], ";\n ").concat(StyledBubbleArrow, "{ \n right: -9px;\n bottom: 6px;\n svg{\n fill: ").concat(props$1.theme.colors.brand[600], ";\n }\n }\n\n a {\n color: #FFF;\n }\n\n ") : "\n box-shadow: 0 1px 3px 0 rgba(53,60,70,0.80);\n background: ".concat(props$1.theme.colors.neutral['000'], ";\n color: ").concat(props$1.theme.colors.neutral[700], ";\n\n ").concat(StyledBubbleArrow, "{ \n left: -11px;\n bottom: 6px;\n svg{\n fill: ").concat(props$1.theme.colors.neutral['000'], ";\n }\n }\n\n "));
|
|
73
44
|
|
|
74
45
|
exports.StyleBodyWrapper = StyleBodyWrapper;
|
|
75
46
|
exports.StyleErrorMessage = StyleErrorMessage;
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var reactDesc = require('react-desc');
|
|
6
6
|
|
|
7
7
|
const propTypes = {
|
|
8
|
-
title: reactDesc.PropTypes.string.isRequired.description(
|
|
9
|
-
content: reactDesc.PropTypes.string.description(
|
|
8
|
+
title: reactDesc.PropTypes.string.isRequired.description("Card's title"),
|
|
9
|
+
content: reactDesc.PropTypes.string.description("Card's content"),
|
|
10
10
|
time: reactDesc.PropTypes.string.description('Time'),
|
|
11
11
|
rightAddon: reactDesc.PropTypes.element.description('Right addon, badge or icon')
|
|
12
12
|
};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
7
|
require('core-js/modules/web.url.to-json.js');
|
|
8
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
9
|
var React = require('react');
|
|
9
10
|
var dsGrid = require('@elliemae/ds-grid');
|
|
10
11
|
var reactDesc = require('react-desc');
|
|
@@ -81,7 +82,7 @@ const ChatComposer = props => {
|
|
|
81
82
|
const hasError = React__default["default"].useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);
|
|
82
83
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledChatContainerContentComposer, {
|
|
83
84
|
rows: ['auto', '15px'],
|
|
84
|
-
maxHeight:
|
|
85
|
+
maxHeight: "".concat(maxHeight, "px"),
|
|
85
86
|
"data-testid": dataTestid
|
|
86
87
|
}, void 0, /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
87
88
|
cols: ['1fr', '24px'],
|
|
@@ -139,7 +140,7 @@ const ChatComposer = props => {
|
|
|
139
140
|
children: [/*#__PURE__*/_jsx__default["default"](styled.StyledCounterErrorA11y, {
|
|
140
141
|
role: "alert"
|
|
141
142
|
}, void 0, "You have exceeded the character limit by ", inputLength - inputMaxLength), "Please limit to less than ", inputMaxLength, " characters.", ' ']
|
|
142
|
-
}) : '', inputMaxLength ?
|
|
143
|
+
}) : '', inputMaxLength ? "".concat(inputLength, " / ").concat(inputMaxLength) : ''), _Grid || (_Grid = /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {}))));
|
|
143
144
|
};
|
|
144
145
|
|
|
145
146
|
ChatComposer.defaultProps = props.defaultComposerPros;
|
|
@@ -31,17 +31,7 @@ const composerProps = {
|
|
|
31
31
|
inputMaxLength: reactDesc.PropTypes.number.description('Max length of the composer. `undefined` for no limit').defaultValue(defaultComposerPros.inputMaxLength),
|
|
32
32
|
buttonDisabled: reactDesc.PropTypes.bool.description('Control the disabled for the send button').defaultValue(defaultComposerPros.buttonDisabled),
|
|
33
33
|
dataTestid: reactDesc.PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),
|
|
34
|
-
actionRef: reactDesc.PropTypes.object.description(
|
|
35
|
-
{
|
|
36
|
-
scrollToIndex: (n: number) => void,
|
|
37
|
-
getMessagesInView: () => number[],
|
|
38
|
-
focusToIndex: (n: number) => void,
|
|
39
|
-
focusToList: () => void,
|
|
40
|
-
focusToComposer: () => void,
|
|
41
|
-
focusToSend: () => void,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
`).defaultValue(defaultComposerPros.actionRef)
|
|
34
|
+
actionRef: reactDesc.PropTypes.object.description("Reference: \n { \n scrollToIndex: (n: number) => void,\n getMessagesInView: () => number[],\n focusToIndex: (n: number) => void,\n focusToList: () => void,\n focusToComposer: () => void,\n focusToSend: () => void,\n }\n \n ").defaultValue(defaultComposerPros.actionRef)
|
|
45
35
|
};
|
|
46
36
|
|
|
47
37
|
exports.composerProps = composerProps;
|
|
@@ -16,13 +16,13 @@ const StyledChatContainerContentComposer = /*#__PURE__*/styled__default["default
|
|
|
16
16
|
})(["width:100%;min-height:56px;background:", ";padding:", ";padding-bottom:3px;padding-top:6px;padding-left:", ";max-height:", ";border-top:1px solid #cbcfd7;"], props => props.theme.colors.neutral['050'], props => props.theme.space.xxs, props => props.theme.space.xs, props => props.maxHeight);
|
|
17
17
|
const StyledComposerInput = /*#__PURE__*/styled__default["default"].textarea.withConfig({
|
|
18
18
|
componentId: "sc-1ahwpce-1"
|
|
19
|
-
})(["padding:", ";resize:none;min-height:32px;border-radius:2px;border:solid 1px #cbcfd7;color:#25292f;height:", ";min-width:244px;overflow-y:auto;font-size:13px;font-weight:400;line-height:1;transition:height 0.3s;&:focus{outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px #8cc2ed;border-radius:2px;}"], props => props.theme.space.xxs, props => typeof props.height === 'number' ?
|
|
19
|
+
})(["padding:", ";resize:none;min-height:32px;border-radius:2px;border:solid 1px #cbcfd7;color:#25292f;height:", ";min-width:244px;overflow-y:auto;font-size:13px;font-weight:400;line-height:1;transition:height 0.3s;&:focus{outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px #8cc2ed;border-radius:2px;}"], props => props.theme.space.xxs, props => typeof props.height === 'number' ? "".concat(props.height, "px") : props.height, props => props.theme.colors.brand[600]);
|
|
20
20
|
const StyledComposerButton = /*#__PURE__*/styled__default["default"](dsButton.DSButton).withConfig({
|
|
21
21
|
componentId: "sc-1ahwpce-2"
|
|
22
22
|
})(["&:disabled{background:none;svg{fill:#5d6775;}}svg{fill:", ";}&:focus{background:", ";}"], props => props.theme.colors.brand[600], props => props.theme.colors.brand[200]);
|
|
23
23
|
const StyledCounterArea = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
24
24
|
componentId: "sc-1ahwpce-3"
|
|
25
|
-
})(["text-align:right;font-size:11px;height:15px;align-items:center;font-style:italic;", " position:relative;"], props => props.hasError ?
|
|
25
|
+
})(["text-align:right;font-size:11px;height:15px;align-items:center;font-style:italic;", " position:relative;"], props => props.hasError ? "color:".concat(props.theme.colors.danger[900], ";") : '');
|
|
26
26
|
const StyledCounterErrorA11y = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
27
27
|
componentId: "sc-1ahwpce-4"
|
|
28
28
|
})(["width:1px;height:1px;position:absolute;clip:rect(1px,1px,1px,1px);"]);
|
|
@@ -38,17 +38,7 @@ const containerProps = {
|
|
|
38
38
|
bannerProps: reactDesc.PropTypes.object.description('Banner configuration').defaultValue(defaultProps.bannerProps),
|
|
39
39
|
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
40
|
sendingText: reactDesc.PropTypes.string.description('Label description for messages in sending status').defaultValue(defaultProps.sendingText),
|
|
41
|
-
actionRef: reactDesc.PropTypes.object.description(
|
|
42
|
-
{
|
|
43
|
-
scrollToIndex: (n: number) => void,
|
|
44
|
-
getMessagesInView: () => number[],
|
|
45
|
-
focusToIndex: (n: number) => void,
|
|
46
|
-
focusToList: () => void,
|
|
47
|
-
focusToComposer: () => void,
|
|
48
|
-
focusToSend: () => void,
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
`).defaultValue(defaultProps.actionRef)
|
|
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)
|
|
52
42
|
};
|
|
53
43
|
|
|
54
44
|
exports.containerProps = containerProps;
|
|
@@ -84,7 +84,7 @@ const ChatContainerMessagesList = props => {
|
|
|
84
84
|
align: 'center'
|
|
85
85
|
});
|
|
86
86
|
setTimeout(() => {
|
|
87
|
-
virtualListRef.current.querySelector(
|
|
87
|
+
virtualListRef.current.querySelector("[data-index=\"".concat(index, "\"]")).focus();
|
|
88
88
|
}, 300);
|
|
89
89
|
}, [vScroll]);
|
|
90
90
|
React__default["default"].useEffect(() => {
|
|
@@ -121,12 +121,12 @@ const ChatContainerMessagesList = props => {
|
|
|
121
121
|
|
|
122
122
|
switch (key) {
|
|
123
123
|
case 'ArrowUp':
|
|
124
|
-
if (index > 0) virtualListRef.current.querySelector(
|
|
124
|
+
if (index > 0) virtualListRef.current.querySelector("[data-index=\"".concat(index - 1, "\"]")).focus();
|
|
125
125
|
break;
|
|
126
126
|
|
|
127
127
|
case 'ArrowDown':
|
|
128
128
|
if (index < messages.length - 1) {
|
|
129
|
-
virtualListRef.current.querySelector(
|
|
129
|
+
virtualListRef.current.querySelector("[data-index=\"".concat(index + 1, "\"]")).focus();
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
break;
|
|
@@ -174,7 +174,7 @@ const ChatContainerMessagesList = props => {
|
|
|
174
174
|
position: 'absolute',
|
|
175
175
|
top: 0,
|
|
176
176
|
left: 0,
|
|
177
|
-
transform:
|
|
177
|
+
transform: "translateY(".concat(start, "px)"),
|
|
178
178
|
width: '100%'
|
|
179
179
|
};
|
|
180
180
|
return /*#__PURE__*/jsxRuntime.jsx(styled.ListItem, {
|
|
@@ -193,7 +193,7 @@ const ChatContainerMessagesList = props => {
|
|
|
193
193
|
jsxRuntime.jsx(ChatBubble.ChatBubble, _objectSpread(_objectSpread({}, row), {}, {
|
|
194
194
|
helpMessage: isSending ? sendingText : row.helpMessage
|
|
195
195
|
})) : null, row.type === props$1.BUBBLE_TYPES.DELIMITER ? /*#__PURE__*/jsxRuntime.jsx(MessageDelimiter.MessageDelimiter, _objectSpread({}, row)) : null, row.type === props$1.BUBBLE_TYPES.SYSTEM ? /*#__PURE__*/jsxRuntime.jsx(SystemMessage.SystemMessage, _objectSpread({}, row)) : null)
|
|
196
|
-
},
|
|
196
|
+
}, "ds-chat-bubble-".concat(index));
|
|
197
197
|
}), [virtualItems, messages, sendingMessages, handleKey, sendingText]);
|
|
198
198
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledWrapper, {}, void 0, /*#__PURE__*/jsxRuntime.jsx(styled.StyledChatContainerContentList, {
|
|
199
199
|
"data-testid": "chat-thread-container",
|
|
@@ -203,7 +203,7 @@ const ChatContainerMessagesList = props => {
|
|
|
203
203
|
role: "list",
|
|
204
204
|
onKeyDown: handleKey,
|
|
205
205
|
children: /*#__PURE__*/_jsx__default["default"](styled.StyledChatContainerContentListScroll, {
|
|
206
|
-
height:
|
|
206
|
+
height: "".concat(totalSize, "px")
|
|
207
207
|
}, void 0, render, !isLoading && hasMoreItems ? /*#__PURE__*/_jsx__default["default"](styled.StyledLoadMoreContainer, {
|
|
208
208
|
hasMoreItems: hasMoreItems
|
|
209
209
|
}, void 0, /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
@@ -15,18 +15,8 @@ const defaultProps = {
|
|
|
15
15
|
};
|
|
16
16
|
const listProps = {
|
|
17
17
|
messages: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.object).description('The array of out-of-the-box items you want to render inside the ChatMessageList').defaultValue(defaultProps.messages),
|
|
18
|
-
actionRef: reactDesc.PropTypes.object.description(
|
|
19
|
-
|
|
20
|
-
scrollToIndex: (n: number) => void,
|
|
21
|
-
getMessagesInView: () => number[],
|
|
22
|
-
focusToIndex: (n: number) => void,
|
|
23
|
-
focusToList: () => void,
|
|
24
|
-
focusToComposer: () => void,
|
|
25
|
-
focusToSend: () => void,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
`).defaultValue(defaultProps.actionRef),
|
|
29
|
-
onScrollEnds: reactDesc.PropTypes.func.description(`Called when the scroll stops.`),
|
|
18
|
+
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),
|
|
19
|
+
onScrollEnds: reactDesc.PropTypes.func.description("Called when the scroll stops."),
|
|
30
20
|
isLoading: reactDesc.PropTypes.oneOf(['top', 'bottom', undefined]).description('Keeps the load more space while the loading is in progress'),
|
|
31
21
|
hasMoreItems: reactDesc.PropTypes.oneOf(['top', 'bottom', undefined]).description('Show Load More button at the `top` or `bottom` of the container'),
|
|
32
22
|
getMoreMessages: reactDesc.PropTypes.func.description('Called when the user clicks on load more').defaultValue(defaultProps.getMoreMessages),
|
|
@@ -16,11 +16,7 @@ const StyledWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
|
16
16
|
|
|
17
17
|
const StyledWrapperListItem = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
18
18
|
componentId: "sc-1jhprzr-1"
|
|
19
|
-
})(["min-width:100%;", ";", ";", ";"], props$1 => props$1.type === props.BUBBLE_TYPES.SENDER &&
|
|
20
|
-
`, props$1 => props$1.type === props.BUBBLE_TYPES.RECIPIENT && `padding: ${props$1.theme.space.xxs} 13% ${props$1.theme.space.xxs}
|
|
21
|
-
${props$1.theme.space.xxs}
|
|
22
|
-
`, props$1 => props$1.type === props.BUBBLE_TYPES.SYSTEM && `padding: ${props$1.theme.space.xxs} 0px
|
|
23
|
-
`);
|
|
19
|
+
})(["min-width:100%;", ";", ";", ";"], props$1 => props$1.type === props.BUBBLE_TYPES.SENDER && "padding: ".concat(props$1.theme.space.xxs, " ").concat(props$1.theme.space.xxs, " 0px 13%\n "), props$1 => props$1.type === props.BUBBLE_TYPES.RECIPIENT && "padding: ".concat(props$1.theme.space.xxs, " 13% ").concat(props$1.theme.space.xxs, "\n ").concat(props$1.theme.space.xxs, "\n "), props$1 => props$1.type === props.BUBBLE_TYPES.SYSTEM && "padding: ".concat(props$1.theme.space.xxs, " 0px\n "));
|
|
24
20
|
const StyledChatContainerContentList = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
25
21
|
componentId: "sc-1jhprzr-2"
|
|
26
22
|
})(["width:100%;height:100%;padding:", ";padding-bottom:0;overflow-y:auto;overflow-x:hidden;"], props => props.theme.space.xs);
|
|
@@ -12,14 +12,10 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
12
12
|
|
|
13
13
|
const StyledChatContainer = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
14
14
|
componentId: "sc-b6t5vk-0"
|
|
15
|
-
})(["height:100%;width:", ";background:", ";box-shadow:-1px 0 0 0 ", ";transition:width ", " 350ms;"], props => props.expanded ?
|
|
15
|
+
})(["height:100%;width:", ";background:", ";box-shadow:-1px 0 0 0 ", ";transition:width ", " 350ms;"], props => props.expanded ? "".concat(props.expandedWidth, "px") : "".concat(styled$1.MIN_WIDTH_SIDEBAR, "px"), props => props.theme.colors.neutral['050'], props => props.theme.colors.neutral[100], props => props.expanded ? 'ease-out' : 'ease-in');
|
|
16
16
|
const StyledChatContainerContent = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
17
17
|
componentId: "sc-b6t5vk-1"
|
|
18
|
-
})(["height:100%;overflow:hidden;background:", ";", ""], props => props.theme.colors.neutral['050'], props => props.floating ?
|
|
19
|
-
width: ${props.expandedWidth}px;
|
|
20
|
-
` : `
|
|
21
|
-
width: ${props.expandedWidth - styled$1.MIN_WIDTH_SIDEBAR}px;
|
|
22
|
-
`);
|
|
18
|
+
})(["height:100%;overflow:hidden;background:", ";", ""], props => props.theme.colors.neutral['050'], props => props.floating ? "\n width: ".concat(props.expandedWidth, "px;\n") : "\n width: ".concat(props.expandedWidth - styled$1.MIN_WIDTH_SIDEBAR, "px;\n"));
|
|
23
19
|
|
|
24
20
|
exports.StyledChatContainer = StyledChatContainer;
|
|
25
21
|
exports.StyledChatContainerContent = StyledChatContainerContent;
|
|
@@ -17,7 +17,7 @@ const Line = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
|
17
17
|
})(["border-top:1px solid ", ";"], props => props.theme.colors.neutral['400']);
|
|
18
18
|
const Text = /*#__PURE__*/styled__default["default"].p.withConfig({
|
|
19
19
|
componentId: "sc-upz0rt-2"
|
|
20
|
-
})(["color:", ";font-size:", ";font-weight:", ";margin:", ";"], props => props.theme.colors.neutral['600'], props => props.size === 's' ? '12px' : '14px', props => props.theme.fontWeights.semibold, props => typeof props.verticalMargin === 'number' ?
|
|
20
|
+
})(["color:", ";font-size:", ";font-weight:", ";margin:", ";"], props => props.theme.colors.neutral['600'], props => props.size === 's' ? '12px' : '14px', props => props.theme.fontWeights.semibold, props => typeof props.verticalMargin === 'number' ? "".concat(props.verticalMargin, "px 8px") : "".concat(props.verticalMargin, " 8px"));
|
|
21
21
|
|
|
22
22
|
exports.Line = Line;
|
|
23
23
|
exports.Text = Text;
|
|
@@ -35,7 +35,7 @@ const SidebarButton = _ref => {
|
|
|
35
35
|
onClick(dsId);
|
|
36
36
|
}, [onClick, dsId]);
|
|
37
37
|
return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledSidebarButton, _objectSpread(_objectSpread({
|
|
38
|
-
"data-testid":
|
|
38
|
+
"data-testid": "sidebar-button-".concat(dsId),
|
|
39
39
|
onClick: handleClick
|
|
40
40
|
}, rest), {}, {
|
|
41
41
|
children: [/*#__PURE__*/_jsx__default["default"](styled.StyledSidebarButtonIcon, {
|
|
@@ -68,7 +68,7 @@ const TileButton = props => {
|
|
|
68
68
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledTileButton, {
|
|
69
69
|
isHeader: isHeader,
|
|
70
70
|
value: dsId,
|
|
71
|
-
"data-testid":
|
|
71
|
+
"data-testid": "tile-button-".concat(dsId),
|
|
72
72
|
onClick: handleClick,
|
|
73
73
|
onFocus: onFocus,
|
|
74
74
|
onBlur: onBlur,
|
|
@@ -83,8 +83,8 @@ const TileButton = props => {
|
|
|
83
83
|
justifyContent: "center"
|
|
84
84
|
}, void 0, title ? /*#__PURE__*/_jsx__default["default"](DSTooltip__default["default"], {
|
|
85
85
|
containerProps: {
|
|
86
|
-
id:
|
|
87
|
-
'data-testid':
|
|
86
|
+
id: "ds-chat-tile-tooltip-button-".concat(dsId),
|
|
87
|
+
'data-testid': "ds-chat-tile-tooltip-button-".concat(dsId)
|
|
88
88
|
},
|
|
89
89
|
interactionType: "hover",
|
|
90
90
|
title: title,
|
|
@@ -56,7 +56,7 @@ const CloseButton = /*#__PURE__*/styled__default["default"].button.withConfig({
|
|
|
56
56
|
|
|
57
57
|
const StyledTileButton = /*#__PURE__*/styled__default["default"].button.withConfig({
|
|
58
58
|
componentId: "sc-1ebp1zs-6"
|
|
59
|
-
})(["outline:none;background:transparent;height:", "px;width:", "px;position:relative;padding:0;border:none;cursor:pointer;border-bottom:", ";&:focus,&:hover,&:active,&:disabled{background:", ";& ", "{border:2px solid ", ";margin-top:-2px;", ";}}&:focus,&:hover{& ", "{background:", ";}& ", "{color:", ";}& svg{fill:", ";}}&:active:not(:disabled){background:", ";& ", "{background:", ";}& ", "{color:", ";font-weight:600;}& svg{fill:", ";}& ", "{border:2px solid ", ";}}&:disabled{background:", ";", "{background:", ";}& ", "{background:", ";border:2px solid ", ";}", "{svg{fill:", ";}}", "{color:", ";}}", ""], BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR, props => props.isHeader ?
|
|
59
|
+
})(["outline:none;background:transparent;height:", "px;width:", "px;position:relative;padding:0;border:none;cursor:pointer;border-bottom:", ";&:focus,&:hover,&:active,&:disabled{background:", ";& ", "{border:2px solid ", ";margin-top:-2px;", ";}}&:focus,&:hover{& ", "{background:", ";}& ", "{color:", ";}& svg{fill:", ";}}&:active:not(:disabled){background:", ";& ", "{background:", ";}& ", "{color:", ";font-weight:600;}& svg{fill:", ";}& ", "{border:2px solid ", ";}}&:disabled{background:", ";", "{background:", ";}& ", "{background:", ";border:2px solid ", ";}", "{svg{fill:", ";}}", "{color:", ";}}", ""], BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR, props => props.isHeader ? "1px solid ".concat(props.theme.colors.neutral['200']) : 'none', props => props.theme.colors.neutral['080'], StyledStatusBadge, props => props.theme.colors.neutral['080'], props => {
|
|
60
60
|
switch (props.badgePosition) {
|
|
61
61
|
case 'left':
|
|
62
62
|
return 'margin-left: -2px;';
|
package/cjs/styled.js
CHANGED
|
@@ -7,7 +7,7 @@ const BUTTON_SIDEBAR_HEIGHT = 48;
|
|
|
7
7
|
const BUTTON_FLOATING = 56;
|
|
8
8
|
const BOX_SHADOW = '0 5px 8px 0 rgba(53,60,70,0.55)';
|
|
9
9
|
const BOX_SHADOW_FLOATING = '0 5px 8px 0 rgba(53,60,70,0.35)';
|
|
10
|
-
const BOX_SHADOW_INSET =
|
|
10
|
+
const BOX_SHADOW_INSET = "inset 100px 3px 4px 0 rgba(53,60,70,0.50)";
|
|
11
11
|
|
|
12
12
|
exports.BOX_SHADOW = BOX_SHADOW;
|
|
13
13
|
exports.BOX_SHADOW_FLOATING = BOX_SHADOW_FLOATING;
|
|
@@ -22,7 +22,7 @@ const ChatBubble = props => {
|
|
|
22
22
|
helpMessage
|
|
23
23
|
} = props;
|
|
24
24
|
return /*#__PURE__*/_jsx(StyledWrapper, {
|
|
25
|
-
"data-testid":
|
|
25
|
+
"data-testid": "ds-chat-bubble-".concat(dsId),
|
|
26
26
|
type: type
|
|
27
27
|
}, void 0, /*#__PURE__*/_jsx(StyledColoredBubble, {
|
|
28
28
|
type: type
|
|
@@ -33,22 +33,22 @@ const ChatBubble = props => {
|
|
|
33
33
|
className: "sr-only"
|
|
34
34
|
}, void 0, /*#__PURE__*/_jsx(StyledTitleLeftBubble, {
|
|
35
35
|
alignItems: "center",
|
|
36
|
-
"data-testid":
|
|
36
|
+
"data-testid": "chat-bubble-title-".concat(dsId)
|
|
37
37
|
}, void 0, title), /*#__PURE__*/_jsx(StyledTitleRightBubble, {
|
|
38
38
|
alignItems: "center",
|
|
39
39
|
type: type,
|
|
40
|
-
"data-testid":
|
|
40
|
+
"data-testid": "chat-bubble-time-".concat(dsId)
|
|
41
41
|
}, void 0, time)), /*#__PURE__*/_jsx(StyleBodyWrapper, {
|
|
42
|
-
"data-testid":
|
|
42
|
+
"data-testid": "chat-bubble-body-".concat(dsId)
|
|
43
43
|
}, void 0, body), /*#__PURE__*/_jsx(ChatBubbleArrow, {
|
|
44
44
|
type: type
|
|
45
45
|
})), errorMessage ? /*#__PURE__*/_jsx(StyleErrorMessage, {
|
|
46
|
-
"data-testid":
|
|
46
|
+
"data-testid": "chat-bubble-error-message-".concat(dsId),
|
|
47
47
|
p: "xxs",
|
|
48
48
|
gutter: "xxs",
|
|
49
49
|
cols: [1, 'auto']
|
|
50
50
|
}, void 0, /*#__PURE__*/_jsx("span", {}, void 0, errorMessage), _Warning || (_Warning = /*#__PURE__*/_jsx(Warning, {}))) : null, helpMessage ? /*#__PURE__*/_jsx(StyleHelpMessage, {
|
|
51
|
-
"data-testid":
|
|
51
|
+
"data-testid": "chat-bubble-help-message-".concat(dsId),
|
|
52
52
|
p: "xxs",
|
|
53
53
|
gutter: "xxs",
|
|
54
54
|
cols: [1, 'auto']
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { useValidatePropTypes } from '@elliemae/ds-props-helpers';
|
|
2
2
|
|
|
3
3
|
const throwError = message => {
|
|
4
|
-
throw new Error(
|
|
5
|
-
`);
|
|
4
|
+
throw new Error("Bubble:: ".concat(message, "\n "));
|
|
6
5
|
};
|
|
7
6
|
|
|
8
7
|
const useValidateProps = (props, schema) => {
|
|
9
8
|
useValidatePropTypes(props, schema);
|
|
10
9
|
|
|
11
10
|
if (typeof props.title === 'undefined') {
|
|
12
|
-
throwError(
|
|
11
|
+
throwError("Please provide a title property to use this component.");
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
if (typeof props.time === 'undefined') {
|
|
16
|
-
throwError(
|
|
15
|
+
throwError("Please provide a time property to use this component.");
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
if (typeof props.body === 'undefined') {
|
|
20
|
-
throwError(
|
|
19
|
+
throwError("Please provide a body property to use this component.");
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
if (typeof props.type === 'undefined') {
|
|
24
|
-
throwError(
|
|
23
|
+
throwError("Please provide a type property to use this component.");
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
26
|
|
|
@@ -32,35 +32,6 @@ const StyledBubbleArrow = /*#__PURE__*/styled.div.withConfig({
|
|
|
32
32
|
})(["display:block;content:'';position:absolute;bottom:10px;height:15px;"]);
|
|
33
33
|
const StyledColoredBubble = /*#__PURE__*/styled.div.withConfig({
|
|
34
34
|
componentId: "sc-fe8e9o-8"
|
|
35
|
-
})(["min-width:224px;border-radius:10px;position:relative;", ""], props => props.type === BUBBLE_TYPES.SENDER ?
|
|
36
|
-
border: 1px solid ${props.theme.colors.brand['700']};
|
|
37
|
-
background: ${props.theme.colors.brand[600]};
|
|
38
|
-
color: ${props.theme.colors.neutral['000']};
|
|
39
|
-
${StyledBubbleArrow}{
|
|
40
|
-
right: -9px;
|
|
41
|
-
bottom: 6px;
|
|
42
|
-
svg{
|
|
43
|
-
fill: ${props.theme.colors.brand[600]};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
a {
|
|
48
|
-
color: #FFF;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
` : `
|
|
52
|
-
box-shadow: 0 1px 3px 0 rgba(53,60,70,0.80);
|
|
53
|
-
background: ${props.theme.colors.neutral['000']};
|
|
54
|
-
color: ${props.theme.colors.neutral[700]};
|
|
55
|
-
|
|
56
|
-
${StyledBubbleArrow}{
|
|
57
|
-
left: -11px;
|
|
58
|
-
bottom: 6px;
|
|
59
|
-
svg{
|
|
60
|
-
fill: ${props.theme.colors.neutral['000']};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
`);
|
|
35
|
+
})(["min-width:224px;border-radius:10px;position:relative;", ""], props => props.type === BUBBLE_TYPES.SENDER ? "\n border: 1px solid ".concat(props.theme.colors.brand['700'], ";\n background: ").concat(props.theme.colors.brand[600], ";\n color: ").concat(props.theme.colors.neutral['000'], ";\n ").concat(StyledBubbleArrow, "{ \n right: -9px;\n bottom: 6px;\n svg{\n fill: ").concat(props.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.theme.colors.neutral['000'], ";\n color: ").concat(props.theme.colors.neutral[700], ";\n\n ").concat(StyledBubbleArrow, "{ \n left: -11px;\n bottom: 6px;\n svg{\n fill: ").concat(props.theme.colors.neutral['000'], ";\n }\n }\n\n "));
|
|
65
36
|
|
|
66
37
|
export { StyleBodyWrapper, StyleErrorMessage, StyleHelpMessage, StyledBubbleArrow, StyledColoredBubble, StyledTitleBubble, StyledTitleLeftBubble, StyledTitleRightBubble, StyledWrapper };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PropTypes } from 'react-desc';
|
|
2
2
|
|
|
3
3
|
const propTypes = {
|
|
4
|
-
title: PropTypes.string.isRequired.description(
|
|
5
|
-
content: PropTypes.string.description(
|
|
4
|
+
title: PropTypes.string.isRequired.description("Card's title"),
|
|
5
|
+
content: PropTypes.string.description("Card's content"),
|
|
6
6
|
time: PropTypes.string.description('Time'),
|
|
7
7
|
rightAddon: PropTypes.element.description('Right addon, badge or icon')
|
|
8
8
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
3
|
import 'core-js/modules/web.url.to-json.js';
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { Grid } from '@elliemae/ds-grid';
|
|
6
7
|
import { describe } from 'react-desc';
|
|
@@ -70,7 +71,7 @@ const ChatComposer = props => {
|
|
|
70
71
|
const hasError = React.useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);
|
|
71
72
|
return /*#__PURE__*/_jsx(StyledChatContainerContentComposer, {
|
|
72
73
|
rows: ['auto', '15px'],
|
|
73
|
-
maxHeight:
|
|
74
|
+
maxHeight: "".concat(maxHeight, "px"),
|
|
74
75
|
"data-testid": dataTestid
|
|
75
76
|
}, void 0, /*#__PURE__*/_jsx(Grid, {
|
|
76
77
|
cols: ['1fr', '24px'],
|
|
@@ -128,7 +129,7 @@ const ChatComposer = props => {
|
|
|
128
129
|
children: [/*#__PURE__*/_jsx(StyledCounterErrorA11y, {
|
|
129
130
|
role: "alert"
|
|
130
131
|
}, void 0, "You have exceeded the character limit by ", inputLength - inputMaxLength), "Please limit to less than ", inputMaxLength, " characters.", ' ']
|
|
131
|
-
}) : '', inputMaxLength ?
|
|
132
|
+
}) : '', inputMaxLength ? "".concat(inputLength, " / ").concat(inputMaxLength) : ''), _Grid || (_Grid = /*#__PURE__*/_jsx(Grid, {}))));
|
|
132
133
|
};
|
|
133
134
|
|
|
134
135
|
ChatComposer.defaultProps = defaultComposerPros;
|
|
@@ -27,17 +27,7 @@ const composerProps = {
|
|
|
27
27
|
inputMaxLength: PropTypes.number.description('Max length of the composer. `undefined` for no limit').defaultValue(defaultComposerPros.inputMaxLength),
|
|
28
28
|
buttonDisabled: PropTypes.bool.description('Control the disabled for the send button').defaultValue(defaultComposerPros.buttonDisabled),
|
|
29
29
|
dataTestid: PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),
|
|
30
|
-
actionRef: PropTypes.object.description(
|
|
31
|
-
{
|
|
32
|
-
scrollToIndex: (n: number) => void,
|
|
33
|
-
getMessagesInView: () => number[],
|
|
34
|
-
focusToIndex: (n: number) => void,
|
|
35
|
-
focusToList: () => void,
|
|
36
|
-
focusToComposer: () => void,
|
|
37
|
-
focusToSend: () => void,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
`).defaultValue(defaultComposerPros.actionRef)
|
|
30
|
+
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(defaultComposerPros.actionRef)
|
|
41
31
|
};
|
|
42
32
|
|
|
43
33
|
export { composerProps, defaultComposerPros };
|
|
@@ -8,13 +8,13 @@ const StyledChatContainerContentComposer = /*#__PURE__*/styled(Grid).withConfig(
|
|
|
8
8
|
})(["width:100%;min-height:56px;background:", ";padding:", ";padding-bottom:3px;padding-top:6px;padding-left:", ";max-height:", ";border-top:1px solid #cbcfd7;"], props => props.theme.colors.neutral['050'], props => props.theme.space.xxs, props => props.theme.space.xs, props => props.maxHeight);
|
|
9
9
|
const StyledComposerInput = /*#__PURE__*/styled.textarea.withConfig({
|
|
10
10
|
componentId: "sc-1ahwpce-1"
|
|
11
|
-
})(["padding:", ";resize:none;min-height:32px;border-radius:2px;border:solid 1px #cbcfd7;color:#25292f;height:", ";min-width:244px;overflow-y:auto;font-size:13px;font-weight:400;line-height:1;transition:height 0.3s;&:focus{outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px #8cc2ed;border-radius:2px;}"], props => props.theme.space.xxs, props => typeof props.height === 'number' ?
|
|
11
|
+
})(["padding:", ";resize:none;min-height:32px;border-radius:2px;border:solid 1px #cbcfd7;color:#25292f;height:", ";min-width:244px;overflow-y:auto;font-size:13px;font-weight:400;line-height:1;transition:height 0.3s;&:focus{outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px #8cc2ed;border-radius:2px;}"], props => props.theme.space.xxs, props => typeof props.height === 'number' ? "".concat(props.height, "px") : props.height, props => props.theme.colors.brand[600]);
|
|
12
12
|
const StyledComposerButton = /*#__PURE__*/styled(DSButton).withConfig({
|
|
13
13
|
componentId: "sc-1ahwpce-2"
|
|
14
14
|
})(["&:disabled{background:none;svg{fill:#5d6775;}}svg{fill:", ";}&:focus{background:", ";}"], props => props.theme.colors.brand[600], props => props.theme.colors.brand[200]);
|
|
15
15
|
const StyledCounterArea = /*#__PURE__*/styled(Grid).withConfig({
|
|
16
16
|
componentId: "sc-1ahwpce-3"
|
|
17
|
-
})(["text-align:right;font-size:11px;height:15px;align-items:center;font-style:italic;", " position:relative;"], props => props.hasError ?
|
|
17
|
+
})(["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], ";") : '');
|
|
18
18
|
const StyledCounterErrorA11y = /*#__PURE__*/styled.span.withConfig({
|
|
19
19
|
componentId: "sc-1ahwpce-4"
|
|
20
20
|
})(["width:1px;height:1px;position:absolute;clip:rect(1px,1px,1px,1px);"]);
|
|
@@ -34,17 +34,7 @@ const containerProps = {
|
|
|
34
34
|
bannerProps: PropTypes.object.description('Banner configuration').defaultValue(defaultProps.bannerProps),
|
|
35
35
|
sendingMessages: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.number)]).description('Array of ids of sending messages').defaultValue(defaultProps.sendingMessages),
|
|
36
36
|
sendingText: PropTypes.string.description('Label description for messages in sending status').defaultValue(defaultProps.sendingText),
|
|
37
|
-
actionRef: PropTypes.object.description(
|
|
38
|
-
{
|
|
39
|
-
scrollToIndex: (n: number) => void,
|
|
40
|
-
getMessagesInView: () => number[],
|
|
41
|
-
focusToIndex: (n: number) => void,
|
|
42
|
-
focusToList: () => void,
|
|
43
|
-
focusToComposer: () => void,
|
|
44
|
-
focusToSend: () => void,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
`).defaultValue(defaultProps.actionRef)
|
|
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)
|
|
48
38
|
};
|
|
49
39
|
|
|
50
40
|
export { containerProps, defaultProps };
|
|
@@ -73,7 +73,7 @@ const ChatContainerMessagesList = props => {
|
|
|
73
73
|
align: 'center'
|
|
74
74
|
});
|
|
75
75
|
setTimeout(() => {
|
|
76
|
-
virtualListRef.current.querySelector(
|
|
76
|
+
virtualListRef.current.querySelector("[data-index=\"".concat(index, "\"]")).focus();
|
|
77
77
|
}, 300);
|
|
78
78
|
}, [vScroll]);
|
|
79
79
|
React.useEffect(() => {
|
|
@@ -110,12 +110,12 @@ const ChatContainerMessagesList = props => {
|
|
|
110
110
|
|
|
111
111
|
switch (key) {
|
|
112
112
|
case 'ArrowUp':
|
|
113
|
-
if (index > 0) virtualListRef.current.querySelector(
|
|
113
|
+
if (index > 0) virtualListRef.current.querySelector("[data-index=\"".concat(index - 1, "\"]")).focus();
|
|
114
114
|
break;
|
|
115
115
|
|
|
116
116
|
case 'ArrowDown':
|
|
117
117
|
if (index < messages.length - 1) {
|
|
118
|
-
virtualListRef.current.querySelector(
|
|
118
|
+
virtualListRef.current.querySelector("[data-index=\"".concat(index + 1, "\"]")).focus();
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
break;
|
|
@@ -163,7 +163,7 @@ const ChatContainerMessagesList = props => {
|
|
|
163
163
|
position: 'absolute',
|
|
164
164
|
top: 0,
|
|
165
165
|
left: 0,
|
|
166
|
-
transform:
|
|
166
|
+
transform: "translateY(".concat(start, "px)"),
|
|
167
167
|
width: '100%'
|
|
168
168
|
};
|
|
169
169
|
return /*#__PURE__*/jsx(ListItem, {
|
|
@@ -182,7 +182,7 @@ const ChatContainerMessagesList = props => {
|
|
|
182
182
|
jsx(ChatBubble, _objectSpread(_objectSpread({}, row), {}, {
|
|
183
183
|
helpMessage: isSending ? sendingText : row.helpMessage
|
|
184
184
|
})) : null, row.type === BUBBLE_TYPES.DELIMITER ? /*#__PURE__*/jsx(MessageDelimiter, _objectSpread({}, row)) : null, row.type === BUBBLE_TYPES.SYSTEM ? /*#__PURE__*/jsx(SystemMessage, _objectSpread({}, row)) : null)
|
|
185
|
-
},
|
|
185
|
+
}, "ds-chat-bubble-".concat(index));
|
|
186
186
|
}), [virtualItems, messages, sendingMessages, handleKey, sendingText]);
|
|
187
187
|
return /*#__PURE__*/_jsx(StyledWrapper, {}, void 0, /*#__PURE__*/jsx(StyledChatContainerContentList, {
|
|
188
188
|
"data-testid": "chat-thread-container",
|
|
@@ -192,7 +192,7 @@ const ChatContainerMessagesList = props => {
|
|
|
192
192
|
role: "list",
|
|
193
193
|
onKeyDown: handleKey,
|
|
194
194
|
children: /*#__PURE__*/_jsx(StyledChatContainerContentListScroll, {
|
|
195
|
-
height:
|
|
195
|
+
height: "".concat(totalSize, "px")
|
|
196
196
|
}, void 0, render, !isLoading && hasMoreItems ? /*#__PURE__*/_jsx(StyledLoadMoreContainer, {
|
|
197
197
|
hasMoreItems: hasMoreItems
|
|
198
198
|
}, void 0, /*#__PURE__*/_jsx(DSButton, {
|
|
@@ -11,18 +11,8 @@ const defaultProps = {
|
|
|
11
11
|
};
|
|
12
12
|
const listProps = {
|
|
13
13
|
messages: PropTypes.arrayOf(PropTypes.object).description('The array of out-of-the-box items you want to render inside the ChatMessageList').defaultValue(defaultProps.messages),
|
|
14
|
-
actionRef: PropTypes.object.description(
|
|
15
|
-
|
|
16
|
-
scrollToIndex: (n: number) => void,
|
|
17
|
-
getMessagesInView: () => number[],
|
|
18
|
-
focusToIndex: (n: number) => void,
|
|
19
|
-
focusToList: () => void,
|
|
20
|
-
focusToComposer: () => void,
|
|
21
|
-
focusToSend: () => void,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
`).defaultValue(defaultProps.actionRef),
|
|
25
|
-
onScrollEnds: PropTypes.func.description(`Called when the scroll stops.`),
|
|
14
|
+
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),
|
|
15
|
+
onScrollEnds: PropTypes.func.description("Called when the scroll stops."),
|
|
26
16
|
isLoading: PropTypes.oneOf(['top', 'bottom', undefined]).description('Keeps the load more space while the loading is in progress'),
|
|
27
17
|
hasMoreItems: PropTypes.oneOf(['top', 'bottom', undefined]).description('Show Load More button at the `top` or `bottom` of the container'),
|
|
28
18
|
getMoreMessages: PropTypes.func.description('Called when the user clicks on load more').defaultValue(defaultProps.getMoreMessages),
|
|
@@ -8,11 +8,7 @@ const StyledWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
8
8
|
|
|
9
9
|
const StyledWrapperListItem = /*#__PURE__*/styled.div.withConfig({
|
|
10
10
|
componentId: "sc-1jhprzr-1"
|
|
11
|
-
})(["min-width:100%;", ";", ";", ";"], props => props.type === BUBBLE_TYPES.SENDER &&
|
|
12
|
-
`, props => props.type === BUBBLE_TYPES.RECIPIENT && `padding: ${props.theme.space.xxs} 13% ${props.theme.space.xxs}
|
|
13
|
-
${props.theme.space.xxs}
|
|
14
|
-
`, props => props.type === BUBBLE_TYPES.SYSTEM && `padding: ${props.theme.space.xxs} 0px
|
|
15
|
-
`);
|
|
11
|
+
})(["min-width:100%;", ";", ";", ";"], props => props.type === BUBBLE_TYPES.SENDER && "padding: ".concat(props.theme.space.xxs, " ").concat(props.theme.space.xxs, " 0px 13%\n "), props => props.type === BUBBLE_TYPES.RECIPIENT && "padding: ".concat(props.theme.space.xxs, " 13% ").concat(props.theme.space.xxs, "\n ").concat(props.theme.space.xxs, "\n "), props => props.type === BUBBLE_TYPES.SYSTEM && "padding: ".concat(props.theme.space.xxs, " 0px\n "));
|
|
16
12
|
const StyledChatContainerContentList = /*#__PURE__*/styled.div.withConfig({
|
|
17
13
|
componentId: "sc-1jhprzr-2"
|
|
18
14
|
})(["width:100%;height:100%;padding:", ";padding-bottom:0;overflow-y:auto;overflow-x:hidden;"], props => props.theme.space.xs);
|
|
@@ -4,13 +4,9 @@ import { MIN_WIDTH_SIDEBAR } from '../../styled.js';
|
|
|
4
4
|
|
|
5
5
|
const StyledChatContainer = /*#__PURE__*/styled(Grid).withConfig({
|
|
6
6
|
componentId: "sc-b6t5vk-0"
|
|
7
|
-
})(["height:100%;width:", ";background:", ";box-shadow:-1px 0 0 0 ", ";transition:width ", " 350ms;"], props => props.expanded ?
|
|
7
|
+
})(["height:100%;width:", ";background:", ";box-shadow:-1px 0 0 0 ", ";transition:width ", " 350ms;"], props => props.expanded ? "".concat(props.expandedWidth, "px") : "".concat(MIN_WIDTH_SIDEBAR, "px"), props => props.theme.colors.neutral['050'], props => props.theme.colors.neutral[100], props => props.expanded ? 'ease-out' : 'ease-in');
|
|
8
8
|
const StyledChatContainerContent = /*#__PURE__*/styled(Grid).withConfig({
|
|
9
9
|
componentId: "sc-b6t5vk-1"
|
|
10
|
-
})(["height:100%;overflow:hidden;background:", ";", ""], props => props.theme.colors.neutral['050'], props => props.floating ?
|
|
11
|
-
width: ${props.expandedWidth}px;
|
|
12
|
-
` : `
|
|
13
|
-
width: ${props.expandedWidth - MIN_WIDTH_SIDEBAR}px;
|
|
14
|
-
`);
|
|
10
|
+
})(["height:100%;overflow:hidden;background:", ";", ""], props => props.theme.colors.neutral['050'], props => props.floating ? "\n width: ".concat(props.expandedWidth, "px;\n") : "\n width: ".concat(props.expandedWidth - MIN_WIDTH_SIDEBAR, "px;\n"));
|
|
15
11
|
|
|
16
12
|
export { StyledChatContainer, StyledChatContainerContent };
|
|
@@ -9,6 +9,6 @@ const Line = /*#__PURE__*/styled.span.withConfig({
|
|
|
9
9
|
})(["border-top:1px solid ", ";"], props => props.theme.colors.neutral['400']);
|
|
10
10
|
const Text = /*#__PURE__*/styled.p.withConfig({
|
|
11
11
|
componentId: "sc-upz0rt-2"
|
|
12
|
-
})(["color:", ";font-size:", ";font-weight:", ";margin:", ";"], props => props.theme.colors.neutral['600'], props => props.size === 's' ? '12px' : '14px', props => props.theme.fontWeights.semibold, props => typeof props.verticalMargin === 'number' ?
|
|
12
|
+
})(["color:", ";font-size:", ";font-weight:", ";margin:", ";"], props => props.theme.colors.neutral['600'], props => props.size === 's' ? '12px' : '14px', props => props.theme.fontWeights.semibold, props => typeof props.verticalMargin === 'number' ? "".concat(props.verticalMargin, "px 8px") : "".concat(props.verticalMargin, " 8px"));
|
|
13
13
|
|
|
14
14
|
export { Line, Text, Wrapper };
|
|
@@ -24,7 +24,7 @@ const SidebarButton = _ref => {
|
|
|
24
24
|
onClick(dsId);
|
|
25
25
|
}, [onClick, dsId]);
|
|
26
26
|
return /*#__PURE__*/jsxs(StyledSidebarButton, _objectSpread(_objectSpread({
|
|
27
|
-
"data-testid":
|
|
27
|
+
"data-testid": "sidebar-button-".concat(dsId),
|
|
28
28
|
onClick: handleClick
|
|
29
29
|
}, rest), {}, {
|
|
30
30
|
children: [/*#__PURE__*/_jsx(StyledSidebarButtonIcon, {
|
|
@@ -57,7 +57,7 @@ const TileButton = props => {
|
|
|
57
57
|
return /*#__PURE__*/_jsx(StyledTileButton, {
|
|
58
58
|
isHeader: isHeader,
|
|
59
59
|
value: dsId,
|
|
60
|
-
"data-testid":
|
|
60
|
+
"data-testid": "tile-button-".concat(dsId),
|
|
61
61
|
onClick: handleClick,
|
|
62
62
|
onFocus: onFocus,
|
|
63
63
|
onBlur: onBlur,
|
|
@@ -72,8 +72,8 @@ const TileButton = props => {
|
|
|
72
72
|
justifyContent: "center"
|
|
73
73
|
}, void 0, title ? /*#__PURE__*/_jsx(DSTooltip, {
|
|
74
74
|
containerProps: {
|
|
75
|
-
id:
|
|
76
|
-
'data-testid':
|
|
75
|
+
id: "ds-chat-tile-tooltip-button-".concat(dsId),
|
|
76
|
+
'data-testid': "ds-chat-tile-tooltip-button-".concat(dsId)
|
|
77
77
|
},
|
|
78
78
|
interactionType: "hover",
|
|
79
79
|
title: title,
|
|
@@ -48,7 +48,7 @@ const CloseButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
48
48
|
|
|
49
49
|
const StyledTileButton = /*#__PURE__*/styled.button.withConfig({
|
|
50
50
|
componentId: "sc-1ebp1zs-6"
|
|
51
|
-
})(["outline:none;background:transparent;height:", "px;width:", "px;position:relative;padding:0;border:none;cursor:pointer;border-bottom:", ";&:focus,&:hover,&:active,&:disabled{background:", ";& ", "{border:2px solid ", ";margin-top:-2px;", ";}}&:focus,&:hover{& ", "{background:", ";}& ", "{color:", ";}& svg{fill:", ";}}&:active:not(:disabled){background:", ";& ", "{background:", ";}& ", "{color:", ";font-weight:600;}& svg{fill:", ";}& ", "{border:2px solid ", ";}}&:disabled{background:", ";", "{background:", ";}& ", "{background:", ";border:2px solid ", ";}", "{svg{fill:", ";}}", "{color:", ";}}", ""], BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR, props => props.isHeader ?
|
|
51
|
+
})(["outline:none;background:transparent;height:", "px;width:", "px;position:relative;padding:0;border:none;cursor:pointer;border-bottom:", ";&:focus,&:hover,&:active,&:disabled{background:", ";& ", "{border:2px solid ", ";margin-top:-2px;", ";}}&:focus,&:hover{& ", "{background:", ";}& ", "{color:", ";}& svg{fill:", ";}}&:active:not(:disabled){background:", ";& ", "{background:", ";}& ", "{color:", ";font-weight:600;}& svg{fill:", ";}& ", "{border:2px solid ", ";}}&:disabled{background:", ";", "{background:", ";}& ", "{background:", ";border:2px solid ", ";}", "{svg{fill:", ";}}", "{color:", ";}}", ""], BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR, props => props.isHeader ? "1px solid ".concat(props.theme.colors.neutral['200']) : 'none', props => props.theme.colors.neutral['080'], StyledStatusBadge, props => props.theme.colors.neutral['080'], props => {
|
|
52
52
|
switch (props.badgePosition) {
|
|
53
53
|
case 'left':
|
|
54
54
|
return 'margin-left: -2px;';
|
package/esm/styled.js
CHANGED
|
@@ -3,6 +3,6 @@ const BUTTON_SIDEBAR_HEIGHT = 48;
|
|
|
3
3
|
const BUTTON_FLOATING = 56;
|
|
4
4
|
const BOX_SHADOW = '0 5px 8px 0 rgba(53,60,70,0.55)';
|
|
5
5
|
const BOX_SHADOW_FLOATING = '0 5px 8px 0 rgba(53,60,70,0.35)';
|
|
6
|
-
const BOX_SHADOW_INSET =
|
|
6
|
+
const BOX_SHADOW_INSET = "inset 100px 3px 4px 0 rgba(53,60,70,0.50)";
|
|
7
7
|
|
|
8
8
|
export { BOX_SHADOW, BOX_SHADOW_FLOATING, BOX_SHADOW_INSET, BUTTON_FLOATING, BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-chat",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Chat",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -293,9 +293,9 @@
|
|
|
293
293
|
"generateSubmodules": true
|
|
294
294
|
},
|
|
295
295
|
"dependencies": {
|
|
296
|
-
"@elliemae/ds-basic": "2.0.0-next.
|
|
297
|
-
"@elliemae/ds-icons": "2.0.0-next.
|
|
298
|
-
"@elliemae/ds-system": "2.0.0-next.
|
|
296
|
+
"@elliemae/ds-basic": "2.0.0-next.6",
|
|
297
|
+
"@elliemae/ds-icons": "2.0.0-next.6",
|
|
298
|
+
"@elliemae/ds-system": "2.0.0-next.6",
|
|
299
299
|
"prop-types": "~15.7.2",
|
|
300
300
|
"react-virtual": "~2.3.2"
|
|
301
301
|
},
|
package/cjs/package.json
DELETED
package/esm/package.json
DELETED