beem-component 1.4.5 → 1.4.8
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/dist/components/ChatComponents/ChatBody/chatBody.js +47 -39
- package/dist/components/ChatComponents/ChatBody/chatBody.stories.js +5 -1
- package/dist/components/ChatComponents/ChatBody/sessionDetails.js +39 -0
- package/dist/components/Modals/modal.js +2 -4
- package/dist/components/Tags/tags.js +67 -13
- package/dist/components/Tags/tags.stories.js +29 -8
- package/package.json +2 -2
- package/src/App.js +69 -0
- package/src/index.js +1 -1
- package/src/lib/components/ChatComponents/ChatBody/chatBody.js +98 -77
- package/src/lib/components/ChatComponents/ChatBody/chatBody.stories.js +1 -0
- package/src/lib/components/ChatComponents/ChatBody/sessionDetails.js +22 -0
- package/src/lib/components/Modals/modal.js +1 -1
- package/src/lib/components/Tags/tags.js +31 -8
- package/src/lib/components/Tags/tags.stories.js +24 -7
- package/dist/components/Modals/modal copy.js +0 -160
- package/src/lib/components/Modals/modal copy.js +0 -159
|
@@ -19,11 +19,13 @@ var _avatars = _interopRequireDefault(require("../../Avatars/avatars"));
|
|
|
19
19
|
|
|
20
20
|
var _iconStyles = require("../../iconStyles");
|
|
21
21
|
|
|
22
|
+
var _sessionDetails = require("./sessionDetails");
|
|
23
|
+
|
|
22
24
|
var _colors = require("../../colors");
|
|
23
25
|
|
|
24
26
|
var _excluded = ["state", "file", "src", "fileName", "onDownload"],
|
|
25
27
|
_excluded2 = ["state", "src", "fileName"],
|
|
26
|
-
_excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName"];
|
|
28
|
+
_excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName", "sessionDetails"];
|
|
27
29
|
|
|
28
30
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
29
31
|
|
|
@@ -37,25 +39,27 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
37
39
|
|
|
38
40
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
39
41
|
|
|
40
|
-
var BmChat = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n ", "\n"])),
|
|
42
|
+
var BmChat = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n ", "\n"])), ""
|
|
41
43
|
/* border: 0.071rem solid ${BmGrey400}; */
|
|
42
44
|
);
|
|
43
45
|
|
|
44
|
-
BmChat.Body = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column-reverse;\n padding: 0rem 1rem;\n flex-grow: 1;\n overflow: auto;\n height: 100%;\n"])));
|
|
46
|
+
BmChat.Body = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column-reverse;\n padding: 0rem 1rem;\n flex-grow: 1;\n overflow: auto;\n height: 100%;\n border: 10px solid green;\n"])));
|
|
45
47
|
|
|
46
|
-
var Details = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: ", ";\n > *:not(:last-child) {\n margin-right: 1rem;\n margin-bottom: 0.5rem;\n }\n overflow-wrap: break-word !important;\n word-wrap: break-word !important;\n margin: 0rem;\n flex-grow: 1;\n"])), function (_ref) {
|
|
48
|
+
var Details = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: ", ";\n > *:not(:last-child) {\n margin-right: 1rem;\n margin-bottom: 0.5rem;\n }\n overflow-wrap: break-word !important;\n word-wrap: break-word !important;\n margin: 0rem;\n flex-grow: 1;\n ", "\n"])), function (_ref) {
|
|
47
49
|
var state = _ref.state;
|
|
48
50
|
|
|
49
|
-
if (state ===
|
|
50
|
-
return
|
|
51
|
+
if (state === "inbound") {
|
|
52
|
+
return "flex-start";
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
if (state ===
|
|
54
|
-
return
|
|
55
|
+
if (state === "outbound") {
|
|
56
|
+
return "flex-end";
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
return
|
|
58
|
-
}
|
|
59
|
+
return "row";
|
|
60
|
+
}, ""
|
|
61
|
+
/* border: 1px solid red; */
|
|
62
|
+
);
|
|
59
63
|
|
|
60
64
|
var MessageDetails = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n max-width: 70%;\n > * {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n }\n"])));
|
|
61
65
|
|
|
@@ -63,8 +67,8 @@ var Messages = _styledComponents.default.div(_templateObject5 || (_templateObjec
|
|
|
63
67
|
var state = _ref2.state;
|
|
64
68
|
|
|
65
69
|
if (state) {
|
|
66
|
-
if (state ===
|
|
67
|
-
if (state ===
|
|
70
|
+
if (state === "inbound") return "".concat(_colors.BmPrimaryWhite);
|
|
71
|
+
if (state === "outbound") return "".concat(_colors.BmPrimaryBlue);
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -72,8 +76,8 @@ var Messages = _styledComponents.default.div(_templateObject5 || (_templateObjec
|
|
|
72
76
|
var state = _ref3.state;
|
|
73
77
|
|
|
74
78
|
if (state) {
|
|
75
|
-
if (state ===
|
|
76
|
-
if (state ===
|
|
79
|
+
if (state === "inbound") return "".concat(_colors.BmPrimaryBlack);
|
|
80
|
+
if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -81,8 +85,8 @@ var Messages = _styledComponents.default.div(_templateObject5 || (_templateObjec
|
|
|
81
85
|
var state = _ref4.state;
|
|
82
86
|
|
|
83
87
|
if (state) {
|
|
84
|
-
if (state ===
|
|
85
|
-
if (state ===
|
|
88
|
+
if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
|
|
89
|
+
if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -93,14 +97,14 @@ var MessagesSubDetails = _styledComponents.default.div(_templateObject6 || (_tem
|
|
|
93
97
|
var handleState = function handleState(_ref5) {
|
|
94
98
|
var session = _ref5.session;
|
|
95
99
|
|
|
96
|
-
if (session ===
|
|
100
|
+
if (session === "bot") {
|
|
97
101
|
return /*#__PURE__*/_react.default.createElement(_avatars.default, {
|
|
98
102
|
size: "small",
|
|
99
103
|
user: "chatbot"
|
|
100
104
|
});
|
|
101
105
|
}
|
|
102
106
|
|
|
103
|
-
if (session ===
|
|
107
|
+
if (session === "live") {
|
|
104
108
|
return /*#__PURE__*/_react.default.createElement(_avatars.default, {
|
|
105
109
|
size: "small",
|
|
106
110
|
user: "employee"
|
|
@@ -113,8 +117,8 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
|
|
|
113
117
|
var state = _ref6.state;
|
|
114
118
|
|
|
115
119
|
if (state) {
|
|
116
|
-
if (state ===
|
|
117
|
-
if (state ===
|
|
120
|
+
if (state === "inbound") return "".concat(_colors.BmPrimaryWhite);
|
|
121
|
+
if (state === "outbound") return "".concat(_colors.BmPrimaryBlue);
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -122,8 +126,8 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
|
|
|
122
126
|
var state = _ref7.state;
|
|
123
127
|
|
|
124
128
|
if (state) {
|
|
125
|
-
if (state ===
|
|
126
|
-
if (state ===
|
|
129
|
+
if (state === "inbound") return "".concat(_colors.BmPrimaryBlack);
|
|
130
|
+
if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
|
|
127
131
|
}
|
|
128
132
|
|
|
129
133
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -131,8 +135,8 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
|
|
|
131
135
|
var state = _ref8.state;
|
|
132
136
|
|
|
133
137
|
if (state) {
|
|
134
|
-
if (state ===
|
|
135
|
-
if (state ===
|
|
138
|
+
if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
|
|
139
|
+
if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -140,14 +144,14 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
|
|
|
140
144
|
var state = _ref9.state;
|
|
141
145
|
|
|
142
146
|
if (state) {
|
|
143
|
-
if (state ===
|
|
144
|
-
if (state ===
|
|
147
|
+
if (state === "inbound") return "".concat(_colors.BmPrimaryBlue);
|
|
148
|
+
if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
|
|
145
149
|
}
|
|
146
150
|
|
|
147
151
|
return "".concat(_colors.BmPrimaryWhite);
|
|
148
|
-
},
|
|
152
|
+
}, ""
|
|
149
153
|
/* max-width: 100%; */
|
|
150
|
-
,
|
|
154
|
+
, ""
|
|
151
155
|
/* max-height: 100%; */
|
|
152
156
|
);
|
|
153
157
|
|
|
@@ -174,8 +178,8 @@ var BmImageWrapper = _styledComponents.default.div(_templateObject8 || (_templat
|
|
|
174
178
|
var state = _ref11.state;
|
|
175
179
|
|
|
176
180
|
if (state) {
|
|
177
|
-
if (state ===
|
|
178
|
-
if (state ===
|
|
181
|
+
if (state === "inbound") return "".concat(_colors.BmPrimaryBlack);
|
|
182
|
+
if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
|
|
179
183
|
}
|
|
180
184
|
|
|
181
185
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -183,8 +187,8 @@ var BmImageWrapper = _styledComponents.default.div(_templateObject8 || (_templat
|
|
|
183
187
|
var state = _ref12.state;
|
|
184
188
|
|
|
185
189
|
if (state) {
|
|
186
|
-
if (state ===
|
|
187
|
-
if (state ===
|
|
190
|
+
if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
|
|
191
|
+
if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
|
|
188
192
|
}
|
|
189
193
|
|
|
190
194
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -192,7 +196,7 @@ var BmImageWrapper = _styledComponents.default.div(_templateObject8 || (_templat
|
|
|
192
196
|
|
|
193
197
|
exports.BmImageWrapper = BmImageWrapper;
|
|
194
198
|
|
|
195
|
-
var BmImage = _styledComponents.default.img(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", "\n width: 100%;\n object-fit: cover;\n flex-grow: 1;\n"])),
|
|
199
|
+
var BmImage = _styledComponents.default.img(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", "\n width: 100%;\n object-fit: cover;\n flex-grow: 1;\n"])), ""
|
|
196
200
|
/* Fix width */
|
|
197
201
|
);
|
|
198
202
|
|
|
@@ -232,11 +236,15 @@ BmChat.Details = function (_ref14) {
|
|
|
232
236
|
src = _ref14.src,
|
|
233
237
|
file = _ref14.file,
|
|
234
238
|
fileName = _ref14.fileName,
|
|
239
|
+
sessionDetails = _ref14.sessionDetails,
|
|
235
240
|
rest = _objectWithoutProperties(_ref14, _excluded3);
|
|
236
241
|
|
|
237
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
242
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sessionDetails && /*#__PURE__*/_react.default.createElement(_sessionDetails.SessionDetails, _extends({
|
|
243
|
+
time: sessionDetails.time,
|
|
244
|
+
message: sessionDetails.message
|
|
245
|
+
}, rest)), /*#__PURE__*/_react.default.createElement(Details, _extends({
|
|
238
246
|
state: state
|
|
239
|
-
}, rest), /*#__PURE__*/_react.default.createElement(MessageState, null, state ===
|
|
247
|
+
}, rest), /*#__PURE__*/_react.default.createElement(MessageState, null, state === "inbound" && session && handleState({
|
|
240
248
|
state: state,
|
|
241
249
|
session: session
|
|
242
250
|
})), /*#__PURE__*/_react.default.createElement(MessageDetails, null, src && /*#__PURE__*/_react.default.createElement(BmImageChat, _extends({
|
|
@@ -249,18 +257,18 @@ BmChat.Details = function (_ref14) {
|
|
|
249
257
|
file: file,
|
|
250
258
|
fileName: fileName,
|
|
251
259
|
state: state
|
|
252
|
-
}, rest)), /*#__PURE__*/_react.default.createElement(MessagesSubDetails, null, displayTime && displayTime, status ===
|
|
260
|
+
}, rest)), /*#__PURE__*/_react.default.createElement(MessagesSubDetails, null, displayTime && displayTime, status === "sent" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
253
261
|
icon: /*#__PURE__*/_react.default.createElement(_icons.DoneAll, null),
|
|
254
262
|
color: "".concat(_colors.BmSecondaryDarkGreen),
|
|
255
263
|
size: "small"
|
|
256
|
-
}), status ===
|
|
264
|
+
}), status === "failed" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
257
265
|
icon: /*#__PURE__*/_react.default.createElement(_icons.Done, null),
|
|
258
266
|
color: "".concat(_colors.BmPrimaryBlack),
|
|
259
267
|
size: "small"
|
|
260
|
-
}))), /*#__PURE__*/_react.default.createElement(MessageState, null, state ===
|
|
268
|
+
}))), /*#__PURE__*/_react.default.createElement(MessageState, null, state === "outbound" && session && handleState({
|
|
261
269
|
state: state,
|
|
262
270
|
session: session
|
|
263
|
-
})));
|
|
271
|
+
}))));
|
|
264
272
|
};
|
|
265
273
|
|
|
266
274
|
BmChat.Footer = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n padding: 0.5rem 0.5rem;\n > *:not(:last-child) {\n margin-bottom: 0.5rem;\n }\n"])));
|
|
@@ -38,7 +38,11 @@ var ChatBody = function ChatBody() {
|
|
|
38
38
|
state: "inbound",
|
|
39
39
|
session: "bot",
|
|
40
40
|
displayTime: /*#__PURE__*/_react.default.createElement("p", null, "12:00pm"),
|
|
41
|
-
status: "sent"
|
|
41
|
+
status: "sent",
|
|
42
|
+
sessionDetails: {
|
|
43
|
+
message: /*#__PURE__*/_react.default.createElement("h3", null, "Session Message"),
|
|
44
|
+
time: /*#__PURE__*/_react.default.createElement("p", null, "12:00pm")
|
|
45
|
+
}
|
|
42
46
|
}, /*#__PURE__*/_react.default.createElement("p", null, "Inbound Text Message")), /*#__PURE__*/_react.default.createElement(_chatBody.default.Details, {
|
|
43
47
|
state: "inbound",
|
|
44
48
|
session: "live",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SessionDetails = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _colors = require("../../colors");
|
|
11
|
+
|
|
12
|
+
var _excluded = ["message", "time"];
|
|
13
|
+
|
|
14
|
+
var _templateObject;
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
25
|
+
|
|
26
|
+
var SessionDetailsWrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n text-align: center;\n border-bottom: 0.071rem solid ", ";\n margin: 0.5rem;\n"])), _colors.BmGrey200);
|
|
27
|
+
|
|
28
|
+
var SessionDetails = function SessionDetails(_ref) {
|
|
29
|
+
var message = _ref.message,
|
|
30
|
+
time = _ref.time,
|
|
31
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/React.createElement(SessionDetailsWrapper, _extends({
|
|
34
|
+
time: time,
|
|
35
|
+
message: message
|
|
36
|
+
}, rest), /*#__PURE__*/React.createElement("p", null, "\xA0"), message || /*#__PURE__*/React.createElement("p", null, "\xA0"), time || /*#__PURE__*/React.createElement("p", null, "\xA0"));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.SessionDetails = SessionDetails;
|
|
@@ -133,7 +133,7 @@ BmModal.Header = function (_ref2) {
|
|
|
133
133
|
});
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
BmModal.Body = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n > *:not(:last-child) {\n margin-bottom: 0.5rem;\n }\n max-height: ", ";\n
|
|
136
|
+
BmModal.Body = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n > *:not(:last-child) {\n margin-bottom: 0.5rem;\n }\n max-height: ", ";\n overflow: auto;\n"])), function (_ref3) {
|
|
137
137
|
var size = _ref3.size;
|
|
138
138
|
|
|
139
139
|
if (size) {
|
|
@@ -145,9 +145,7 @@ BmModal.Body = _styledComponents.default.div(_templateObject5 || (_templateObjec
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
return "35.714rem";
|
|
148
|
-
}
|
|
149
|
-
/* overflow: auto; */
|
|
150
|
-
);
|
|
148
|
+
});
|
|
151
149
|
BmModal.Footer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n"])));
|
|
152
150
|
BmModal.propTypes = {
|
|
153
151
|
size: _propTypes.default.string,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.BmTag = void 0;
|
|
7
9
|
|
|
8
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
10
12
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
13
|
|
|
@@ -15,18 +17,36 @@ var _iconStyles = require("../iconStyles");
|
|
|
15
17
|
|
|
16
18
|
var _colors = require("../../components/colors");
|
|
17
19
|
|
|
18
|
-
var
|
|
20
|
+
var _icons = require("@material-ui/icons");
|
|
21
|
+
|
|
22
|
+
var _excluded = ["variant", "size", "disabled", "children", "leadingIcon", "trailingIcon", "color", "closeButton", "onHide"];
|
|
19
23
|
|
|
20
24
|
var _templateObject;
|
|
21
25
|
|
|
22
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
27
|
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
24
32
|
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); }
|
|
25
33
|
|
|
26
34
|
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; }
|
|
27
35
|
|
|
28
36
|
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; }
|
|
29
37
|
|
|
38
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
+
|
|
40
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
+
|
|
42
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43
|
+
|
|
44
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
45
|
+
|
|
46
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
+
|
|
48
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
+
|
|
30
50
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
31
51
|
|
|
32
52
|
var Color = function Color(_ref) {
|
|
@@ -44,25 +64,36 @@ var Color = function Color(_ref) {
|
|
|
44
64
|
return "".concat(_colors.BmPrimaryBlack);
|
|
45
65
|
};
|
|
46
66
|
|
|
47
|
-
var BeemTag = _styledComponents.default.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display:
|
|
48
|
-
|
|
67
|
+
var BeemTag = _styledComponents.default.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n display: ", ";\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 0.25rem 0.5rem;\n border-radius: 0.25rem;\n background: ", ";\n border: 0.071rem solid\n ", ";\n > * {\n color: ", ";\n text-transform: uppercase;\n }\n\n > *:not(:last-child) {\n margin-right: 0.5rem;\n }\n"])), ""
|
|
68
|
+
/* display: flex; */
|
|
69
|
+
, function (_ref2) {
|
|
70
|
+
var closeButton = _ref2.closeButton,
|
|
71
|
+
show = _ref2.show;
|
|
72
|
+
|
|
73
|
+
if (!closeButton) {
|
|
74
|
+
return "flex";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return show ? "flex" : "none";
|
|
78
|
+
}, function (_ref3) {
|
|
79
|
+
var variant = _ref3.variant;
|
|
49
80
|
if (variant === "neutral") return "".concat(_colors.BmGrey100);
|
|
50
81
|
if (variant === "success") return "".concat(_colors.BmSecondaryDarkGreen);
|
|
51
82
|
if (variant === "warning") return "".concat(_colors.BmPrimaryGold);
|
|
52
83
|
if (variant === "danger") return "".concat(_colors.BmSecondaryRed);
|
|
53
84
|
if (variant === "light") return "".concat(_colors.BmPrimaryWhite);
|
|
54
85
|
if (!variant) return "".concat(_colors.BmGrey100);
|
|
55
|
-
}, function (
|
|
56
|
-
var variant =
|
|
86
|
+
}, function (_ref4) {
|
|
87
|
+
var variant = _ref4.variant;
|
|
57
88
|
if (variant === "neutral") return "".concat(_colors.BmGrey100);
|
|
58
89
|
if (variant === "success") return "".concat(_colors.BmSecondaryDarkGreen);
|
|
59
90
|
if (variant === "warning") return "".concat(_colors.BmPrimaryGold);
|
|
60
91
|
if (variant === "danger") return "".concat(_colors.BmSecondaryRed);
|
|
61
92
|
if (variant === "light") return "".concat(_colors.BmGrey400);
|
|
62
93
|
return "".concat(_colors.BmGrey100);
|
|
63
|
-
}, function (
|
|
64
|
-
var variant =
|
|
65
|
-
color =
|
|
94
|
+
}, function (_ref5) {
|
|
95
|
+
var variant = _ref5.variant,
|
|
96
|
+
color = _ref5.color;
|
|
66
97
|
return Color({
|
|
67
98
|
variant: variant,
|
|
68
99
|
color: color
|
|
@@ -70,6 +101,11 @@ var BeemTag = _styledComponents.default.button(_templateObject || (_templateObje
|
|
|
70
101
|
});
|
|
71
102
|
|
|
72
103
|
var BmTag = function BmTag(props) {
|
|
104
|
+
var _useState = (0, _react.useState)(true),
|
|
105
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
106
|
+
toggle = _useState2[0],
|
|
107
|
+
setToggle = _useState2[1];
|
|
108
|
+
|
|
73
109
|
var variant = props.variant,
|
|
74
110
|
size = props.size,
|
|
75
111
|
disabled = props.disabled,
|
|
@@ -77,6 +113,8 @@ var BmTag = function BmTag(props) {
|
|
|
77
113
|
leadingIcon = props.leadingIcon,
|
|
78
114
|
trailingIcon = props.trailingIcon,
|
|
79
115
|
color = props.color,
|
|
116
|
+
closeButton = props.closeButton,
|
|
117
|
+
onHide = props.onHide,
|
|
80
118
|
rest = _objectWithoutProperties(props, _excluded);
|
|
81
119
|
|
|
82
120
|
return /*#__PURE__*/_react.default.createElement(BeemTag, _extends({
|
|
@@ -84,7 +122,9 @@ var BmTag = function BmTag(props) {
|
|
|
84
122
|
variant: variant,
|
|
85
123
|
disabled: disabled,
|
|
86
124
|
children: children,
|
|
87
|
-
color: color
|
|
125
|
+
color: color,
|
|
126
|
+
closeButton: closeButton,
|
|
127
|
+
show: toggle
|
|
88
128
|
}, rest), leadingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
89
129
|
disabled: disabled,
|
|
90
130
|
icon: leadingIcon,
|
|
@@ -93,7 +133,7 @@ var BmTag = function BmTag(props) {
|
|
|
93
133
|
color: color,
|
|
94
134
|
variant: variant
|
|
95
135
|
}),
|
|
96
|
-
size: size ||
|
|
136
|
+
size: size || "small"
|
|
97
137
|
}), children, trailingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
98
138
|
icon: trailingIcon,
|
|
99
139
|
disabled: disabled,
|
|
@@ -101,7 +141,20 @@ var BmTag = function BmTag(props) {
|
|
|
101
141
|
color: color,
|
|
102
142
|
variant: variant
|
|
103
143
|
}),
|
|
104
|
-
size: size ||
|
|
144
|
+
size: size || "small"
|
|
145
|
+
}), closeButton && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
146
|
+
icon: /*#__PURE__*/_react.default.createElement(_icons.Clear, null),
|
|
147
|
+
color: Color({
|
|
148
|
+
color: color,
|
|
149
|
+
variant: variant
|
|
150
|
+
}),
|
|
151
|
+
size: size ? size : "small",
|
|
152
|
+
style: {
|
|
153
|
+
marginLeft: "auto"
|
|
154
|
+
},
|
|
155
|
+
onClick: function onClick() {
|
|
156
|
+
return onHide && onHide(setToggle(!toggle));
|
|
157
|
+
}
|
|
105
158
|
}));
|
|
106
159
|
};
|
|
107
160
|
|
|
@@ -112,5 +165,6 @@ BmTag.propTypes = {
|
|
|
112
165
|
leadingIcon: _propTypes.default.node,
|
|
113
166
|
color: _propTypes.default.string,
|
|
114
167
|
size: _propTypes.default.string,
|
|
115
|
-
variant: _propTypes.default.string
|
|
168
|
+
variant: _propTypes.default.string,
|
|
169
|
+
closeButton: _propTypes.default.bool
|
|
116
170
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.
|
|
6
|
+
exports.default = exports.TagsWithCloseButton = exports.Tags = void 0;
|
|
7
7
|
|
|
8
8
|
var _icons = require("@material-ui/icons");
|
|
9
9
|
|
|
@@ -24,6 +24,15 @@ var _default = {
|
|
|
24
24
|
},
|
|
25
25
|
description: "Color of the Icons and Text, will work only if variant is not present"
|
|
26
26
|
},
|
|
27
|
+
closeButton: {
|
|
28
|
+
control: {
|
|
29
|
+
type: "boolean"
|
|
30
|
+
},
|
|
31
|
+
description: "Will display (x) - Optional"
|
|
32
|
+
},
|
|
33
|
+
onHide: {
|
|
34
|
+
description: "Handles closing of tags, will only work if closeButton is present (Optional)"
|
|
35
|
+
},
|
|
27
36
|
size: {
|
|
28
37
|
options: ["xsmall", "small", "medium", "large", "xlarge"],
|
|
29
38
|
control: {
|
|
@@ -48,15 +57,27 @@ var _default = {
|
|
|
48
57
|
};
|
|
49
58
|
exports.default = _default;
|
|
50
59
|
|
|
51
|
-
var
|
|
60
|
+
var MainTag = function MainTag(args) {
|
|
52
61
|
return /*#__PURE__*/_react.default.createElement(_tags.BmTag, args);
|
|
53
62
|
};
|
|
54
63
|
|
|
55
|
-
var
|
|
56
|
-
exports.
|
|
57
|
-
|
|
58
|
-
children: /*#__PURE__*/_react.default.createElement("p", null, "
|
|
64
|
+
var Tags = MainTag.bind({});
|
|
65
|
+
exports.Tags = Tags;
|
|
66
|
+
Tags.args = {
|
|
67
|
+
children: /*#__PURE__*/_react.default.createElement("p", null, "Tags"),
|
|
59
68
|
leadingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
60
69
|
trailingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
61
|
-
variant:
|
|
62
|
-
};
|
|
70
|
+
variant: "success"
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var TagsWithCloseButton = function TagsWithCloseButton() {
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(_tags.BmTag, {
|
|
75
|
+
variant: "light",
|
|
76
|
+
closeButton: true,
|
|
77
|
+
onHide: function onHide() {
|
|
78
|
+
return console.log("Hide Tag");
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, "TAG"));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.TagsWithCloseButton = TagsWithCloseButton;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beem-component",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/components/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"react": "^17.0.2",
|
|
33
33
|
"react-dom": "^17.0.2",
|
|
34
34
|
"react-router-dom": "^5.3.0",
|
|
35
|
-
"react-scripts": "
|
|
35
|
+
"react-scripts": "^5.0.1",
|
|
36
36
|
"save": "^2.4.0",
|
|
37
37
|
"styled-components": "^5.3.0",
|
|
38
38
|
"web-vitals": "^1.1.2"
|
package/src/App.js
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { GlobalStyle, BmChat } from "./lib/components";
|
|
3
|
+
import image from "../src/lib/assets/chart-img.png";
|
|
4
|
+
|
|
5
|
+
const App = () => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<GlobalStyle />
|
|
9
|
+
<BmChat>
|
|
10
|
+
<BmChat.Body>
|
|
11
|
+
<BmChat.Details
|
|
12
|
+
state="inbound"
|
|
13
|
+
session="bot"
|
|
14
|
+
displayTime={<p>12:00pm</p>}
|
|
15
|
+
status="sent"
|
|
16
|
+
>
|
|
17
|
+
<p>Inbound Text Message</p>
|
|
18
|
+
</BmChat.Details>
|
|
19
|
+
<BmChat.Details
|
|
20
|
+
state="inbound"
|
|
21
|
+
session="live"
|
|
22
|
+
displayTime={<p>12:00pm</p>}
|
|
23
|
+
status="sent"
|
|
24
|
+
fileName={<p>chat.png</p>}
|
|
25
|
+
src={image}
|
|
26
|
+
sessionDetails={{ message: <h3>tejal</h3>, time: <p>today</p> }}
|
|
27
|
+
/>
|
|
28
|
+
<BmChat.Details
|
|
29
|
+
state="inbound"
|
|
30
|
+
session="live"
|
|
31
|
+
displayTime={<p>10:00am</p>}
|
|
32
|
+
status="failed"
|
|
33
|
+
fileName={<p>file.csv</p>}
|
|
34
|
+
file={image}
|
|
35
|
+
/>
|
|
36
|
+
<BmChat.Details
|
|
37
|
+
state="outbound"
|
|
38
|
+
session="bot"
|
|
39
|
+
displayTime={<p>12:00pm</p>}
|
|
40
|
+
status="sent"
|
|
41
|
+
>
|
|
42
|
+
<p>Outbound Text Message</p>
|
|
43
|
+
</BmChat.Details>
|
|
44
|
+
<BmChat.Details
|
|
45
|
+
state="outbound"
|
|
46
|
+
session="live"
|
|
47
|
+
displayTime={<p>12:00pm</p>}
|
|
48
|
+
status="sent"
|
|
49
|
+
fileName={<p>chat.png</p>}
|
|
50
|
+
src={image}
|
|
51
|
+
/>
|
|
52
|
+
<BmChat.Details
|
|
53
|
+
state="outbound"
|
|
54
|
+
session="live"
|
|
55
|
+
displayTime={<p>10:00am</p>}
|
|
56
|
+
status="failed"
|
|
57
|
+
fileName={<p>file.csv</p>}
|
|
58
|
+
file={image}
|
|
59
|
+
onDownload={() => {
|
|
60
|
+
alert("hello");
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
</BmChat.Body>
|
|
64
|
+
</BmChat>
|
|
65
|
+
</>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default App;
|