beem-component 1.1.6 → 1.1.7
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/.storybook/preview.js +2 -1
- package/dist/assets/css/{sidebar.css → sidebar.scss} +0 -0
- package/dist/components/ChatComponents/ChatBody/chatBody.js +265 -0
- package/dist/components/{ChatBody → ChatComponents/ChatBody}/chatBody.stories.js +42 -11
- package/dist/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.js +0 -0
- package/dist/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.stories.js +8 -4
- package/dist/components/ChatComponents/ColorPicker/colorPicker.stories.js +26 -0
- package/dist/components/ChatComponents/FormAccordion/FormAccordion.stories.js +25 -0
- package/dist/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +27 -0
- package/dist/components/index.js +2 -2
- package/package.json +2 -1
- package/src/App.js +1 -25
- package/src/Chat.js +10 -5
- package/src/ChatHeader.js +1 -1
- package/src/lib/assets/css/{sidebar.css → sidebar.scss} +0 -0
- package/src/lib/components/ChatComponents/ChatBody/chatBody.js +279 -0
- package/src/lib/components/ChatComponents/ChatBody/chatBody.stories.js +81 -0
- package/src/lib/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.js +0 -0
- package/src/lib/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.stories.js +6 -3
- package/src/lib/components/ChatComponents/ColorPicker/colorPicker.stories.js +17 -0
- package/src/lib/components/ChatComponents/FormAccordion/FormAccordion.stories.js +33 -0
- package/src/lib/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +36 -0
- package/src/lib/components/index.js +2 -2
- package/dist/components/ChatBody/chatBody.js +0 -144
- package/src/lib/components/ChatBody/chatBody.js +0 -147
- package/src/lib/components/ChatBody/chatBody.stories.js +0 -48
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Done, DoneAll } from "@material-ui/icons";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import BmAvatar from "../Avatars/avatars";
|
|
5
|
-
import { BmIcons } from "../iconStyles";
|
|
6
|
-
import {
|
|
7
|
-
BmGrey400,
|
|
8
|
-
BmPrimaryWhite,
|
|
9
|
-
BmPrimaryBlue,
|
|
10
|
-
BmPrimaryBlack,
|
|
11
|
-
BmSecondaryDarkGreen,
|
|
12
|
-
} from "../colors";
|
|
13
|
-
|
|
14
|
-
const BmChat = styled.div`
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
height: 100%;
|
|
18
|
-
${"" /* border: 0.071rem solid ${BmGrey400}; */}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
BmChat.Body = styled.div`
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
padding: 0rem 1.5rem;
|
|
25
|
-
flex-grow: 1;
|
|
26
|
-
overflow: auto;
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
const Details = styled.div`
|
|
30
|
-
display: flex;
|
|
31
|
-
${"" /* align-items: center; */}
|
|
32
|
-
justify-content: ${({ state }) => {
|
|
33
|
-
if (state === "inbound") {
|
|
34
|
-
return "flex-start";
|
|
35
|
-
}
|
|
36
|
-
if (state === "outbound") {
|
|
37
|
-
return "flex-end";
|
|
38
|
-
}
|
|
39
|
-
return "row";
|
|
40
|
-
}};
|
|
41
|
-
> *:not(:last-child) {
|
|
42
|
-
margin-right: 1rem;
|
|
43
|
-
}
|
|
44
|
-
overflow-wrap: break-word !important;
|
|
45
|
-
word-wrap: break-word !important;
|
|
46
|
-
margin: 0rem;
|
|
47
|
-
flex-grow: 1;
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
const MessageDetails = styled.div`
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
max-width: 50%;
|
|
54
|
-
> * {
|
|
55
|
-
margin-top: 0.5rem;
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
const Messages = styled.div`
|
|
60
|
-
display: flex;
|
|
61
|
-
flex-direction: row;
|
|
62
|
-
align-items: center;
|
|
63
|
-
padding: 1.143rem;
|
|
64
|
-
background: ${({ state }) => {
|
|
65
|
-
if (state) {
|
|
66
|
-
if (state === "inbound") return `${BmPrimaryWhite}`;
|
|
67
|
-
if (state === "outbound") return `${BmPrimaryBlue}`;
|
|
68
|
-
}
|
|
69
|
-
return `${BmPrimaryWhite}`;
|
|
70
|
-
}};
|
|
71
|
-
color: ${({ state }) => {
|
|
72
|
-
if (state) {
|
|
73
|
-
if (state === "inbound") return `${BmPrimaryBlack}`;
|
|
74
|
-
if (state === "outbound") return `${BmPrimaryWhite}`;
|
|
75
|
-
}
|
|
76
|
-
return `${BmPrimaryWhite}`;
|
|
77
|
-
}};
|
|
78
|
-
border-radius: ${({ state }) => {
|
|
79
|
-
if (state) {
|
|
80
|
-
if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
|
|
81
|
-
if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
|
|
82
|
-
}
|
|
83
|
-
return `${BmPrimaryWhite}`;
|
|
84
|
-
}};
|
|
85
|
-
border: 0.071rem solid ${BmGrey400};
|
|
86
|
-
word-break: break-all;
|
|
87
|
-
margin: 0rem;
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
|
-
const MessagesSubDetails = styled.div`
|
|
91
|
-
display: flex;
|
|
92
|
-
flex-direction: row;
|
|
93
|
-
align-items: center;
|
|
94
|
-
> *:not(:last-child) {
|
|
95
|
-
margin-right: 0.5rem;
|
|
96
|
-
}
|
|
97
|
-
margin-top: 0.5rem;
|
|
98
|
-
`;
|
|
99
|
-
|
|
100
|
-
const handleState = ({ session }) => {
|
|
101
|
-
if (session === "bot") {
|
|
102
|
-
return <BmAvatar size="small" user="chatbot" />;
|
|
103
|
-
}
|
|
104
|
-
if (session === "live") {
|
|
105
|
-
return <BmAvatar size="small" user="employee" />;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
BmChat.Details = ({
|
|
110
|
-
children,
|
|
111
|
-
state,
|
|
112
|
-
displayTime,
|
|
113
|
-
status,
|
|
114
|
-
session,
|
|
115
|
-
...rest
|
|
116
|
-
}) => {
|
|
117
|
-
return (
|
|
118
|
-
<Details state={state} {...rest}>
|
|
119
|
-
{state === "inbound" && session && handleState({ state, session })}
|
|
120
|
-
<MessageDetails>
|
|
121
|
-
<Messages state={state}>{children}</Messages>
|
|
122
|
-
<MessagesSubDetails>
|
|
123
|
-
{displayTime && displayTime}
|
|
124
|
-
{status === "sent" && (
|
|
125
|
-
<BmIcons icon={<DoneAll />} color={`${BmSecondaryDarkGreen}`} size="small" />
|
|
126
|
-
)}
|
|
127
|
-
{status === "failed" && <BmIcons icon={<Done />} color={`${BmPrimaryBlack}`} size="small" />}
|
|
128
|
-
</MessagesSubDetails>
|
|
129
|
-
</MessageDetails>
|
|
130
|
-
{state === "outbound" && session && handleState({ state, session })}
|
|
131
|
-
</Details>
|
|
132
|
-
);
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
BmChat.Footer = styled.div`
|
|
136
|
-
display: flex;
|
|
137
|
-
flex-direction: column;
|
|
138
|
-
${'' /* border-top: 0.071rem solid ${BmGrey200}; */}
|
|
139
|
-
padding: 0.5rem 0.5rem;
|
|
140
|
-
${'' /* align-items: center; */}
|
|
141
|
-
${'' /* justify-content: center; */}
|
|
142
|
-
> *:not(:last-child) {
|
|
143
|
-
margin-bottom: 0.5rem;
|
|
144
|
-
}
|
|
145
|
-
`;
|
|
146
|
-
|
|
147
|
-
export default BmChat;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import React from "react";
|
|
3
|
-
import BmChat from "./chatBody";
|
|
4
|
-
import { BmIcons } from "../iconStyles";
|
|
5
|
-
import EmojiEmotionsIcon from "@mui/icons-material/EmojiEmotions";
|
|
6
|
-
import AttachFileIcon from "@mui/icons-material/AttachFile";
|
|
7
|
-
import QuickreplyIcon from "@mui/icons-material/Quickreply";
|
|
8
|
-
import SendIcon from "@mui/icons-material/Send";
|
|
9
|
-
import BmAvatar from "../Avatars/avatars";
|
|
10
|
-
import { DoneAll } from "@material-ui/icons";
|
|
11
|
-
import { BmInput } from "../input";
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
component: BmChat,
|
|
15
|
-
title: "components/Chat/ChatBody",
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const ChatBody = () => {
|
|
19
|
-
return (
|
|
20
|
-
<BmChat>
|
|
21
|
-
<BmChat.Body>
|
|
22
|
-
<BmChat.Details
|
|
23
|
-
state="inbound"
|
|
24
|
-
session="bot"
|
|
25
|
-
displayTime={<p>12:00pm</p>}
|
|
26
|
-
status="sent"
|
|
27
|
-
>
|
|
28
|
-
<p>Inbound</p>
|
|
29
|
-
</BmChat.Details>
|
|
30
|
-
<BmChat.Details
|
|
31
|
-
state="outbound"
|
|
32
|
-
session="live"
|
|
33
|
-
displayTime={<p>10:00am</p>}
|
|
34
|
-
status="failed"
|
|
35
|
-
>
|
|
36
|
-
<p>Outbound</p>
|
|
37
|
-
</BmChat.Details>
|
|
38
|
-
</BmChat.Body>
|
|
39
|
-
<BmChat.Footer>
|
|
40
|
-
<BmIcons icon={<EmojiEmotionsIcon />} size="xlarge" />
|
|
41
|
-
<BmIcons icon={<AttachFileIcon />} size="xlarge" />
|
|
42
|
-
<BmIcons icon={<QuickreplyIcon />} size="xlarge" />
|
|
43
|
-
<BmInput placeholder="Enter Message" />
|
|
44
|
-
<BmIcons icon={<SendIcon />} size="xlarge" />
|
|
45
|
-
</BmChat.Footer>
|
|
46
|
-
</BmChat>
|
|
47
|
-
);
|
|
48
|
-
};
|