@elliemae/ds-chat 2.2.0-alpha.4 → 3.0.0-next.2
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 +26 -54
- package/cjs/index.d.js +2 -27
- package/cjs/index.js +44 -69
- package/cjs/parts/bubble/ChatBubble.js +64 -74
- package/cjs/parts/bubble/ChatBubbleArrow.js +79 -96
- package/cjs/parts/bubble/config/useValidateProps.js +24 -47
- package/cjs/parts/bubble/index.js +12 -38
- package/cjs/parts/bubble/props.js +48 -60
- package/cjs/parts/bubble/styled.js +48 -141
- package/cjs/parts/chat-card/ChatCard.js +39 -55
- package/cjs/parts/chat-card/config/useValidateProps.js +9 -36
- package/cjs/parts/chat-card/index.js +10 -36
- package/cjs/parts/chat-card/props.js +12 -39
- package/cjs/parts/chat-card/styled.js +36 -71
- package/cjs/parts/chat-composer/ChatContainerComposer.js +98 -92
- package/cjs/parts/chat-composer/config/useValidateProps.js +9 -36
- package/cjs/parts/chat-composer/index.js +10 -36
- package/cjs/parts/chat-composer/props.js +36 -73
- package/cjs/parts/chat-composer/styled.js +34 -102
- package/cjs/parts/chat-container/ChatContainer.js +140 -122
- package/cjs/parts/chat-container/config/useValidateProps.js +9 -36
- package/cjs/parts/chat-container/index.js +10 -36
- package/cjs/parts/chat-container/props.js +42 -85
- package/cjs/parts/chat-container/styled.js +23 -104
- package/cjs/parts/chat-container-header/ChatContainerHeader.js +30 -48
- package/cjs/parts/chat-container-header/helpers.js +25 -38
- package/cjs/parts/chat-container-header/styled.js +24 -59
- package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js +225 -163
- package/cjs/parts/chat-container-messages-list/config/useValidateProps.js +9 -36
- package/cjs/parts/chat-container-messages-list/index.js +10 -36
- package/cjs/parts/chat-container-messages-list/props.js +24 -62
- package/cjs/parts/chat-container-messages-list/styled.js +38 -100
- package/cjs/parts/chat-empty-state/ChatEmptyState.js +42 -58
- package/cjs/parts/chat-empty-state/config/useValidateProps.js +9 -36
- package/cjs/parts/chat-empty-state/props.js +12 -39
- package/cjs/parts/chat-empty-state/styled.js +21 -47
- package/cjs/parts/chat-sidebar/SideBarChat.js +81 -82
- package/cjs/parts/chat-sidebar/config/useValidateProps.js +9 -36
- package/cjs/parts/chat-sidebar/index.js +10 -36
- package/cjs/parts/chat-sidebar/props.js +30 -72
- package/cjs/parts/chat-sidebar/styled.js +20 -56
- package/cjs/parts/floating-button/FloatingButton.js +34 -47
- package/cjs/parts/floating-button/index.js +9 -28
- package/cjs/parts/floating-button/props.js +15 -42
- package/cjs/parts/floating-button/styled.js +17 -63
- package/cjs/parts/floating-container/styled.js +17 -47
- package/cjs/parts/grid-influencer/InfluencerContainer.js +21 -41
- package/cjs/parts/grid-influencer/styled.js +21 -56
- package/cjs/parts/message-delimiter/MessageDelimiter.js +39 -53
- package/cjs/parts/message-delimiter/config/useValidateProps.js +9 -36
- package/cjs/parts/message-delimiter/index.js +10 -36
- package/cjs/parts/message-delimiter/props.js +19 -44
- package/cjs/parts/message-delimiter/styled.js +24 -53
- package/cjs/parts/sidebar-button/SidebarButton.js +53 -52
- package/cjs/parts/sidebar-button/index.js +2 -20
- package/cjs/parts/sidebar-button/props.js +26 -49
- package/cjs/parts/sidebar-button/styled.js +24 -68
- package/cjs/parts/system-message/SystemMessage.js +40 -55
- package/cjs/parts/system-message/config/useValidateProps.js +9 -36
- package/cjs/parts/system-message/index.js +10 -36
- package/cjs/parts/system-message/props.js +15 -42
- package/cjs/parts/system-message/style.js +32 -75
- package/cjs/parts/tile-button/TileButton.js +68 -98
- package/cjs/parts/tile-button/config/useValidateProps.js +9 -36
- package/cjs/parts/tile-button/index.js +10 -36
- package/cjs/parts/tile-button/props.js +45 -83
- package/cjs/parts/tile-button/styled.js +77 -229
- package/cjs/prop-types.js +26 -53
- package/cjs/styled.js +14 -42
- package/esm/ChatDataTestids.js +22 -25
- package/esm/index.d.js +1 -2
- package/esm/index.js +14 -40
- package/esm/parts/bubble/ChatBubble.js +51 -51
- package/esm/parts/bubble/ChatBubbleArrow.js +71 -67
- package/esm/parts/bubble/config/useValidateProps.js +19 -17
- package/esm/parts/bubble/index.js +2 -9
- package/esm/parts/bubble/props.js +36 -30
- package/esm/parts/bubble/styled.js +32 -112
- package/esm/parts/chat-card/ChatCard.js +27 -23
- package/esm/parts/chat-card/config/useValidateProps.js +4 -6
- package/esm/parts/chat-card/index.js +1 -7
- package/esm/parts/chat-card/props.js +8 -10
- package/esm/parts/chat-card/styled.js +23 -42
- package/esm/parts/chat-composer/ChatContainerComposer.js +83 -65
- package/esm/parts/chat-composer/config/useValidateProps.js +4 -6
- package/esm/parts/chat-composer/index.js +1 -7
- package/esm/parts/chat-composer/props.js +24 -37
- package/esm/parts/chat-composer/styled.js +22 -73
- package/esm/parts/chat-container/ChatContainer.js +122 -88
- package/esm/parts/chat-container/config/useValidateProps.js +4 -6
- package/esm/parts/chat-container/index.js +1 -7
- package/esm/parts/chat-container/props.js +31 -52
- package/esm/parts/chat-container/styled.js +16 -79
- package/esm/parts/chat-container-header/ChatContainerHeader.js +21 -22
- package/esm/parts/chat-container-header/helpers.js +17 -9
- package/esm/parts/chat-container-header/styled.js +14 -30
- package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js +210 -138
- package/esm/parts/chat-container-messages-list/config/useValidateProps.js +4 -6
- package/esm/parts/chat-container-messages-list/index.js +1 -10
- package/esm/parts/chat-container-messages-list/props.js +17 -31
- package/esm/parts/chat-container-messages-list/styled.js +25 -71
- package/esm/parts/chat-empty-state/ChatEmptyState.js +29 -25
- package/esm/parts/chat-empty-state/config/useValidateProps.js +4 -6
- package/esm/parts/chat-empty-state/props.js +7 -10
- package/esm/parts/chat-empty-state/styled.js +11 -18
- package/esm/parts/chat-sidebar/SideBarChat.js +67 -50
- package/esm/parts/chat-sidebar/config/useValidateProps.js +4 -6
- package/esm/parts/chat-sidebar/index.js +1 -7
- package/esm/parts/chat-sidebar/props.js +21 -39
- package/esm/parts/chat-sidebar/styled.js +11 -27
- package/esm/parts/floating-button/FloatingButton.js +26 -18
- package/esm/parts/floating-button/index.js +1 -3
- package/esm/parts/floating-button/props.js +8 -11
- package/esm/parts/floating-button/styled.js +9 -34
- package/esm/parts/floating-container/styled.js +9 -18
- package/esm/parts/grid-influencer/InfluencerContainer.js +12 -12
- package/esm/parts/grid-influencer/styled.js +12 -27
- package/esm/parts/message-delimiter/MessageDelimiter.js +26 -20
- package/esm/parts/message-delimiter/config/useValidateProps.js +4 -6
- package/esm/parts/message-delimiter/index.js +1 -10
- package/esm/parts/message-delimiter/props.js +14 -15
- package/esm/parts/message-delimiter/styled.js +14 -24
- package/esm/parts/sidebar-button/SidebarButton.js +41 -22
- package/esm/parts/sidebar-button/index.js +1 -2
- package/esm/parts/sidebar-button/props.js +15 -18
- package/esm/parts/sidebar-button/styled.js +14 -39
- package/esm/parts/system-message/SystemMessage.js +27 -22
- package/esm/parts/system-message/config/useValidateProps.js +4 -6
- package/esm/parts/system-message/index.js +1 -7
- package/esm/parts/system-message/props.js +10 -13
- package/esm/parts/system-message/style.js +20 -46
- package/esm/parts/tile-button/TileButton.js +54 -75
- package/esm/parts/tile-button/config/useValidateProps.js +4 -6
- package/esm/parts/tile-button/index.js +1 -7
- package/esm/parts/tile-button/props.js +33 -47
- package/esm/parts/tile-button/styled.js +60 -200
- package/esm/prop-types.js +16 -19
- package/esm/styled.js +5 -13
- package/package.json +10 -10
- package/cjs/ChatDataTestids.js.map +0 -7
- package/cjs/index.d.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/parts/bubble/ChatBubble.js.map +0 -7
- package/cjs/parts/bubble/ChatBubbleArrow.js.map +0 -7
- package/cjs/parts/bubble/config/useValidateProps.js.map +0 -7
- package/cjs/parts/bubble/index.js.map +0 -7
- package/cjs/parts/bubble/props.js.map +0 -7
- package/cjs/parts/bubble/styled.js.map +0 -7
- package/cjs/parts/chat-card/ChatCard.js.map +0 -7
- package/cjs/parts/chat-card/config/useValidateProps.js.map +0 -7
- package/cjs/parts/chat-card/index.js.map +0 -7
- package/cjs/parts/chat-card/props.js.map +0 -7
- package/cjs/parts/chat-card/styled.js.map +0 -7
- package/cjs/parts/chat-composer/ChatContainerComposer.js.map +0 -7
- package/cjs/parts/chat-composer/config/useValidateProps.js.map +0 -7
- package/cjs/parts/chat-composer/index.js.map +0 -7
- package/cjs/parts/chat-composer/props.js.map +0 -7
- package/cjs/parts/chat-composer/styled.js.map +0 -7
- package/cjs/parts/chat-container/ChatContainer.js.map +0 -7
- package/cjs/parts/chat-container/config/useValidateProps.js.map +0 -7
- package/cjs/parts/chat-container/index.js.map +0 -7
- package/cjs/parts/chat-container/props.js.map +0 -7
- package/cjs/parts/chat-container/styled.js.map +0 -7
- package/cjs/parts/chat-container-header/ChatContainerHeader.js.map +0 -7
- package/cjs/parts/chat-container-header/helpers.js.map +0 -7
- package/cjs/parts/chat-container-header/styled.js.map +0 -7
- package/cjs/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +0 -7
- package/cjs/parts/chat-container-messages-list/config/useValidateProps.js.map +0 -7
- package/cjs/parts/chat-container-messages-list/index.js.map +0 -7
- package/cjs/parts/chat-container-messages-list/props.js.map +0 -7
- package/cjs/parts/chat-container-messages-list/styled.js.map +0 -7
- package/cjs/parts/chat-empty-state/ChatEmptyState.js.map +0 -7
- package/cjs/parts/chat-empty-state/config/useValidateProps.js.map +0 -7
- package/cjs/parts/chat-empty-state/props.js.map +0 -7
- package/cjs/parts/chat-empty-state/styled.js.map +0 -7
- package/cjs/parts/chat-sidebar/SideBarChat.js.map +0 -7
- package/cjs/parts/chat-sidebar/config/useValidateProps.js.map +0 -7
- package/cjs/parts/chat-sidebar/index.js.map +0 -7
- package/cjs/parts/chat-sidebar/props.js.map +0 -7
- package/cjs/parts/chat-sidebar/styled.js.map +0 -7
- package/cjs/parts/floating-button/FloatingButton.js.map +0 -7
- package/cjs/parts/floating-button/index.js.map +0 -7
- package/cjs/parts/floating-button/props.js.map +0 -7
- package/cjs/parts/floating-button/styled.js.map +0 -7
- package/cjs/parts/floating-container/styled.js.map +0 -7
- package/cjs/parts/grid-influencer/InfluencerContainer.js.map +0 -7
- package/cjs/parts/grid-influencer/styled.js.map +0 -7
- package/cjs/parts/message-delimiter/MessageDelimiter.js.map +0 -7
- package/cjs/parts/message-delimiter/config/useValidateProps.js.map +0 -7
- package/cjs/parts/message-delimiter/index.js.map +0 -7
- package/cjs/parts/message-delimiter/props.js.map +0 -7
- package/cjs/parts/message-delimiter/styled.js.map +0 -7
- package/cjs/parts/sidebar-button/SidebarButton.js.map +0 -7
- package/cjs/parts/sidebar-button/index.js.map +0 -7
- package/cjs/parts/sidebar-button/props.js.map +0 -7
- package/cjs/parts/sidebar-button/styled.js.map +0 -7
- package/cjs/parts/system-message/SystemMessage.js.map +0 -7
- package/cjs/parts/system-message/config/useValidateProps.js.map +0 -7
- package/cjs/parts/system-message/index.js.map +0 -7
- package/cjs/parts/system-message/props.js.map +0 -7
- package/cjs/parts/system-message/style.js.map +0 -7
- package/cjs/parts/tile-button/TileButton.js.map +0 -7
- package/cjs/parts/tile-button/config/useValidateProps.js.map +0 -7
- package/cjs/parts/tile-button/index.js.map +0 -7
- package/cjs/parts/tile-button/props.js.map +0 -7
- package/cjs/parts/tile-button/styled.js.map +0 -7
- package/cjs/prop-types.js.map +0 -7
- package/cjs/styled.js.map +0 -7
- package/cjs/tests/utils.js +0 -66
- package/cjs/tests/utils.js.map +0 -7
- package/esm/ChatDataTestids.js.map +0 -7
- package/esm/index.d.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/parts/bubble/ChatBubble.js.map +0 -7
- package/esm/parts/bubble/ChatBubbleArrow.js.map +0 -7
- package/esm/parts/bubble/config/useValidateProps.js.map +0 -7
- package/esm/parts/bubble/index.js.map +0 -7
- package/esm/parts/bubble/props.js.map +0 -7
- package/esm/parts/bubble/styled.js.map +0 -7
- package/esm/parts/chat-card/ChatCard.js.map +0 -7
- package/esm/parts/chat-card/config/useValidateProps.js.map +0 -7
- package/esm/parts/chat-card/index.js.map +0 -7
- package/esm/parts/chat-card/props.js.map +0 -7
- package/esm/parts/chat-card/styled.js.map +0 -7
- package/esm/parts/chat-composer/ChatContainerComposer.js.map +0 -7
- package/esm/parts/chat-composer/config/useValidateProps.js.map +0 -7
- package/esm/parts/chat-composer/index.js.map +0 -7
- package/esm/parts/chat-composer/props.js.map +0 -7
- package/esm/parts/chat-composer/styled.js.map +0 -7
- package/esm/parts/chat-container/ChatContainer.js.map +0 -7
- package/esm/parts/chat-container/config/useValidateProps.js.map +0 -7
- package/esm/parts/chat-container/index.js.map +0 -7
- package/esm/parts/chat-container/props.js.map +0 -7
- package/esm/parts/chat-container/styled.js.map +0 -7
- package/esm/parts/chat-container-header/ChatContainerHeader.js.map +0 -7
- package/esm/parts/chat-container-header/helpers.js.map +0 -7
- package/esm/parts/chat-container-header/styled.js.map +0 -7
- package/esm/parts/chat-container-messages-list/ChatContainerMessagesList.js.map +0 -7
- package/esm/parts/chat-container-messages-list/config/useValidateProps.js.map +0 -7
- package/esm/parts/chat-container-messages-list/index.js.map +0 -7
- package/esm/parts/chat-container-messages-list/props.js.map +0 -7
- package/esm/parts/chat-container-messages-list/styled.js.map +0 -7
- package/esm/parts/chat-empty-state/ChatEmptyState.js.map +0 -7
- package/esm/parts/chat-empty-state/config/useValidateProps.js.map +0 -7
- package/esm/parts/chat-empty-state/props.js.map +0 -7
- package/esm/parts/chat-empty-state/styled.js.map +0 -7
- package/esm/parts/chat-sidebar/SideBarChat.js.map +0 -7
- package/esm/parts/chat-sidebar/config/useValidateProps.js.map +0 -7
- package/esm/parts/chat-sidebar/index.js.map +0 -7
- package/esm/parts/chat-sidebar/props.js.map +0 -7
- package/esm/parts/chat-sidebar/styled.js.map +0 -7
- package/esm/parts/floating-button/FloatingButton.js.map +0 -7
- package/esm/parts/floating-button/index.js.map +0 -7
- package/esm/parts/floating-button/props.js.map +0 -7
- package/esm/parts/floating-button/styled.js.map +0 -7
- package/esm/parts/floating-container/styled.js.map +0 -7
- package/esm/parts/grid-influencer/InfluencerContainer.js.map +0 -7
- package/esm/parts/grid-influencer/styled.js.map +0 -7
- package/esm/parts/message-delimiter/MessageDelimiter.js.map +0 -7
- package/esm/parts/message-delimiter/config/useValidateProps.js.map +0 -7
- package/esm/parts/message-delimiter/index.js.map +0 -7
- package/esm/parts/message-delimiter/props.js.map +0 -7
- package/esm/parts/message-delimiter/styled.js.map +0 -7
- package/esm/parts/sidebar-button/SidebarButton.js.map +0 -7
- package/esm/parts/sidebar-button/index.js.map +0 -7
- package/esm/parts/sidebar-button/props.js.map +0 -7
- package/esm/parts/sidebar-button/styled.js.map +0 -7
- package/esm/parts/system-message/SystemMessage.js.map +0 -7
- package/esm/parts/system-message/config/useValidateProps.js.map +0 -7
- package/esm/parts/system-message/index.js.map +0 -7
- package/esm/parts/system-message/props.js.map +0 -7
- package/esm/parts/system-message/style.js.map +0 -7
- package/esm/parts/tile-button/TileButton.js.map +0 -7
- package/esm/parts/tile-button/config/useValidateProps.js.map +0 -7
- package/esm/parts/tile-button/index.js.map +0 -7
- package/esm/parts/tile-button/props.js.map +0 -7
- package/esm/parts/tile-button/styled.js.map +0 -7
- package/esm/prop-types.js.map +0 -7
- package/esm/styled.js.map +0 -7
- package/esm/tests/utils.js +0 -37
- package/esm/tests/utils.js.map +0 -7
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { PropTypes } from 'react-desc';
|
|
2
|
+
|
|
3
3
|
const propTypes = {
|
|
4
|
-
title: PropTypes.string.isRequired.description(
|
|
5
|
-
content: PropTypes.string.description(
|
|
6
|
-
time: PropTypes.string.description(
|
|
7
|
-
rightAddon: PropTypes.element.description(
|
|
4
|
+
title: PropTypes.string.isRequired.description("Card's title"),
|
|
5
|
+
content: PropTypes.string.description("Card's content"),
|
|
6
|
+
time: PropTypes.string.description('Time'),
|
|
7
|
+
rightAddon: PropTypes.element.description('Right addon, badge or icon')
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=props.js.map
|
|
9
|
+
|
|
10
|
+
export { propTypes };
|
|
@@ -1,42 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const Wrapper = styled(Grid)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
font-weight: 100;
|
|
25
|
-
margin: 0;
|
|
26
|
-
margin-top: 8px;
|
|
27
|
-
font-weight: ${(props) => props.theme.fontWeights.regular};
|
|
28
|
-
color: ${(props) => props.theme.colors.neutral["500"]};
|
|
29
|
-
`;
|
|
30
|
-
const RightAddon = styled.div`
|
|
31
|
-
height: fit-content;
|
|
32
|
-
margin-left: 12px;
|
|
33
|
-
`;
|
|
34
|
-
export {
|
|
35
|
-
Content,
|
|
36
|
-
MainContent,
|
|
37
|
-
RightAddon,
|
|
38
|
-
Time,
|
|
39
|
-
Title,
|
|
40
|
-
Wrapper
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=styled.js.map
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Grid } from '@elliemae/ds-grid';
|
|
3
|
+
|
|
4
|
+
const Wrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
5
|
+
componentId: "sc-s0g4hn-0"
|
|
6
|
+
})(["min-width:248px;border:1px;border-bottom:1px solid #ccc;padding:12px 12px;"]);
|
|
7
|
+
const MainContent = /*#__PURE__*/styled.div.withConfig({
|
|
8
|
+
componentId: "sc-s0g4hn-1"
|
|
9
|
+
})([""]);
|
|
10
|
+
const Title = /*#__PURE__*/styled.p.withConfig({
|
|
11
|
+
componentId: "sc-s0g4hn-2"
|
|
12
|
+
})(["font-size:16px;font-weight:600;margin:0;"]);
|
|
13
|
+
const Content = /*#__PURE__*/styled.p.withConfig({
|
|
14
|
+
componentId: "sc-s0g4hn-3"
|
|
15
|
+
})(["font-size:12px;font-weight:400;line-height:1;margin:0;"]);
|
|
16
|
+
const Time = /*#__PURE__*/styled.p.withConfig({
|
|
17
|
+
componentId: "sc-s0g4hn-4"
|
|
18
|
+
})(["font-size:12px;font-weight:100;margin:0;margin-top:8px;font-weight:", ";color:", ";"], props => props.theme.fontWeights.regular, props => props.theme.colors.neutral['500']);
|
|
19
|
+
const RightAddon = /*#__PURE__*/styled.div.withConfig({
|
|
20
|
+
componentId: "sc-s0g4hn-5"
|
|
21
|
+
})(["height:fit-content;margin-left:12px;"]);
|
|
22
|
+
|
|
23
|
+
export { Content, MainContent, RightAddon, Time, Title, Wrapper };
|
|
@@ -1,18 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
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';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { Grid } from '@elliemae/ds-grid';
|
|
12
|
+
import { describe } from 'react-desc';
|
|
13
|
+
import { PaperAirplane } from '@elliemae/ds-icons';
|
|
14
|
+
import { StyledChatContainerContentComposer, StyledComposerInput, StyledComposerButton, StyledCounterArea, StyledCounterErrorA11y } from './styled.js';
|
|
15
|
+
import { useValidateProps } from './config/useValidateProps.js';
|
|
16
|
+
import { composerProps, defaultComposerPros } from './props.js';
|
|
17
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
18
|
+
|
|
19
|
+
var _PaperAirplane, _Grid;
|
|
20
|
+
|
|
21
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
+
|
|
23
|
+
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(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; }
|
|
24
|
+
|
|
25
|
+
const ChatComposer = props => {
|
|
26
|
+
var _input$current;
|
|
27
|
+
|
|
16
28
|
useValidateProps(props, ChatComposerWithSchema.toJSON());
|
|
17
29
|
const {
|
|
18
30
|
inputValue,
|
|
@@ -31,104 +43,110 @@ const ChatComposer = (props) => {
|
|
|
31
43
|
actionRef
|
|
32
44
|
} = props;
|
|
33
45
|
const COMPOSER_MIN_HEIGHT = 32;
|
|
34
|
-
const input =
|
|
35
|
-
const inputSize =
|
|
36
|
-
const inputSend =
|
|
37
|
-
const [height, setHeight] =
|
|
38
|
-
const internalMaxHeight =
|
|
39
|
-
const [showScroll, setShowScroll] =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
const input = React.useRef();
|
|
47
|
+
const inputSize = React.useRef();
|
|
48
|
+
const inputSend = React.useRef();
|
|
49
|
+
const [height, setHeight] = React.useState(32);
|
|
50
|
+
const internalMaxHeight = React.useMemo(() => maxHeight - 24, [maxHeight]);
|
|
51
|
+
const [showScroll, setShowScroll] = React.useState(true);
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
var _inputSize$current, _inputSize$current2, _inputSize$current3, _inputSize$current4;
|
|
54
|
+
|
|
55
|
+
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;
|
|
56
|
+
if (newHeight !== height && newHeight > COMPOSER_MIN_HEIGHT) onResize(newHeight);
|
|
44
57
|
setHeight(newHeight);
|
|
45
|
-
setShowScroll(inputSize.current
|
|
58
|
+
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);
|
|
46
59
|
}, [inputValue, internalMaxHeight, height, onResize]);
|
|
47
|
-
|
|
60
|
+
React.useEffect(() => {
|
|
48
61
|
if (actionRef && actionRef.current) {
|
|
49
62
|
actionRef.current.focusToComposer = () => {
|
|
50
63
|
input.current.focus();
|
|
51
64
|
};
|
|
65
|
+
|
|
52
66
|
actionRef.current.focusToSend = () => {
|
|
53
67
|
inputSend.current.focus();
|
|
54
68
|
};
|
|
55
69
|
}
|
|
56
70
|
}, [actionRef]);
|
|
57
|
-
const handleChange =
|
|
71
|
+
const handleChange = React.useCallback(e => {
|
|
58
72
|
onChange(e.target.value);
|
|
59
73
|
}, [onChange]);
|
|
60
|
-
const heightProps = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
const heightProps = {
|
|
75
|
+
height,
|
|
76
|
+
overflow: showScroll ? 'auto' : 'hidden'
|
|
77
|
+
};
|
|
78
|
+
const inputLength = String(inputValue || '').length;
|
|
79
|
+
const hasError = React.useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);
|
|
80
|
+
return /*#__PURE__*/_jsx(StyledChatContainerContentComposer, {
|
|
81
|
+
rows: ['auto', '15px'],
|
|
82
|
+
maxHeight: "".concat(maxHeight, "px"),
|
|
66
83
|
"data-testid": dataTestid
|
|
67
|
-
},
|
|
68
|
-
cols: [
|
|
69
|
-
style: {
|
|
84
|
+
}, void 0, /*#__PURE__*/_jsx(Grid, {
|
|
85
|
+
cols: ['1fr', '24px'],
|
|
86
|
+
style: {
|
|
87
|
+
height: heightProps.height
|
|
88
|
+
},
|
|
70
89
|
justifyContent: "center",
|
|
71
90
|
alignItems: "flex-end",
|
|
72
91
|
gutter: "xxs"
|
|
73
|
-
},
|
|
92
|
+
}, void 0, /*#__PURE__*/jsx(StyledComposerInput, {
|
|
74
93
|
ref: input,
|
|
75
94
|
onChange: handleChange,
|
|
76
|
-
style: {
|
|
95
|
+
style: _objectSpread({}, heightProps),
|
|
77
96
|
value: inputValue,
|
|
78
|
-
onFocus,
|
|
79
|
-
onBlur,
|
|
80
|
-
onKeyDown,
|
|
81
|
-
placeholder,
|
|
97
|
+
onFocus: onFocus,
|
|
98
|
+
onBlur: onBlur,
|
|
99
|
+
onKeyDown: onKeyDown,
|
|
100
|
+
placeholder: placeholder,
|
|
82
101
|
"aria-label": "Message to send",
|
|
83
102
|
"data-testid": "chat-composer-textarea",
|
|
84
103
|
name: "chat-composer-textarea",
|
|
85
104
|
id: "chat-composer-textarea"
|
|
86
|
-
}),
|
|
105
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
87
106
|
height: "32px",
|
|
88
107
|
alignItems: "center"
|
|
89
|
-
},
|
|
108
|
+
}, void 0, /*#__PURE__*/_jsx(StyledComposerButton, {
|
|
90
109
|
buttonType: "text",
|
|
91
|
-
icon:
|
|
110
|
+
icon: _PaperAirplane || (_PaperAirplane = /*#__PURE__*/_jsx(PaperAirplane, {
|
|
92
111
|
width: 18,
|
|
93
112
|
height: 18
|
|
94
|
-
}),
|
|
113
|
+
})),
|
|
95
114
|
onClick: onSend,
|
|
96
115
|
size: "s",
|
|
97
116
|
disabled: !inputValue || buttonDisabled || hasError,
|
|
98
117
|
"data-testid": "chat-composer-send-button",
|
|
99
118
|
"aria-label": "Send",
|
|
100
119
|
innerRef: inputSend
|
|
101
|
-
}))),
|
|
120
|
+
}))), /*#__PURE__*/jsx(StyledComposerInput, {
|
|
102
121
|
ref: inputSize,
|
|
103
122
|
style: {
|
|
104
123
|
height: 32,
|
|
105
|
-
visibility:
|
|
106
|
-
pointerEvents:
|
|
107
|
-
position:
|
|
124
|
+
visibility: 'hidden',
|
|
125
|
+
pointerEvents: 'none',
|
|
126
|
+
position: 'absolute',
|
|
108
127
|
top: 0,
|
|
109
|
-
width: input.current
|
|
128
|
+
width: (_input$current = input.current) === null || _input$current === void 0 ? void 0 : _input$current.clientWidth
|
|
110
129
|
},
|
|
111
130
|
onChange: handleChange,
|
|
112
131
|
value: inputValue
|
|
113
|
-
}),
|
|
114
|
-
cols: [
|
|
132
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
133
|
+
cols: ['1fr', '24px'],
|
|
115
134
|
justifyContent: "flex-end",
|
|
116
135
|
alignItems: "center",
|
|
117
136
|
gutter: "xxs",
|
|
118
137
|
pb: "xxs"
|
|
119
|
-
},
|
|
120
|
-
hasError,
|
|
138
|
+
}, void 0, /*#__PURE__*/_jsx(StyledCounterArea, {
|
|
139
|
+
hasError: hasError,
|
|
121
140
|
"data-testid": "composer-counter-area"
|
|
122
|
-
}, inputMaxLength && hasError ?
|
|
123
|
-
|
|
124
|
-
|
|
141
|
+
}, void 0, inputMaxLength && hasError ? /*#__PURE__*/jsxs(Fragment, {
|
|
142
|
+
children: [/*#__PURE__*/_jsx(StyledCounterErrorA11y, {
|
|
143
|
+
role: "alert"
|
|
144
|
+
}, void 0, maxLengthMessage || "You have entered ".concat(inputLength, " characters and have exceeded the limit by ").concat(inputLength - inputMaxLength, ". Please limit to less than ").concat(inputMaxLength, " characters. ")), maxLengthMessage || "Please limit to less than ".concat(inputMaxLength, " characters. ")]
|
|
145
|
+
}) : '', inputMaxLength && !maxLengthMessage ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), _Grid || (_Grid = /*#__PURE__*/_jsx(Grid, {}))));
|
|
125
146
|
};
|
|
126
|
-
|
|
147
|
+
|
|
127
148
|
ChatComposer.defaultProps = defaultComposerPros;
|
|
128
149
|
const ChatComposerWithSchema = describe(ChatComposer);
|
|
129
150
|
ChatComposerWithSchema.propTypes = composerProps;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
ChatComposerWithSchema
|
|
133
|
-
};
|
|
134
|
-
//# sourceMappingURL=ChatContainerComposer.js.map
|
|
151
|
+
|
|
152
|
+
export { ChatComposer, ChatComposerWithSchema };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { useValidatePropTypes } from '@elliemae/ds-props-helpers';
|
|
2
|
+
|
|
3
3
|
const useValidateProps = (props, schema) => {
|
|
4
4
|
useValidatePropTypes(props, schema);
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=useValidateProps.js.map
|
|
6
|
+
|
|
7
|
+
export { useValidateProps };
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ChatComposer, ChatComposerWithSchema } from "./ChatContainerComposer";
|
|
3
|
-
export {
|
|
4
|
-
ChatComposer,
|
|
5
|
-
ChatComposerWithSchema
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { ChatComposer, ChatComposerWithSchema } from './ChatContainerComposer.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { PropTypes } from 'react-desc';
|
|
2
|
+
import { noop } from 'lodash';
|
|
3
|
+
|
|
4
4
|
const defaultComposerPros = {
|
|
5
|
-
placeholder:
|
|
6
|
-
inputValue:
|
|
5
|
+
placeholder: 'Type your message',
|
|
6
|
+
inputValue: '',
|
|
7
7
|
onChange: noop,
|
|
8
8
|
onResize: noop,
|
|
9
9
|
onSend: noop,
|
|
@@ -11,40 +11,27 @@ const defaultComposerPros = {
|
|
|
11
11
|
onBlur: noop,
|
|
12
12
|
onKeyDown: noop,
|
|
13
13
|
maxHeight: 0,
|
|
14
|
-
inputMaxLength:
|
|
15
|
-
maxLengthMessage:
|
|
14
|
+
inputMaxLength: undefined,
|
|
15
|
+
maxLengthMessage: undefined,
|
|
16
16
|
buttonDisabled: false,
|
|
17
|
-
dataTestid:
|
|
17
|
+
dataTestid: 'ds-chat-composer',
|
|
18
18
|
actionRef: noop
|
|
19
19
|
};
|
|
20
20
|
const composerProps = {
|
|
21
|
-
placeholder: PropTypes.string.description(
|
|
22
|
-
inputValue: PropTypes.string.description(
|
|
23
|
-
maxLengthMessage: PropTypes.string.description(
|
|
24
|
-
onChange: PropTypes.func.description(
|
|
25
|
-
onResize: PropTypes.func.description(
|
|
26
|
-
onSend: PropTypes.func.description(
|
|
27
|
-
onFocus: PropTypes.func.description(
|
|
28
|
-
onBlur: PropTypes.func.description(
|
|
29
|
-
onKeyDown: PropTypes.func.description(
|
|
30
|
-
maxHeight: PropTypes.number.description(
|
|
31
|
-
inputMaxLength: PropTypes.number.description(
|
|
32
|
-
buttonDisabled: PropTypes.bool.description(
|
|
33
|
-
dataTestid: PropTypes.string.description(
|
|
34
|
-
actionRef: 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)
|
|
21
|
+
placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),
|
|
22
|
+
inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),
|
|
23
|
+
maxLengthMessage: PropTypes.string.description('Max length message').defaultValue(defaultComposerPros.maxLengthMessage),
|
|
24
|
+
onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),
|
|
25
|
+
onResize: PropTypes.func.description('Called the input changes his height').defaultValue(defaultComposerPros.onResize),
|
|
26
|
+
onSend: PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),
|
|
27
|
+
onFocus: PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),
|
|
28
|
+
onBlur: PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),
|
|
29
|
+
onKeyDown: PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),
|
|
30
|
+
maxHeight: PropTypes.number.description('Max height of the composer. Use 0 for no limit').defaultValue(defaultComposerPros.onBlur),
|
|
31
|
+
inputMaxLength: PropTypes.number.description('Max length of the composer. `undefined` for no limit').defaultValue(defaultComposerPros.inputMaxLength),
|
|
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)
|
|
45
35
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
defaultComposerPros
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=props.js.map
|
|
36
|
+
|
|
37
|
+
export { composerProps, defaultComposerPros };
|
|
@@ -1,73 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height};
|
|
24
|
-
min-width: 244px;
|
|
25
|
-
overflow-y: auto;
|
|
26
|
-
font-size: 13px;
|
|
27
|
-
font-weight: 400;
|
|
28
|
-
line-height: 1;
|
|
29
|
-
transition: height 0.05s;
|
|
30
|
-
&:focus {
|
|
31
|
-
outline: none;
|
|
32
|
-
border: 1px solid ${(props) => props.theme.colors.brand[600]};
|
|
33
|
-
box-shadow: inset 0 0 0 1px #8cc2ed;
|
|
34
|
-
border-radius: 2px;
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
const StyledComposerButton = styled(DSButton)`
|
|
38
|
-
&:disabled {
|
|
39
|
-
background: none;
|
|
40
|
-
svg {
|
|
41
|
-
fill: #5d6775;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
svg {
|
|
45
|
-
fill: ${(props) => props.theme.colors.brand[600]};
|
|
46
|
-
}
|
|
47
|
-
&:focus {
|
|
48
|
-
background: ${(props) => props.theme.colors.brand[200]};
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
const StyledCounterArea = styled(Grid)`
|
|
52
|
-
text-align: right;
|
|
53
|
-
font-size: 11px;
|
|
54
|
-
height: 15px;
|
|
55
|
-
align-items: center;
|
|
56
|
-
font-style: italic;
|
|
57
|
-
${(props) => props.hasError ? `color:${props.theme.colors.danger[900]};` : ""}
|
|
58
|
-
position:relative;
|
|
59
|
-
`;
|
|
60
|
-
const StyledCounterErrorA11y = styled.span`
|
|
61
|
-
width: 1px;
|
|
62
|
-
height: 1px;
|
|
63
|
-
position: absolute;
|
|
64
|
-
clip: rect(1px, 1px, 1px, 1px);
|
|
65
|
-
`;
|
|
66
|
-
export {
|
|
67
|
-
StyledChatContainerContentComposer,
|
|
68
|
-
StyledComposerButton,
|
|
69
|
-
StyledComposerInput,
|
|
70
|
-
StyledCounterArea,
|
|
71
|
-
StyledCounterErrorA11y
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=styled.js.map
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Grid } from '@elliemae/ds-grid';
|
|
3
|
+
import { DSButton } from '@elliemae/ds-button';
|
|
4
|
+
|
|
5
|
+
// Composer
|
|
6
|
+
const StyledChatContainerContentComposer = /*#__PURE__*/styled(Grid).withConfig({
|
|
7
|
+
componentId: "sc-1ahwpce-0"
|
|
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
|
+
const StyledComposerInput = /*#__PURE__*/styled.textarea.withConfig({
|
|
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.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
|
+
const StyledComposerButton = /*#__PURE__*/styled(DSButton).withConfig({
|
|
13
|
+
componentId: "sc-1ahwpce-2"
|
|
14
|
+
})(["&:disabled{background:none;svg{fill:#5d6775;}}svg{fill:", ";}&:focus{background:", ";}"], props => props.theme.colors.brand[600], props => props.theme.colors.brand[200]);
|
|
15
|
+
const StyledCounterArea = /*#__PURE__*/styled(Grid).withConfig({
|
|
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 ? "color:".concat(props.theme.colors.danger[900], ";") : '');
|
|
18
|
+
const StyledCounterErrorA11y = /*#__PURE__*/styled.span.withConfig({
|
|
19
|
+
componentId: "sc-1ahwpce-4"
|
|
20
|
+
})(["width:1px;height:1px;position:absolute;clip:rect(1px,1px,1px,1px);"]);
|
|
21
|
+
|
|
22
|
+
export { StyledChatContainerContentComposer, StyledComposerButton, StyledComposerInput, StyledCounterArea, StyledCounterErrorA11y };
|