beem-component 1.1.5 → 1.1.9
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} +12 -5
- 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.js +20 -0
- package/dist/components/ChatComponents/ColorPicker/colorPicker.stories.js +26 -0
- package/dist/components/{ContactCards → ChatComponents/ContactCards}/contactCards.js +3 -3
- package/dist/components/{ContactCards → ChatComponents/ContactCards}/contactCards.stories.js +4 -4
- package/dist/components/ChatComponents/FormAccordion/FormAccordion.js +22 -0
- package/dist/components/ChatComponents/FormAccordion/FormAccordion.stories.js +29 -0
- package/dist/components/{InfoTab → ChatComponents/InfoTab}/infoTab.js +0 -1
- package/dist/components/{InfoTab → ChatComponents/InfoTab}/infoTab.stories.js +3 -5
- package/dist/components/ChatComponents/LabelAccordion/LabelAccordion.js +19 -0
- package/dist/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +31 -0
- package/dist/components/ChatComponents/NoteAccordion/NoteAccordion.js +23 -0
- package/dist/components/ChatComponents/NoteAccordion/NoteAccordion.stories.js +43 -0
- package/dist/components/Modals/modal.js +8 -1
- package/dist/components/colors.js +5 -2
- package/dist/components/index.js +35 -11
- package/package.json +2 -1
- package/src/App.js +15 -25
- package/src/Chat.js +18 -6
- package/src/ChatHeader.js +1 -1
- package/src/InfoAccordion.js +1 -1
- package/src/lib/assets/css/{sidebar.css → sidebar.scss} +12 -5
- 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.js +11 -0
- package/src/lib/components/ChatComponents/ColorPicker/colorPicker.stories.js +17 -0
- package/src/lib/components/{ContactCards → ChatComponents/ContactCards}/contactCards.js +3 -3
- package/src/lib/components/{ContactCards → ChatComponents/ContactCards}/contactCards.stories.js +4 -4
- package/src/lib/components/{Forms/forms.js → ChatComponents/FormAccordion/FormAccordion.js} +14 -4
- package/src/lib/components/ChatComponents/FormAccordion/FormAccordion.stories.js +37 -0
- package/src/lib/components/{InfoTab → ChatComponents/InfoTab}/infoTab.js +0 -1
- package/src/lib/components/{InfoTab → ChatComponents/InfoTab}/infoTab.stories.js +3 -4
- package/src/lib/components/ChatComponents/LabelAccordion/LabelAccordion.js +18 -0
- package/src/lib/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +38 -0
- package/src/lib/components/ChatComponents/NoteAccordion/NoteAccordion.js +46 -0
- package/src/lib/components/ChatComponents/NoteAccordion/NoteAccordion.stories.js +47 -0
- package/src/lib/components/Modals/modal.js +9 -0
- package/src/lib/components/colors.js +3 -0
- package/src/lib/components/index.js +14 -9
- package/dist/components/ChatBody/chatBody.js +0 -144
- package/dist/components/Forms/forms.js +0 -21
- package/src/lib/components/ChatBody/chatBody.js +0 -147
- package/src/lib/components/ChatBody/chatBody.stories.js +0 -48
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { BmAccordion, BmChatLabels, BmChatNotes, BmIcons } from "../..";
|
|
2
|
+
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
|
|
3
|
+
import { Delete, Edit } from "@material-ui/icons";
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
6
|
+
export default {
|
|
7
|
+
component: BmChatLabels,
|
|
8
|
+
title: "components/Chat/Components/NoteAccordion",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const NoteAccordion = () => {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<div style={{ width: "30%" }}>
|
|
15
|
+
<BmAccordion>
|
|
16
|
+
<BmAccordion.Title>
|
|
17
|
+
<h3>Notes</h3>
|
|
18
|
+
</BmAccordion.Title>
|
|
19
|
+
<BmAccordion.Body>
|
|
20
|
+
<BmChatNotes>
|
|
21
|
+
<BmChatNotes.Input type="text" placeholder="Add Note" />
|
|
22
|
+
{/* Display Note */}
|
|
23
|
+
<BmChatNotes.Details>
|
|
24
|
+
<div>
|
|
25
|
+
<p>Description</p>
|
|
26
|
+
</div>
|
|
27
|
+
<div>
|
|
28
|
+
<BmIcons icon={<Edit />} size="xsmall" />
|
|
29
|
+
<BmIcons icon={<ContentCopyIcon />} size="xsmall" />
|
|
30
|
+
<BmIcons icon={<Delete />} size="xsmall" />
|
|
31
|
+
</div>
|
|
32
|
+
<div>
|
|
33
|
+
<p>
|
|
34
|
+
<i>By User</i>
|
|
35
|
+
</p>
|
|
36
|
+
<p>
|
|
37
|
+
<i>12:00pm</i>
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
</BmChatNotes.Details>
|
|
41
|
+
</BmChatNotes>
|
|
42
|
+
</BmAccordion.Body>
|
|
43
|
+
</BmAccordion>
|
|
44
|
+
</div>
|
|
45
|
+
</>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -135,6 +135,15 @@ BmModal.Body = styled.div`
|
|
|
135
135
|
display: flex;
|
|
136
136
|
flex-direction: column;
|
|
137
137
|
justify-content: space-between;
|
|
138
|
+
> *:not(:last-child) {
|
|
139
|
+
margin-bottom: 0.5rem;
|
|
140
|
+
}
|
|
141
|
+
${'' /* > * {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: row;
|
|
144
|
+
justify-content: space-between;
|
|
145
|
+
width: 100%;
|
|
146
|
+
} */}
|
|
138
147
|
`;
|
|
139
148
|
|
|
140
149
|
BmModal.Footer = styled.div`
|
|
@@ -32,6 +32,9 @@ export const BmSecondaryGreen15 = "rgba(4, 132, 75, 0.15)";
|
|
|
32
32
|
|
|
33
33
|
export const BmSecondaryGold15 = "rgba(243, 169, 41, 0.15)";
|
|
34
34
|
|
|
35
|
+
// #33B1BA 12%
|
|
36
|
+
export const BmSecondaryBlue12="rgba(51, 177, 186, 0.12)";
|
|
37
|
+
|
|
35
38
|
// Background Colors
|
|
36
39
|
export const BmBgLightBlue = "#E1EAFC";
|
|
37
40
|
|
|
@@ -32,14 +32,16 @@ import { BmNoteBar } from "./NoteBar/noteBar";
|
|
|
32
32
|
import { MainWrapper } from "../components/MainWrapper";
|
|
33
33
|
|
|
34
34
|
//Chat Components
|
|
35
|
-
import BmChat from "
|
|
36
|
-
import { BmChatHeader } from "./ChatHeader/chatHeader";
|
|
37
|
-
import BmContactCard from "./ContactCards/contactCards";
|
|
38
|
-
import BmInfoTab from "./InfoTab/infoTab";
|
|
35
|
+
import BmChat from "./ChatComponents/ChatBody/chatBody";
|
|
36
|
+
import { BmChatHeader } from "./ChatComponents/ChatHeader/chatHeader";
|
|
37
|
+
import BmContactCard from "./ChatComponents/ContactCards/contactCards";
|
|
38
|
+
import BmInfoTab from "./ChatComponents/InfoTab/infoTab";
|
|
39
39
|
import BmCounter from "./MessageCounter/messageCounter";
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
import
|
|
40
|
+
//Chat Accordion components
|
|
41
|
+
import BmChatForm from "./ChatComponents/FormAccordion/FormAccordion";
|
|
42
|
+
import BmChatLabels from "./ChatComponents/LabelAccordion/LabelAccordion";
|
|
43
|
+
import BmChatNotes from "./ChatComponents/NoteAccordion/NoteAccordion";
|
|
44
|
+
import { BmColorPicker } from "./ChatComponents/ColorPicker/colorPicker";
|
|
43
45
|
|
|
44
46
|
//SuperFluid Components
|
|
45
47
|
import { BmContent } from "./SuperFluid/Content/index";
|
|
@@ -112,6 +114,9 @@ export {
|
|
|
112
114
|
BmInfoTab,
|
|
113
115
|
BmContactCard,
|
|
114
116
|
BmCounter,
|
|
115
|
-
//Chat
|
|
116
|
-
|
|
117
|
+
//Chat Accordion Components
|
|
118
|
+
BmChatForm,
|
|
119
|
+
BmChatLabels,
|
|
120
|
+
BmChatNotes,
|
|
121
|
+
BmColorPicker,
|
|
117
122
|
};
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _icons = require("@material-ui/icons");
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _avatars = _interopRequireDefault(require("../Avatars/avatars"));
|
|
15
|
-
|
|
16
|
-
var _iconStyles = require("../iconStyles");
|
|
17
|
-
|
|
18
|
-
var _colors = require("../colors");
|
|
19
|
-
|
|
20
|
-
var _excluded = ["children", "state", "displayTime", "status", "session"];
|
|
21
|
-
|
|
22
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
|
-
|
|
28
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
29
|
-
|
|
30
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
31
|
-
|
|
32
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
33
|
-
|
|
34
|
-
var BmChat = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n ", "\n"])), ""
|
|
35
|
-
/* border: 0.071rem solid ${BmGrey400}; */
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
BmChat.Body = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n padding: 0rem 1.5rem;\n flex-grow: 1;\n overflow: auto;\n"])));
|
|
39
|
-
|
|
40
|
-
var Details = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n ", "\n justify-content: ", ";\n > *:not(:last-child) {\n margin-right: 1rem;\n }\n overflow-wrap: break-word !important;\n word-wrap: break-word !important;\n margin: 0rem;\n flex-grow: 1;\n"])), ""
|
|
41
|
-
/* align-items: center; */
|
|
42
|
-
, function (_ref) {
|
|
43
|
-
var state = _ref.state;
|
|
44
|
-
|
|
45
|
-
if (state === "inbound") {
|
|
46
|
-
return "flex-start";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (state === "outbound") {
|
|
50
|
-
return "flex-end";
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return "row";
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
var MessageDetails = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n max-width: 50%;\n > * {\n margin-top: 0.5rem;\n }\n"])));
|
|
57
|
-
|
|
58
|
-
var Messages = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 1.143rem;\n background: ", ";\n color: ", ";\n border-radius: ", ";\n border: 0.071rem solid ", ";\n word-break: break-all;\n margin: 0rem;\n"])), function (_ref2) {
|
|
59
|
-
var state = _ref2.state;
|
|
60
|
-
|
|
61
|
-
if (state) {
|
|
62
|
-
if (state === "inbound") return "".concat(_colors.BmPrimaryWhite);
|
|
63
|
-
if (state === "outbound") return "".concat(_colors.BmPrimaryBlue);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return "".concat(_colors.BmPrimaryWhite);
|
|
67
|
-
}, function (_ref3) {
|
|
68
|
-
var state = _ref3.state;
|
|
69
|
-
|
|
70
|
-
if (state) {
|
|
71
|
-
if (state === "inbound") return "".concat(_colors.BmPrimaryBlack);
|
|
72
|
-
if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return "".concat(_colors.BmPrimaryWhite);
|
|
76
|
-
}, function (_ref4) {
|
|
77
|
-
var state = _ref4.state;
|
|
78
|
-
|
|
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
|
-
|
|
84
|
-
return "".concat(_colors.BmPrimaryWhite);
|
|
85
|
-
}, _colors.BmGrey400);
|
|
86
|
-
|
|
87
|
-
var MessagesSubDetails = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n > *:not(:last-child) {\n margin-right: 0.5rem;\n }\n margin-top: 0.5rem;\n"])));
|
|
88
|
-
|
|
89
|
-
var handleState = function handleState(_ref5) {
|
|
90
|
-
var session = _ref5.session;
|
|
91
|
-
|
|
92
|
-
if (session === "bot") {
|
|
93
|
-
return /*#__PURE__*/_react.default.createElement(_avatars.default, {
|
|
94
|
-
size: "small",
|
|
95
|
-
user: "chatbot"
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (session === "live") {
|
|
100
|
-
return /*#__PURE__*/_react.default.createElement(_avatars.default, {
|
|
101
|
-
size: "small",
|
|
102
|
-
user: "employee"
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
BmChat.Details = function (_ref6) {
|
|
108
|
-
var children = _ref6.children,
|
|
109
|
-
state = _ref6.state,
|
|
110
|
-
displayTime = _ref6.displayTime,
|
|
111
|
-
status = _ref6.status,
|
|
112
|
-
session = _ref6.session,
|
|
113
|
-
rest = _objectWithoutProperties(_ref6, _excluded);
|
|
114
|
-
|
|
115
|
-
return /*#__PURE__*/_react.default.createElement(Details, _extends({
|
|
116
|
-
state: state
|
|
117
|
-
}, rest), state === "inbound" && session && handleState({
|
|
118
|
-
state: state,
|
|
119
|
-
session: session
|
|
120
|
-
}), /*#__PURE__*/_react.default.createElement(MessageDetails, null, /*#__PURE__*/_react.default.createElement(Messages, {
|
|
121
|
-
state: state
|
|
122
|
-
}, children), /*#__PURE__*/_react.default.createElement(MessagesSubDetails, null, displayTime && displayTime, status === "sent" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
123
|
-
icon: /*#__PURE__*/_react.default.createElement(_icons.DoneAll, null),
|
|
124
|
-
color: "".concat(_colors.BmSecondaryDarkGreen),
|
|
125
|
-
size: "small"
|
|
126
|
-
}), status === "failed" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
127
|
-
icon: /*#__PURE__*/_react.default.createElement(_icons.Done, null),
|
|
128
|
-
color: "".concat(_colors.BmPrimaryBlack),
|
|
129
|
-
size: "small"
|
|
130
|
-
}))), state === "outbound" && session && handleState({
|
|
131
|
-
state: state,
|
|
132
|
-
session: session
|
|
133
|
-
}));
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
BmChat.Footer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n ", "\n padding: 0.5rem 0.5rem;\n ", "\n ", "\n > *:not(:last-child) {\n margin-bottom: 0.5rem;\n }\n"])), ''
|
|
137
|
-
/* border-top: 0.071rem solid ${BmGrey200}; */
|
|
138
|
-
, ''
|
|
139
|
-
/* align-items: center; */
|
|
140
|
-
, ''
|
|
141
|
-
/* justify-content: center; */
|
|
142
|
-
);
|
|
143
|
-
var _default = BmChat;
|
|
144
|
-
exports.default = _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
-
|
|
10
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
-
|
|
16
|
-
var BmForm = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n"])));
|
|
17
|
-
|
|
18
|
-
BmForm.Label = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0rem;\n text-align: left;\n width: 50%;\n overflow: hidden;\n text-overflow: ellipsis;\n"])));
|
|
19
|
-
BmForm.Input = _styledComponents.default.input(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n text-align: right;\n width: 50%;\n overflow: hidden;\n text-overflow: ellipsis;\n border: none;\n &:visited,\n &:active,\n &:hover,\n &:focus {\n outline: none !important;\n text-decoration: none;\n }\n background: transparent;\n"])));
|
|
20
|
-
var _default = BmForm;
|
|
21
|
-
exports.default = _default;
|
|
@@ -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
|
-
};
|