@elliemae/ds-chat 2.4.2-rc.1 → 2.4.2-rc.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/exported-related/bubble/ChatBubble.js +7 -7
- package/cjs/exported-related/bubble/styled.js +30 -1
- package/cjs/exported-related/chat-card/props.js +2 -2
- package/cjs/exported-related/chat-container-header/props.js +1 -1
- package/cjs/exported-related/chat-sidebar/SideBarChat.js +1 -3
- package/cjs/exported-related/chat-sidebar/props.js +5 -1
- package/cjs/exported-related/chat-sidebar/sidebar-button/SidebarButton.js +1 -1
- package/cjs/exported-related/grid-influencer/styled.js +6 -2
- package/cjs/exported-related/message-delimiter/styled.js +1 -1
- package/cjs/exported-related/tile-button/TileButton.js +4 -4
- package/cjs/exported-related/tile-button/styled.js +7 -5
- package/cjs/parts/chat-composer/ChatContainerComposer.js +8 -13
- package/cjs/parts/chat-composer/styled.js +2 -2
- package/cjs/parts/chat-container/ChatContainer.js +9 -15
- package/cjs/parts/chat-container/styled.js +11 -1
- package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +24 -50
- package/cjs/parts/chat-container-messages-list/styled.js +5 -1
- package/cjs/parts/chat-container-messages-list/useGetNewMessages.js +0 -1
- package/cjs/react-desc-prop-types.js +42 -5
- package/cjs/styled.js +1 -1
- package/esm/exported-related/bubble/ChatBubble.js +7 -7
- package/esm/exported-related/bubble/styled.js +30 -1
- package/esm/exported-related/chat-card/props.js +2 -2
- package/esm/exported-related/chat-container-header/props.js +1 -1
- package/esm/exported-related/chat-sidebar/SideBarChat.js +1 -3
- package/esm/exported-related/chat-sidebar/props.js +5 -1
- package/esm/exported-related/chat-sidebar/sidebar-button/SidebarButton.js +1 -1
- package/esm/exported-related/grid-influencer/styled.js +6 -2
- package/esm/exported-related/message-delimiter/styled.js +1 -1
- package/esm/exported-related/tile-button/TileButton.js +4 -4
- package/esm/exported-related/tile-button/styled.js +7 -4
- package/esm/parts/chat-composer/ChatContainerComposer.js +6 -11
- package/esm/parts/chat-composer/styled.js +2 -2
- package/esm/parts/chat-container/ChatContainer.js +9 -15
- package/esm/parts/chat-container/styled.js +11 -1
- package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +24 -50
- package/esm/parts/chat-container-messages-list/styled.js +5 -1
- package/esm/parts/chat-container-messages-list/useGetNewMessages.js +0 -1
- package/esm/react-desc-prop-types.js +42 -5
- package/esm/styled.js +1 -1
- package/package.json +10 -10
|
@@ -33,7 +33,7 @@ const ChatBubble = props$1 => {
|
|
|
33
33
|
} = propsWithDefault;
|
|
34
34
|
const bodyParts = React__default["default"].useMemo(() => typeof body === 'string' ? body.split('\n') : [body], [body]);
|
|
35
35
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledWrapper, {
|
|
36
|
-
"data-testid":
|
|
36
|
+
"data-testid": `ds-chat-bubble-${dsId}`
|
|
37
37
|
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledColoredBubble, {
|
|
38
38
|
type: type
|
|
39
39
|
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledTitleBubble, {
|
|
@@ -43,22 +43,22 @@ const ChatBubble = props$1 => {
|
|
|
43
43
|
className: "sr-only"
|
|
44
44
|
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledTitleLeftBubble, {
|
|
45
45
|
alignItems: "center",
|
|
46
|
-
"data-testid":
|
|
46
|
+
"data-testid": `chat-bubble-title-${dsId}`
|
|
47
47
|
}, void 0, title), /*#__PURE__*/_jsx__default["default"](styled.StyledTitleRightBubble, {
|
|
48
48
|
alignItems: "center",
|
|
49
49
|
type: type,
|
|
50
|
-
"data-testid":
|
|
50
|
+
"data-testid": `chat-bubble-time-${dsId}`
|
|
51
51
|
}, void 0, time)), /*#__PURE__*/_jsx__default["default"](styled.StyleBodyWrapper, {
|
|
52
|
-
"data-testid":
|
|
53
|
-
}, void 0, bodyParts.map((item, index) => /*#__PURE__*/_jsx__default["default"](React__default["default"].Fragment, {},
|
|
52
|
+
"data-testid": `chat-bubble-body-${dsId}`
|
|
53
|
+
}, void 0, bodyParts.map((item, index) => /*#__PURE__*/_jsx__default["default"](React__default["default"].Fragment, {}, `${item}-${dsId}`, item, index < bodyParts.length - 1 ? _br || (_br = /*#__PURE__*/_jsx__default["default"]("br", {})) : null))), /*#__PURE__*/_jsx__default["default"](ChatBubbleArrow.ChatBubbleArrow, {
|
|
54
54
|
type: type
|
|
55
55
|
})), errorMessage ? /*#__PURE__*/_jsx__default["default"](styled.StyleErrorMessage, {
|
|
56
|
-
"data-testid":
|
|
56
|
+
"data-testid": `chat-bubble-error-message-${dsId}`,
|
|
57
57
|
p: "xxs",
|
|
58
58
|
gutter: "xxs",
|
|
59
59
|
cols: [1, 'auto']
|
|
60
60
|
}, void 0, /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, errorMessage), _WarningCircleFill || (_WarningCircleFill = /*#__PURE__*/_jsx__default["default"](dsIcons.WarningCircleFill, {}))) : null, helpMessage ? /*#__PURE__*/_jsx__default["default"](styled.StyleHelpMessage, {
|
|
61
|
-
"data-testid":
|
|
61
|
+
"data-testid": `chat-bubble-help-message-${dsId}`,
|
|
62
62
|
p: "xxs",
|
|
63
63
|
gutter: "xxs",
|
|
64
64
|
cols: [1, 'auto']
|
|
@@ -40,7 +40,36 @@ 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-57v3aa-8"
|
|
43
|
-
})(["min-width:224px;border-radius:10px;position:relative;", ""], props$1 => props$1.type === props.BUBBLE_TYPES.SENDER ?
|
|
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
|
+
`);
|
|
44
73
|
|
|
45
74
|
exports.StyleBodyWrapper = StyleBodyWrapper;
|
|
46
75
|
exports.StyleErrorMessage = StyleErrorMessage;
|
|
@@ -12,8 +12,8 @@ const defaultProps = {
|
|
|
12
12
|
rightAddon: /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
|
13
13
|
};
|
|
14
14
|
const propTypes = {
|
|
15
|
-
title: dsPropsHelpers.PropTypes.string.isRequired.description(
|
|
16
|
-
content: dsPropsHelpers.PropTypes.string.description(
|
|
15
|
+
title: dsPropsHelpers.PropTypes.string.isRequired.description(`Card's title`),
|
|
16
|
+
content: dsPropsHelpers.PropTypes.string.description(`Card's content`),
|
|
17
17
|
time: dsPropsHelpers.PropTypes.string.description('Time'),
|
|
18
18
|
rightAddon: dsPropsHelpers.PropTypes.element.description('Right addon, badge or icon')
|
|
19
19
|
};
|
|
@@ -8,7 +8,7 @@ const defaultProps = {
|
|
|
8
8
|
title: ''
|
|
9
9
|
};
|
|
10
10
|
const propTypes = {
|
|
11
|
-
title: dsPropsHelpers.PropTypes.string.isRequired.description(
|
|
11
|
+
title: dsPropsHelpers.PropTypes.string.isRequired.description(`Card's title`),
|
|
12
12
|
children: dsPropsHelpers.PropTypes.node.description('Childrens')
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -67,9 +67,7 @@ const SideBarChat = props$1 => {
|
|
|
67
67
|
if (ref) listRef[ref.dataset.key] = ref;
|
|
68
68
|
}, [listRef]);
|
|
69
69
|
React__default["default"].useEffect(() => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if ((_actionRef$current = actionRef.current) !== null && _actionRef$current !== void 0 && _actionRef$current.listRef) {
|
|
70
|
+
if (actionRef.current?.listRef) {
|
|
73
71
|
actionRef.current.listRef = listRef;
|
|
74
72
|
}
|
|
75
73
|
}, [sidebarItems, expanded, actionRef, listRef]);
|
|
@@ -32,7 +32,11 @@ const chatSidebarProps = {
|
|
|
32
32
|
onHeaderExpand: reactDesc.PropTypes.func.description('The function to call when the chat is opened via the header').defaultValue(defaultProps.onHeaderExpand),
|
|
33
33
|
onHeaderClose: reactDesc.PropTypes.func.description('The function to call when the chat is closed via the header').defaultValue(defaultProps.onHeaderClose),
|
|
34
34
|
footerButtonExtraProps: reactDesc.PropTypes.object.description('Expand/collapse footer button extra props').defaultValue(defaultProps.footerButtonExtraProps),
|
|
35
|
-
actionRef: reactDesc.PropTypes.object.description(
|
|
35
|
+
actionRef: reactDesc.PropTypes.object.description(`Action ref for sidebar
|
|
36
|
+
{
|
|
37
|
+
listRef: references to Tiles
|
|
38
|
+
}
|
|
39
|
+
`).defaultValue(defaultProps.actionRef)
|
|
36
40
|
};
|
|
37
41
|
|
|
38
42
|
exports.chatSidebarProps = chatSidebarProps;
|
|
@@ -40,7 +40,7 @@ const SidebarButton = _ref => {
|
|
|
40
40
|
if (dsId) onClick(dsId);
|
|
41
41
|
}, [onClick, dsId]);
|
|
42
42
|
return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledSidebarButton, _objectSpread(_objectSpread({
|
|
43
|
-
"data-testid":
|
|
43
|
+
"data-testid": `sidebar-button-${dsId}`,
|
|
44
44
|
onClick: handleClick
|
|
45
45
|
}, rest), {}, {
|
|
46
46
|
children: [/*#__PURE__*/_jsx__default["default"](styled.StyledSidebarButtonIcon, {
|
|
@@ -12,10 +12,14 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
12
12
|
|
|
13
13
|
const StyledChatContainer = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
14
14
|
componentId: "sc-15373cc-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 ? `${props.expandedWidth}px` : `${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-15373cc-1"
|
|
18
|
-
})(["height:100%;overflow:hidden;background:", ";", ""], props => props.theme.colors.neutral['050'], props => props.floating ?
|
|
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
|
+
`);
|
|
19
23
|
|
|
20
24
|
exports.StyledChatContainer = StyledChatContainer;
|
|
21
25
|
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-1oelxl4-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' ? `${props.verticalMargin}px 8px` : `${props.verticalMargin} 8px`);
|
|
21
21
|
|
|
22
22
|
exports.Line = Line;
|
|
23
23
|
exports.Text = Text;
|
|
@@ -62,7 +62,7 @@ const TileButton = props$1 => {
|
|
|
62
62
|
})), badge ? /*#__PURE__*/_jsx__default["default"](styled.StyledStatusBadge, {
|
|
63
63
|
badgeColor: badgeColor,
|
|
64
64
|
badgePosition: badgePosition,
|
|
65
|
-
"data-testid":
|
|
65
|
+
"data-testid": `tile-badge-${dsId}`
|
|
66
66
|
}) : null)), !isHeader ? /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
67
67
|
width: "100%",
|
|
68
68
|
justifyContent: "center"
|
|
@@ -70,7 +70,7 @@ const TileButton = props$1 => {
|
|
|
70
70
|
const Btn = React__default["default"].useMemo(() => /*#__PURE__*/jsxRuntime.jsx(styled.StyledTileButton, {
|
|
71
71
|
isHeader: isHeader,
|
|
72
72
|
value: dsId,
|
|
73
|
-
"data-testid":
|
|
73
|
+
"data-testid": `tile-button-${dsId}`,
|
|
74
74
|
"data-key": dsId,
|
|
75
75
|
onClick: handleClick,
|
|
76
76
|
onFocus: onFocus,
|
|
@@ -88,11 +88,11 @@ const TileButton = props$1 => {
|
|
|
88
88
|
}, void 0, _span || (_span = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, MainContent)), _StyledWrapperLeftBor || (_StyledWrapperLeftBor = /*#__PURE__*/_jsx__default["default"](styled.StyledWrapperLeftBorder, {})), showClose && !disabled ? /*#__PURE__*/_jsx__default["default"](styled.CloseButton, {
|
|
89
89
|
onClick: onClose,
|
|
90
90
|
value: dsId,
|
|
91
|
-
"data-testid":
|
|
91
|
+
"data-testid": `tile-close-btn-${dsId}`
|
|
92
92
|
}, void 0, _CloseXsmall || (_CloseXsmall = /*#__PURE__*/_jsx__default["default"](dsIcons.CloseXsmall, {}))) : null)
|
|
93
93
|
}, dsId), [MainContent, ariaLabel, badgeColor, badgePosition, disabled, dsId, handleClick, isHeader, onBlur, onClose, onFocus, selected, showClose, innerRef]);
|
|
94
94
|
return title && !disableTooltip ? /*#__PURE__*/_jsx__default["default"](styled.StyledTooltipV3ButtonWrapper, {}, void 0, /*#__PURE__*/_jsx__default["default"](dsTooltip.DSTooltipV3, {
|
|
95
|
-
id:
|
|
95
|
+
id: `ds-chat-tile-tooltip-button-${dsId}`,
|
|
96
96
|
text: title,
|
|
97
97
|
startPlacementPreference: tooltipPlacement
|
|
98
98
|
}, void 0, Btn)) : Btn;
|
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
5
|
var styled = require('styled-components');
|
|
7
6
|
var dsSystem = require('@elliemae/ds-system');
|
|
8
7
|
var dsGrid = require('@elliemae/ds-grid');
|
|
9
8
|
|
|
10
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
10
|
|
|
12
|
-
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
13
11
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
/* eslint-disable indent */
|
|
16
14
|
const MIN_WIDTH_SIDEBAR = 48;
|
|
17
15
|
const BUTTON_SIDEBAR_HEIGHT = 48; // Buttons
|
|
18
16
|
|
|
@@ -62,7 +60,7 @@ const StyledTooltipV3ButtonWrapper = /*#__PURE__*/styled__default["default"].div
|
|
|
62
60
|
})(["height:", "px;width:", "px;"], BUTTON_SIDEBAR_HEIGHT, MIN_WIDTH_SIDEBAR);
|
|
63
61
|
const StyledTileButton = /*#__PURE__*/styled__default["default"].button.withConfig({
|
|
64
62
|
componentId: "sc-b69sbu-7"
|
|
65
|
-
})(["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 ?
|
|
63
|
+
})(["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 ${props.theme.colors.neutral['200']}` : 'none', props => props.theme.colors.neutral['080'], StyledStatusBadge, props => props.theme.colors.neutral['080'], props => {
|
|
66
64
|
switch (props.badgePosition) {
|
|
67
65
|
case 'left':
|
|
68
66
|
return 'margin-left: -2px;';
|
|
@@ -75,7 +73,11 @@ const StyledTileButton = /*#__PURE__*/styled__default["default"].button.withConf
|
|
|
75
73
|
}
|
|
76
74
|
}, StyledWrapperLeftBorder, props => props.theme.colors.brand[800], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.brand[800], props => props.theme.colors.neutral['050'], StyledWrapperLeftBorder, props => props.theme.colors.brand[600], StyledTileButtonLabel, props => props.theme.colors.neutral[600], props => props.theme.colors.brand[600], StyledStatusBadge, props => props.theme.colors.neutral['050'], props => props.theme.colors.neutral['080'], StyledWrapperLeftBorder, props => props.theme.colors.neutral['400'], StyledStatusBadge, props => props.theme.colors.neutral['500'], props => props.theme.colors.neutral['080'], StyledTileButtonIcon, props => props.theme.colors.neutral[400], StyledTileButtonLabel, props => props.theme.colors.neutral[400], props => {
|
|
77
75
|
if (props.selected) {
|
|
78
|
-
return dsSystem.css
|
|
76
|
+
return dsSystem.css`
|
|
77
|
+
& ${StyledWrapperLeftBorder} {
|
|
78
|
+
background: ${nestedProps => nestedProps.theme.colors.brand[600]};
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
return '';
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
13
12
|
var React = require('react');
|
|
14
13
|
var dsGrid = require('@elliemae/ds-grid');
|
|
15
14
|
var dsIcons = require('@elliemae/ds-icons');
|
|
@@ -31,8 +30,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
31
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
31
|
|
|
33
32
|
const ChatComposer = props => {
|
|
34
|
-
var _input$current;
|
|
35
|
-
|
|
36
33
|
const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, reactDescPropTypes.defaultPropsComposer);
|
|
37
34
|
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, reactDescPropTypes.ChatComposerPropTypes);
|
|
38
35
|
const {
|
|
@@ -60,12 +57,10 @@ const ChatComposer = props => {
|
|
|
60
57
|
const internalMaxHeight = React__default["default"].useMemo(() => maxHeight - 24, [maxHeight]);
|
|
61
58
|
const [showScroll, setShowScroll] = React__default["default"].useState(true);
|
|
62
59
|
React__default["default"].useEffect(() => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const newHeight = ((_inputSize$current = inputSize.current) === null || _inputSize$current === void 0 ? void 0 : _inputSize$current.scrollHeight) > internalMaxHeight ? internalMaxHeight : (_inputSize$current2 = inputSize.current) === null || _inputSize$current2 === void 0 ? void 0 : _inputSize$current2.scrollHeight;
|
|
60
|
+
const newHeight = inputSize.current?.scrollHeight > internalMaxHeight ? internalMaxHeight : inputSize.current?.scrollHeight;
|
|
66
61
|
if (newHeight !== height && newHeight > COMPOSER_MIN_HEIGHT) onResize(newHeight);
|
|
67
62
|
setHeight(newHeight);
|
|
68
|
-
setShowScroll(
|
|
63
|
+
setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);
|
|
69
64
|
}, [inputValue, internalMaxHeight, height, onResize]);
|
|
70
65
|
React__default["default"].useEffect(() => {
|
|
71
66
|
if (actionRef && actionRef.current) {
|
|
@@ -89,7 +84,7 @@ const ChatComposer = props => {
|
|
|
89
84
|
const hasError = React__default["default"].useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);
|
|
90
85
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledChatContainerContentComposer, {
|
|
91
86
|
rows: ['auto', '15px'],
|
|
92
|
-
maxHeight:
|
|
87
|
+
maxHeight: `${maxHeight}px`,
|
|
93
88
|
"data-testid": dataTestid
|
|
94
89
|
}, void 0, /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
95
90
|
cols: ['1fr', '24px'],
|
|
@@ -135,7 +130,7 @@ const ChatComposer = props => {
|
|
|
135
130
|
pointerEvents: 'none',
|
|
136
131
|
position: 'absolute',
|
|
137
132
|
top: 0,
|
|
138
|
-
width:
|
|
133
|
+
width: input.current?.clientWidth
|
|
139
134
|
},
|
|
140
135
|
onChange: handleChange,
|
|
141
136
|
value: inputValue
|
|
@@ -151,8 +146,8 @@ const ChatComposer = props => {
|
|
|
151
146
|
}, void 0, inputMaxLength && hasError ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
152
147
|
children: [/*#__PURE__*/_jsx__default["default"](styled.StyledCounterErrorA11y, {
|
|
153
148
|
role: "alert"
|
|
154
|
-
}, void 0, ariaMaxLengthMessage ||
|
|
155
|
-
}) : '', inputMaxLength ?
|
|
149
|
+
}, void 0, ariaMaxLengthMessage || `You have entered ${inputLength} characters and have exceeded the limit by ${inputLength - inputMaxLength}. Please limit to less than ${inputMaxLength} characters. `), maxLengthMessage || `Please limit to less than ${inputMaxLength} characters. `]
|
|
150
|
+
}) : '', inputMaxLength ? ` ${inputLength} / ${inputMaxLength}` : ''), _Grid || (_Grid = /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {}))));
|
|
156
151
|
};
|
|
157
152
|
|
|
158
153
|
const ChatComposerWithSchema = dsPropsHelpers.describe(ChatComposer);
|
|
@@ -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.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' ?
|
|
19
|
+
})(["padding:", ";resize:none;min-height:32px;border-radius:2px;border:solid 1px #cbcfd7;color:#25292f;height:", ";min-width:244px;overflow-y:auto;font-size:13px;font-weight:400;line-height:1;transition:height 0.05s;&:focus{outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px #8cc2ed;border-radius:2px;}"], props => props.theme.space.xxs, props => typeof props.height === 'number' ? `${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:${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);"]);
|
|
@@ -35,8 +35,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
35
35
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
36
36
|
|
|
37
37
|
const ChatContainer = props => {
|
|
38
|
-
var _messagesListProps$me2, _containerRef$current;
|
|
39
|
-
|
|
40
38
|
const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, reactDescPropTypes.defaultProps);
|
|
41
39
|
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, reactDescPropTypes.ChatContainerPropTypes);
|
|
42
40
|
const globalAttributes = dsPropsHelpers.useGetGlobalAttributes(propsWithDefault);
|
|
@@ -84,23 +82,19 @@ const ChatContainer = props => {
|
|
|
84
82
|
const ref = actionRef || listRef;
|
|
85
83
|
|
|
86
84
|
if (e.shiftKey && e.key === 'Tab') {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (((_messagesListProps$me = messagesListProps.messages) === null || _messagesListProps$me === void 0 ? void 0 : _messagesListProps$me.length) > 0) {
|
|
85
|
+
if (messagesListProps.messages?.length > 0) {
|
|
90
86
|
e.preventDefault();
|
|
91
87
|
|
|
92
88
|
if (['top', 'bottom'].includes(bannerPosition)) {
|
|
93
89
|
bannerRef.current.focusOnWrapper();
|
|
94
90
|
} else {
|
|
95
|
-
var _ref$current;
|
|
96
|
-
|
|
97
91
|
const last = ref.current.getMessagesInView().pop();
|
|
98
|
-
|
|
92
|
+
ref.current?.focusToIndexWithoutScroll(last);
|
|
99
93
|
}
|
|
100
94
|
}
|
|
101
95
|
}
|
|
102
96
|
}
|
|
103
|
-
}, [actionRef, onComposerKeyDown, bannerPosition,
|
|
97
|
+
}, [actionRef, onComposerKeyDown, bannerPosition, messagesListProps.messages?.length]); // Map actions
|
|
104
98
|
|
|
105
99
|
React__default["default"].useEffect(() => {
|
|
106
100
|
if (actionRef && actionRef.current) {
|
|
@@ -137,17 +131,17 @@ const ChatContainer = props => {
|
|
|
137
131
|
isLoading: bannerPosition
|
|
138
132
|
}, void 0, /*#__PURE__*/_jsx__default["default"](DSBanner__default["default"], {
|
|
139
133
|
showCloseButton: true,
|
|
140
|
-
label:
|
|
134
|
+
label: bannerProps?.label || 'Unread messages',
|
|
141
135
|
containerProps: {
|
|
142
136
|
id: 'ds-chat-banner'
|
|
143
137
|
},
|
|
144
138
|
actionLink: {
|
|
145
|
-
label:
|
|
146
|
-
onClick: bannerProps
|
|
139
|
+
label: bannerProps?.viewLabel || 'View',
|
|
140
|
+
onClick: bannerProps?.onView
|
|
147
141
|
},
|
|
148
|
-
onClose: bannerProps
|
|
142
|
+
onClose: bannerProps?.onClose,
|
|
149
143
|
isOpen: true,
|
|
150
|
-
type:
|
|
144
|
+
type: bannerProps?.type || DSBanner.BANNER_TYPES.INFO,
|
|
151
145
|
actionRef: bannerRef
|
|
152
146
|
})), sendingMessages && sendingMessages.length > 0 ? /*#__PURE__*/_jsx__default["default"](styled.StyledIndicatorContainer, {
|
|
153
147
|
isLoading: "bottom",
|
|
@@ -160,7 +154,7 @@ const ChatContainer = props => {
|
|
|
160
154
|
})) : null), /*#__PURE__*/jsxRuntime.jsx(ChatContainerComposer.ChatComposer, _objectSpread(_objectSpread({}, composerProps), {}, {
|
|
161
155
|
onKeyDown: handleTabs,
|
|
162
156
|
onResize: onResize,
|
|
163
|
-
maxHeight: (
|
|
157
|
+
maxHeight: (containerRef.current?.clientHeight || 0) / 2,
|
|
164
158
|
actionRef: actionRef || listRef
|
|
165
159
|
}))]
|
|
166
160
|
}));
|
|
@@ -18,7 +18,17 @@ const StyledChatContainerContent = /*#__PURE__*/styled__default["default"](dsGri
|
|
|
18
18
|
})(["height:100%;min-width:", "px;overflow:hidden;background:", ";position:relative;"], CONTAINER_WIDTH, props => props.theme.colors.neutral['050']);
|
|
19
19
|
const StyledIndicatorContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
20
20
|
componentId: "sc-d732wo-1"
|
|
21
|
-
})(["transition:0.4s ease-in-out;position:absolute;visibility:hidden;pointer-events:none;width:100%;padding:0 ", ";left:0;right:0;background:", ";", " ", " & div,a{font-size:13px;}"], props => !props.linear ? props.theme.space.xxs : 0, props => props.theme.colors.neutral['000'], props => props.isLoading === 'top' ?
|
|
21
|
+
})(["transition:0.4s ease-in-out;position:absolute;visibility:hidden;pointer-events:none;width:100%;padding:0 ", ";left:0;right:0;background:", ";", " ", " & div,a{font-size:13px;}"], props => !props.linear ? props.theme.space.xxs : 0, props => props.theme.colors.neutral['000'], props => props.isLoading === 'top' ? `
|
|
22
|
+
top: -41px;
|
|
23
|
+
transform: translate(0, 41px);
|
|
24
|
+
visibility: visible;
|
|
25
|
+
pointer-events: auto;
|
|
26
|
+
` : '', props => props.isLoading === 'bottom' ? `
|
|
27
|
+
bottom: -41px;
|
|
28
|
+
transform: translate(0, -41px);
|
|
29
|
+
visibility: visible;
|
|
30
|
+
pointer-events: auto;
|
|
31
|
+
` : '');
|
|
22
32
|
const MobileStyledChatContainerContent = /*#__PURE__*/styled__default["default"](StyledChatContainerContent).withConfig({
|
|
23
33
|
componentId: "sc-d732wo-2"
|
|
24
34
|
})(["", ",", "{font-size:16px;}", "{font-size:13px;}", "{background-color:#fff;box-shadow:-0 1px 3px rgba(53,60,70,0.8);}", ",", "{font-size:16px;text-align:left;}", "{font-size:13px;}", "{font-size:16px;}", "{font-size:16px;}"], styled$1.StyledTitleLeftBubble, styled$1.StyleBodyWrapper, styled$1.StyledTitleRightBubble, style.Wrapper, style.Title, style.Message, style.Time, styled$2.StyledComposerInput, StyledIndicatorContainer);
|