@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
|
@@ -19,10 +19,10 @@ const StyledTitleRightBubble = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
19
19
|
})(["font-size:13px;font-weight:400;color:", ";"], props => props.type === BUBBLE_TYPES.SENDER ? '#FFF' : '#657489');
|
|
20
20
|
const StyleBodyWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
21
21
|
componentId: "sc-fe8e9o-4"
|
|
22
|
-
})(["font-size:13px;font-weight:400;line-height:15px;min-height:
|
|
22
|
+
})(["font-size:13px;font-weight:400;line-height:15px;min-height:18px;padding:0px 10px 8px 10px;"]);
|
|
23
23
|
const StyleErrorMessage = /*#__PURE__*/styled.div.withConfig({
|
|
24
24
|
componentId: "sc-fe8e9o-5"
|
|
25
|
-
})(["font-size:12px;font-weight:400;padding-top:", ";
|
|
25
|
+
})(["font-size:12px;font-weight:400;padding-top:", ";color:", ";align-items:flex-end;justify-content:center;text-align:right;line-height:15px;svg{fill:", ";}a{font-size:12px;color:", ";}.em-ds-icon{margin-left:8px;}"], props => props.theme.space.xxxs, props => props.theme.colors.danger[900], props => props.theme.colors.danger[900], props => props.theme.colors.danger[900]);
|
|
26
26
|
const StyleHelpMessage = /*#__PURE__*/styled(StyleErrorMessage).withConfig({
|
|
27
27
|
componentId: "sc-fe8e9o-6"
|
|
28
28
|
})(["font-size:12px;line-height:15px;color:", ";svg{fill:", ";}a{font-size:12px;color:", ";}"], props => props.theme.colors.neutral[500], props => props.theme.colors.danger[500], props => props.theme.colors.danger[500]); // bubble sender/ recipient
|
|
@@ -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,29 +1,35 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.url.to-json.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import { describe } from 'react-desc';
|
|
4
|
-
import { propTypes } from './props.js';
|
|
5
5
|
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
6
|
+
import { propTypes } from './props.js';
|
|
7
|
+
import { useValidateProps } from './config/useValidateProps.js';
|
|
6
8
|
import { Wrapper, MainContent, Title, Content, Time, RightAddon } from './styled.js';
|
|
7
9
|
|
|
8
|
-
const ChatCard =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
const ChatCard = props => {
|
|
11
|
+
useValidateProps(props, ChatCardWithSchema.toJSON());
|
|
12
|
+
const {
|
|
13
|
+
title,
|
|
14
|
+
content,
|
|
15
|
+
time,
|
|
16
|
+
rightAddon
|
|
17
|
+
} = props;
|
|
18
|
+
return /*#__PURE__*/_jsx(Wrapper, {
|
|
19
|
+
cols: ['1fr', 'auto'],
|
|
20
|
+
"data-testid": "chat-card-wrapper"
|
|
21
|
+
}, void 0, /*#__PURE__*/_jsx(MainContent, {}, void 0, /*#__PURE__*/_jsx(Title, {
|
|
22
|
+
"data-testid": "chat-card-title"
|
|
23
|
+
}, void 0, title), /*#__PURE__*/_jsx(Content, {
|
|
24
|
+
"data-testid": "chat-card-content"
|
|
25
|
+
}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
26
|
+
value: content
|
|
27
|
+
})), time && /*#__PURE__*/_jsx(Time, {
|
|
28
|
+
"data-testid": "chat-card-time"
|
|
29
|
+
}, void 0, time)), rightAddon && /*#__PURE__*/_jsx(RightAddon, {
|
|
30
|
+
"data-testid": "chat-card-right-addon"
|
|
31
|
+
}, void 0, rightAddon));
|
|
32
|
+
};
|
|
27
33
|
|
|
28
34
|
const ChatCardWithSchema = describe(ChatCard);
|
|
29
35
|
ChatCardWithSchema.propTypes = propTypes;
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
-
rightAddon: PropTypes.
|
|
7
|
+
rightAddon: PropTypes.element.description('Right addon, badge or icon')
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { propTypes };
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
+
import 'core-js/modules/web.url.to-json.js';
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
10
|
import React from 'react';
|
|
4
11
|
import { Grid } from '@elliemae/ds-grid';
|
|
5
12
|
import { describe } from 'react-desc';
|
|
6
|
-
import PaperAirplane from '@elliemae/ds-icons
|
|
13
|
+
import { PaperAirplane } from '@elliemae/ds-icons';
|
|
7
14
|
import { StyledChatContainerContentComposer, StyledComposerInput, StyledComposerButton, StyledCounterArea, StyledCounterErrorA11y } from './styled.js';
|
|
15
|
+
import { useValidateProps } from './config/useValidateProps.js';
|
|
8
16
|
import { composerProps, defaultComposerPros } from './props.js';
|
|
9
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
18
|
|
|
@@ -17,6 +25,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
17
25
|
const ChatComposer = props => {
|
|
18
26
|
var _input$current;
|
|
19
27
|
|
|
28
|
+
useValidateProps(props, ChatComposerWithSchema.toJSON());
|
|
20
29
|
const {
|
|
21
30
|
inputValue,
|
|
22
31
|
onChange,
|
|
@@ -24,14 +33,18 @@ const ChatComposer = props => {
|
|
|
24
33
|
onSend,
|
|
25
34
|
onFocus,
|
|
26
35
|
onBlur,
|
|
36
|
+
onKeyDown,
|
|
27
37
|
maxHeight = 300,
|
|
28
38
|
placeholder,
|
|
29
39
|
inputMaxLength,
|
|
40
|
+
maxLengthMessage,
|
|
30
41
|
buttonDisabled,
|
|
31
|
-
dataTestid
|
|
42
|
+
dataTestid,
|
|
43
|
+
actionRef
|
|
32
44
|
} = props;
|
|
33
45
|
const input = React.useRef();
|
|
34
46
|
const inputSize = React.useRef();
|
|
47
|
+
const inputSend = React.useRef();
|
|
35
48
|
const [height, setHeight] = React.useState(32);
|
|
36
49
|
const internalMaxHeight = React.useMemo(() => maxHeight - 24, [maxHeight]);
|
|
37
50
|
const [showScroll, setShowScroll] = React.useState(true);
|
|
@@ -42,7 +55,18 @@ const ChatComposer = props => {
|
|
|
42
55
|
onResize(newHeight);
|
|
43
56
|
setHeight(newHeight);
|
|
44
57
|
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);
|
|
45
|
-
}, [inputValue, internalMaxHeight]);
|
|
58
|
+
}, [inputValue, internalMaxHeight, onResize]);
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
if (actionRef && actionRef.current) {
|
|
61
|
+
actionRef.current.focusToComposer = () => {
|
|
62
|
+
input.current.focus();
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
actionRef.current.focusToSend = () => {
|
|
66
|
+
inputSend.current.focus();
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}, [actionRef]);
|
|
46
70
|
const handleChange = React.useCallback(e => {
|
|
47
71
|
onChange(e.target.value);
|
|
48
72
|
}, [onChange]);
|
|
@@ -54,7 +78,7 @@ const ChatComposer = props => {
|
|
|
54
78
|
const hasError = React.useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);
|
|
55
79
|
return /*#__PURE__*/_jsx(StyledChatContainerContentComposer, {
|
|
56
80
|
rows: ['auto', '15px'],
|
|
57
|
-
maxHeight:
|
|
81
|
+
maxHeight: "".concat(maxHeight, "px"),
|
|
58
82
|
"data-testid": dataTestid
|
|
59
83
|
}, void 0, /*#__PURE__*/_jsx(Grid, {
|
|
60
84
|
cols: ['1fr', '24px'],
|
|
@@ -68,6 +92,7 @@ const ChatComposer = props => {
|
|
|
68
92
|
value: inputValue,
|
|
69
93
|
onFocus: onFocus,
|
|
70
94
|
onBlur: onBlur,
|
|
95
|
+
onKeyDown: onKeyDown,
|
|
71
96
|
placeholder: placeholder,
|
|
72
97
|
"aria-label": "Message to send",
|
|
73
98
|
"data-testid": "chat-composer-textarea"
|
|
@@ -84,7 +109,8 @@ const ChatComposer = props => {
|
|
|
84
109
|
size: "s",
|
|
85
110
|
disabled: !inputValue || buttonDisabled || hasError,
|
|
86
111
|
"data-testid": "chat-composer-send-button",
|
|
87
|
-
"aria-label": "Send"
|
|
112
|
+
"aria-label": "Send",
|
|
113
|
+
innerRef: inputSend
|
|
88
114
|
}))), /*#__PURE__*/jsx(StyledComposerInput, {
|
|
89
115
|
ref: inputSize,
|
|
90
116
|
style: {
|
|
@@ -110,8 +136,8 @@ const ChatComposer = props => {
|
|
|
110
136
|
}, void 0, inputMaxLength && hasError ? /*#__PURE__*/jsxs(Fragment, {
|
|
111
137
|
children: [/*#__PURE__*/_jsx(StyledCounterErrorA11y, {
|
|
112
138
|
role: "alert"
|
|
113
|
-
}, void 0, "You have exceeded the character limit by "
|
|
114
|
-
}) : '', inputMaxLength ?
|
|
139
|
+
}, void 0, maxLengthMessage || "You have exceeded the character limit by ".concat(inputLength - inputMaxLength)), maxLengthMessage || "Please limit to less than ".concat(inputMaxLength, " characters. ")]
|
|
140
|
+
}) : '', inputMaxLength ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), _Grid || (_Grid = /*#__PURE__*/_jsx(Grid, {}))));
|
|
115
141
|
};
|
|
116
142
|
|
|
117
143
|
ChatComposer.defaultProps = defaultComposerPros;
|
|
@@ -9,23 +9,29 @@ const defaultComposerPros = {
|
|
|
9
9
|
onSend: noop,
|
|
10
10
|
onFocus: noop,
|
|
11
11
|
onBlur: noop,
|
|
12
|
+
onKeyDown: noop,
|
|
12
13
|
maxHeight: 0,
|
|
13
14
|
inputMaxLength: undefined,
|
|
15
|
+
maxLengthMessage: undefined,
|
|
14
16
|
buttonDisabled: false,
|
|
15
|
-
dataTestid: 'ds-chat-composer'
|
|
17
|
+
dataTestid: 'ds-chat-composer',
|
|
18
|
+
actionRef: noop
|
|
16
19
|
};
|
|
17
20
|
const composerProps = {
|
|
18
21
|
placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),
|
|
19
22
|
inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),
|
|
23
|
+
maxLengthMessage: PropTypes.string.description('Max length message').defaultValue(defaultComposerPros.maxLengthMessage),
|
|
20
24
|
onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),
|
|
21
25
|
onResize: PropTypes.func.description('Called the input changes his height').defaultValue(defaultComposerPros.onResize),
|
|
22
26
|
onSend: PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),
|
|
23
27
|
onFocus: PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),
|
|
24
|
-
onBlur: PropTypes.
|
|
28
|
+
onBlur: PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),
|
|
29
|
+
onKeyDown: PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),
|
|
25
30
|
maxHeight: PropTypes.number.description('Max height of the composer. Use 0 for no limit').defaultValue(defaultComposerPros.onBlur),
|
|
26
31
|
inputMaxLength: PropTypes.number.description('Max length of the composer. `undefined` for no limit').defaultValue(defaultComposerPros.inputMaxLength),
|
|
27
|
-
buttonDisabled: PropTypes.
|
|
28
|
-
dataTestid: PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder)
|
|
32
|
+
buttonDisabled: PropTypes.bool.description('Control the disabled for the send button').defaultValue(defaultComposerPros.buttonDisabled),
|
|
33
|
+
dataTestid: PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),
|
|
34
|
+
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)
|
|
29
35
|
};
|
|
30
36
|
|
|
31
37
|
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.
|
|
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.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]);
|
|
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);"]);
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import React from 'react';
|
|
4
9
|
import { noop } from 'lodash';
|
|
5
10
|
import { describe } from 'react-desc';
|
|
6
|
-
import DSIndeterminateProgressIndicator from '@elliemae/ds-
|
|
11
|
+
import DSIndeterminateProgressIndicator from '@elliemae/ds-indeterminate-progress-indicator';
|
|
7
12
|
import DSBanner, { BANNER_TYPES } from '@elliemae/ds-banner';
|
|
8
13
|
import { ChatComposer } from '../chat-composer/ChatContainerComposer.js';
|
|
9
14
|
import { ChatContainerMessagesList } from '../chat-container-messages-list/ChatContainerMessagesList.js';
|
|
10
15
|
import { containerProps, defaultProps } from './props.js';
|
|
11
16
|
import { StyledIndicatorContainer, StyledChatContainerContent, MobileStyledChatContainerContent } from './styled.js';
|
|
17
|
+
import { useValidateProps } from './config/useValidateProps.js';
|
|
12
18
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
19
|
|
|
14
20
|
var _DSIndeterminateProgr, _StyledIndicatorConta;
|
|
@@ -20,6 +26,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
20
26
|
const ChatContainer = props => {
|
|
21
27
|
var _containerRef$current;
|
|
22
28
|
|
|
29
|
+
useValidateProps(props, containerProps);
|
|
23
30
|
const {
|
|
24
31
|
sendingText,
|
|
25
32
|
sendingMessages,
|
|
@@ -28,15 +35,20 @@ const ChatContainer = props => {
|
|
|
28
35
|
messagesListProps,
|
|
29
36
|
composerProps,
|
|
30
37
|
composerProps: {
|
|
31
|
-
onResize: onComposerResize
|
|
38
|
+
onResize: onComposerResize,
|
|
39
|
+
onKeyDown: onComposerKeyDown
|
|
32
40
|
},
|
|
33
41
|
actionRef,
|
|
34
|
-
autoScroll,
|
|
35
42
|
device,
|
|
36
43
|
isLoading,
|
|
37
44
|
hasMoreItems,
|
|
38
|
-
getMoreMessages
|
|
45
|
+
getMoreMessages,
|
|
46
|
+
ariaLabel
|
|
39
47
|
} = props;
|
|
48
|
+
const bannerRef = React.useRef({
|
|
49
|
+
focusOnWrapper: noop,
|
|
50
|
+
focusOnLink: noop
|
|
51
|
+
});
|
|
40
52
|
const containerRef = React.useRef();
|
|
41
53
|
const listRef = React.useRef({
|
|
42
54
|
scrollToIndex: noop
|
|
@@ -44,21 +56,51 @@ const ChatContainer = props => {
|
|
|
44
56
|
const onResize = React.useCallback(height => {
|
|
45
57
|
if (onComposerResize) onComposerResize(height);
|
|
46
58
|
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
if (height > 30) {
|
|
60
|
+
/*
|
|
61
|
+
setTimeout is used to equal the animation duration from the
|
|
62
|
+
composer text area when increase its size
|
|
63
|
+
*/
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
actionRef.current.scrollToIndex(messagesListProps.messages.length - 1, {
|
|
66
|
+
align: 'start'
|
|
67
|
+
});
|
|
68
|
+
}, 50);
|
|
51
69
|
}
|
|
52
|
-
}, [onComposerResize, messagesListProps.messages,
|
|
70
|
+
}, [onComposerResize, messagesListProps.messages, actionRef]);
|
|
53
71
|
const Container = device === 'desktop' ? StyledChatContainerContent : MobileStyledChatContainerContent;
|
|
72
|
+
const handleTabs = React.useCallback(e => {
|
|
73
|
+
if (onComposerKeyDown) onComposerKeyDown(e);else {
|
|
74
|
+
const ref = actionRef || listRef;
|
|
75
|
+
|
|
76
|
+
if (e.shiftKey && e.key === 'Tab') {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
|
|
79
|
+
if (['top', 'bottom'].includes(bannerPosition)) {
|
|
80
|
+
bannerRef.current.focusOnWrapper();
|
|
81
|
+
} else {
|
|
82
|
+
const last = ref.current.getMessagesInView().pop();
|
|
83
|
+
ref.current.focusToIndexWithoutScroll(last);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, [actionRef, onComposerKeyDown, bannerPosition]); // Map actions
|
|
88
|
+
|
|
89
|
+
React.useEffect(() => {
|
|
90
|
+
if (actionRef && actionRef.current) {
|
|
91
|
+
actionRef.current.focusOnBanner = bannerRef.current.focusOnWrapper;
|
|
92
|
+
actionRef.current.focusOnBannerLink = bannerRef.current.focusOnLink;
|
|
93
|
+
}
|
|
94
|
+
}, [actionRef]);
|
|
54
95
|
return /*#__PURE__*/jsxs(Container, {
|
|
55
96
|
rows: ['minmax(0, 1fr)', 'auto'],
|
|
56
97
|
ref: containerRef,
|
|
57
98
|
role: "region",
|
|
58
|
-
"aria-label":
|
|
99
|
+
"aria-label": ariaLabel,
|
|
59
100
|
children: [/*#__PURE__*/_jsx("div", {
|
|
60
101
|
style: {
|
|
61
|
-
position: 'relative'
|
|
102
|
+
position: 'relative',
|
|
103
|
+
overflow: 'hidden'
|
|
62
104
|
}
|
|
63
105
|
}, void 0, /*#__PURE__*/jsx(ChatContainerMessagesList, _objectSpread(_objectSpread({}, messagesListProps), {}, {
|
|
64
106
|
actionRef: actionRef || listRef,
|
|
@@ -66,13 +108,17 @@ const ChatContainer = props => {
|
|
|
66
108
|
hasMoreItems: hasMoreItems,
|
|
67
109
|
getMoreMessages: getMoreMessages,
|
|
68
110
|
sendingMessages: sendingMessages,
|
|
69
|
-
sendingText: sendingText
|
|
111
|
+
sendingText: sendingText,
|
|
112
|
+
bannerPosition: bannerPosition,
|
|
113
|
+
bannerRef: bannerRef
|
|
70
114
|
})), ['top', 'bottom'].includes(isLoading) ? /*#__PURE__*/_jsx(StyledIndicatorContainer, {
|
|
71
|
-
isLoading: isLoading
|
|
115
|
+
isLoading: isLoading,
|
|
116
|
+
"data-testid": "ds-chat-loading-indicator"
|
|
72
117
|
}, void 0, _DSIndeterminateProgr || (_DSIndeterminateProgr = /*#__PURE__*/_jsx(DSIndeterminateProgressIndicator, {
|
|
73
118
|
processing: true,
|
|
74
119
|
title: "Loading"
|
|
75
|
-
}))) : null,
|
|
120
|
+
}))) : null, /*#__PURE__*/_jsx(StyledIndicatorContainer, {
|
|
121
|
+
linear: true,
|
|
76
122
|
isLoading: bannerPosition
|
|
77
123
|
}, void 0, /*#__PURE__*/_jsx(DSBanner, {
|
|
78
124
|
showCloseButton: true,
|
|
@@ -86,17 +132,21 @@ const ChatContainer = props => {
|
|
|
86
132
|
},
|
|
87
133
|
onClose: bannerProps.onClose,
|
|
88
134
|
isOpen: true,
|
|
89
|
-
type: BANNER_TYPES.INFO
|
|
90
|
-
|
|
135
|
+
type: bannerProps.type || BANNER_TYPES.INFO,
|
|
136
|
+
actionRef: bannerRef
|
|
137
|
+
})), sendingMessages && sendingMessages.length > 0 ? _StyledIndicatorConta || (_StyledIndicatorConta = /*#__PURE__*/_jsx(StyledIndicatorContainer, {
|
|
91
138
|
isLoading: "bottom",
|
|
92
|
-
linear: true
|
|
139
|
+
linear: true,
|
|
140
|
+
"data-testid": "ds-chat-loading-indicator"
|
|
93
141
|
}, void 0, /*#__PURE__*/_jsx(DSIndeterminateProgressIndicator, {
|
|
94
142
|
processing: true,
|
|
95
143
|
title: "Loading",
|
|
96
144
|
lineOnly: true
|
|
97
145
|
}))) : null), /*#__PURE__*/jsx(ChatComposer, _objectSpread(_objectSpread({}, composerProps), {}, {
|
|
146
|
+
onKeyDown: handleTabs,
|
|
98
147
|
onResize: onResize,
|
|
99
|
-
maxHeight: (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientHeight) || 0) / 2
|
|
148
|
+
maxHeight: (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientHeight) || 0) / 2,
|
|
149
|
+
actionRef: actionRef || listRef
|
|
100
150
|
}))]
|
|
101
151
|
});
|
|
102
152
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PropTypes } from 'react-desc';
|
|
2
2
|
import { noop } from 'lodash';
|
|
3
|
+
import { BANNER_TYPES } from '@elliemae/ds-banner';
|
|
3
4
|
import { defaultProps as defaultProps$1 } from '../chat-container-messages-list/props.js';
|
|
4
5
|
import { defaultComposerPros } from '../chat-composer/props.js';
|
|
5
6
|
|
|
6
7
|
const defaultProps = {
|
|
7
8
|
messagesListProps: defaultProps$1,
|
|
8
9
|
composerProps: defaultComposerPros,
|
|
9
|
-
actionRef:
|
|
10
|
+
actionRef: undefined,
|
|
10
11
|
autoScroll: false,
|
|
11
12
|
device: 'desktop',
|
|
12
13
|
isLoading: undefined,
|
|
@@ -14,26 +15,30 @@ const defaultProps = {
|
|
|
14
15
|
getMoreMessages: noop,
|
|
15
16
|
bannerPosition: undefined,
|
|
16
17
|
bannerProps: {
|
|
18
|
+
type: BANNER_TYPES.INFO,
|
|
17
19
|
label: 'Unread Messages',
|
|
18
20
|
viewLabel: 'View',
|
|
19
21
|
onView: noop,
|
|
20
22
|
onClose: noop
|
|
21
23
|
},
|
|
22
24
|
sendingMessages: undefined,
|
|
23
|
-
sendingText: 'Sending'
|
|
25
|
+
sendingText: 'Sending',
|
|
26
|
+
ariaLabel: 'Chat window'
|
|
24
27
|
};
|
|
25
28
|
const containerProps = {
|
|
26
|
-
messagesListProps: PropTypes.
|
|
27
|
-
composerProps: PropTypes.
|
|
29
|
+
messagesListProps: PropTypes.object.description('ChatMessageList props "messages" / "onScrollEnds"').defaultValue(defaultProps.messagesListProps),
|
|
30
|
+
composerProps: PropTypes.object.description('Composer configuration').defaultValue(defaultProps.composerProps),
|
|
28
31
|
autoScroll: PropTypes.bool.description('Auto scroll to bottom on resize').defaultValue(defaultProps.autoScroll),
|
|
29
32
|
device: PropTypes.string.description('Option to render mobile or desktop style composer').defaultValue(defaultProps.device),
|
|
30
33
|
isLoading: PropTypes.oneOf(['top', 'bottom', undefined]).description('Show Loading messages indicator at the `top` or `bottom` of the container'),
|
|
31
34
|
hasMoreItems: PropTypes.oneOf(['top', 'bottom', undefined]).description('Show Load More button at the `top` or `bottom` of the container'),
|
|
32
35
|
getMoreMessages: PropTypes.func.description('Called when the user clicks on load more').defaultValue(defaultProps.getMoreMessages),
|
|
33
36
|
bannerPosition: PropTypes.oneOf(['top', 'bottom', undefined]).description('Show Loading messages indicator at the `top` or `bottom` of the container'),
|
|
34
|
-
bannerProps: PropTypes.
|
|
35
|
-
sendingMessages: PropTypes.
|
|
36
|
-
sendingText: PropTypes.string.description('Label description for messages in sending status').defaultValue(defaultProps.sendingText)
|
|
37
|
+
bannerProps: PropTypes.object.description("Banner configuration:\n label: string;\n viewLabel: string;\n type: BANNER_TYPES;\n onView: () => void;\n onClose: () => void;\n ").defaultValue(defaultProps.bannerProps),
|
|
38
|
+
sendingMessages: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.number)]).description('Array of ids of sending messages').defaultValue(defaultProps.sendingMessages),
|
|
39
|
+
sendingText: PropTypes.string.description('Label description for messages in sending status').defaultValue(defaultProps.sendingText),
|
|
40
|
+
actionRef: PropTypes.object.description("Reference: \n { \n scrollToIndex: (n: number) => void,\n getMessagesInView: () => number[],\n focusToIndex: (n: number) => void,\n focusToList: () => void,\n focusToComposer: () => void,\n focusToSend: () => void,\n }\n \n ").defaultValue(defaultProps.actionRef),
|
|
41
|
+
ariaLabel: PropTypes.string.description('Aria Label description for chat container').defaultValue(defaultProps.ariaLabel)
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
export { containerProps, defaultProps };
|
|
@@ -10,9 +10,9 @@ const StyledChatContainerContent = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
10
10
|
})(["height:100%;min-width:", "px;overflow:hidden;background:", ";position:relative;"], CONTAINER_WIDTH, props => props.theme.colors.neutral['050']);
|
|
11
11
|
const StyledIndicatorContainer = /*#__PURE__*/styled.div.withConfig({
|
|
12
12
|
componentId: "sc-d732wo-1"
|
|
13
|
-
})(["position:absolute;width:
|
|
13
|
+
})(["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 " : '');
|
|
14
14
|
const MobileStyledChatContainerContent = /*#__PURE__*/styled(StyledChatContainerContent).withConfig({
|
|
15
15
|
componentId: "sc-d732wo-2"
|
|
16
|
-
})(["", ",", "{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;}"], StyledTitleLeftBubble, StyleBodyWrapper, StyledTitleRightBubble, Wrapper, Title, Message, Time, StyledComposerInput);
|
|
16
|
+
})(["", ",", "{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;}"], StyledTitleLeftBubble, StyleBodyWrapper, StyledTitleRightBubble, Wrapper, Title, Message, Time, StyledComposerInput, StyledIndicatorContainer);
|
|
17
17
|
|
|
18
18
|
export { CONTAINER_WIDTH, MobileStyledChatContainerContent, StyledChatContainerContent, StyledIndicatorContainer };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import
|
|
2
|
+
import 'react';
|
|
3
3
|
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
4
4
|
import { StyledChatContainerContentHeader, StyledChatContainerContentHeaderLabel, StyledChatContainerContentHeaderActions } from './styled.js';
|
|
5
|
+
import { validHeaderChilds } from './helpers.js';
|
|
5
6
|
|
|
6
7
|
const ChatContainerHeader = props => {
|
|
7
8
|
const {
|
|
@@ -21,7 +22,7 @@ const ChatContainerHeader = props => {
|
|
|
21
22
|
}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
22
23
|
value: title
|
|
23
24
|
})), /*#__PURE__*/_jsx(StyledChatContainerContentHeaderActions, {
|
|
24
|
-
cols:
|
|
25
|
+
cols: validHeaderChilds(children),
|
|
25
26
|
justifyContent: "flex-end",
|
|
26
27
|
"data-testid": "chat-container-header-children"
|
|
27
28
|
}, void 0, children));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.to-array.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.to-array.js';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
|
|
11
|
+
const validHeaderChilds = children => React.Children.toArray(children).filter(e => {
|
|
12
|
+
if (Array.isArray(e.props.children)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (e.props.children === undefined && e.$$typeof.toString() === 'Symbol(react.element)') {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return !!e.props.children;
|
|
21
|
+
}).map(() => '32px');
|
|
22
|
+
|
|
23
|
+
export { validHeaderChilds };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { Grid } from '@elliemae/ds-grid';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const StyledChatContainerContentHeaderActions = /*#__PURE__*/styled(Grid).withConfig({
|
|
5
5
|
componentId: "sc-jmynvr-0"
|
|
6
|
-
})(["width:
|
|
7
|
-
const
|
|
6
|
+
})(["max-width:80px;"]);
|
|
7
|
+
const StyledChatContainerContentHeader = /*#__PURE__*/styled(Grid).withConfig({
|
|
8
8
|
componentId: "sc-jmynvr-1"
|
|
9
|
-
})(["
|
|
10
|
-
const
|
|
9
|
+
})(["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);
|
|
10
|
+
const StyledChatContainerContentHeaderLabel = /*#__PURE__*/styled(Grid).withConfig({
|
|
11
11
|
componentId: "sc-jmynvr-2"
|
|
12
|
-
})(["
|
|
12
|
+
})(["justify-content:center;align-items:center;font-weight:bold;font-size:18px;color:", ";"], props => props.theme.colors.neutral['700']);
|
|
13
13
|
|
|
14
14
|
export { StyledChatContainerContentHeader, StyledChatContainerContentHeaderActions, StyledChatContainerContentHeaderLabel };
|