beem-component 1.3.8 → 1.4.1
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/Accordion/Accordion.js +15 -6
- package/dist/components/Accordion/Accordion.stories.js +16 -1
- package/dist/components/ChatComponents/ChatBody/chatBody.js +37 -35
- package/dist/components/ChatComponents/ChatBody/chatBody.stories.js +7 -3
- package/dist/components/ProgressRing/progressRing.js +1 -2
- package/dist/components/Tabs/tabs.js +4 -2
- package/dist/components/Tabs/tabs.stories.js +21 -2
- package/package.json +75 -75
- package/src/App.js +76 -67
- package/src/lib/components/Accordion/Accordion.js +6 -3
- package/src/lib/components/Accordion/Accordion.stories.js +20 -1
- package/src/lib/components/ChatComponents/ChatBody/chatBody.js +55 -48
- package/src/lib/components/ChatComponents/ChatBody/chatBody.stories.js +38 -35
- package/src/lib/components/ProgressRing/progressRing.js +1 -1
- package/src/lib/components/Tabs/tabs.js +3 -2
- package/src/lib/components/Tabs/tabs.stories.js +17 -3
|
@@ -19,7 +19,7 @@ var _iconStyles = require("../iconStyles");
|
|
|
19
19
|
|
|
20
20
|
var _icons = require("@material-ui/icons");
|
|
21
21
|
|
|
22
|
-
var _excluded = ["children", "disabled", "expandIcon", "Open"],
|
|
22
|
+
var _excluded = ["children", "disabled", "expandIcon", "Open", "expandIconPosition"],
|
|
23
23
|
_excluded2 = ["children", "leadingIcon", "trailingIcon", "size"];
|
|
24
24
|
|
|
25
25
|
var _templateObject, _templateObject2, _templateObject3;
|
|
@@ -30,6 +30,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
30
30
|
|
|
31
31
|
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; }
|
|
32
32
|
|
|
33
|
+
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; }
|
|
34
|
+
|
|
35
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
36
|
+
|
|
37
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
38
|
+
|
|
33
39
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
34
40
|
|
|
35
41
|
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."); }
|
|
@@ -85,6 +91,7 @@ var BmAccordion = function BmAccordion(_ref) {
|
|
|
85
91
|
disabled = _ref.disabled,
|
|
86
92
|
expandIcon = _ref.expandIcon,
|
|
87
93
|
Open = _ref.Open,
|
|
94
|
+
expandIconPosition = _ref.expandIconPosition,
|
|
88
95
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
89
96
|
|
|
90
97
|
var _useState = (0, _react.useState)(Open ? true : false),
|
|
@@ -93,12 +100,13 @@ var BmAccordion = function BmAccordion(_ref) {
|
|
|
93
100
|
setToggle = _useState2[1];
|
|
94
101
|
|
|
95
102
|
return /*#__PURE__*/_react.default.createElement(BmAccordionWrapper, null, /*#__PURE__*/_react.default.createElement(Provider, {
|
|
96
|
-
value: {
|
|
103
|
+
value: _objectSpread({
|
|
97
104
|
toggle: toggle,
|
|
98
105
|
setToggle: setToggle,
|
|
99
106
|
disabled: disabled,
|
|
100
|
-
expandIcon: expandIcon
|
|
101
|
-
|
|
107
|
+
expandIcon: expandIcon,
|
|
108
|
+
expandIconPosition: expandIconPosition
|
|
109
|
+
}, rest)
|
|
102
110
|
}, children));
|
|
103
111
|
};
|
|
104
112
|
|
|
@@ -114,13 +122,13 @@ BmAccordion.Title = function (_ref2) {
|
|
|
114
122
|
onClick: function onClick() {
|
|
115
123
|
return !value.disabled || value.disabled === false ? value.setToggle(!value.toggle) : value.setToggle(false);
|
|
116
124
|
}
|
|
117
|
-
}), Dropdown(value, rest), leadingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
125
|
+
}), value.expandIconPosition === "left" || value.expandIconPosition === undefined && Dropdown(value, rest), leadingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
118
126
|
icon: leadingIcon,
|
|
119
127
|
size: size
|
|
120
128
|
}), /*#__PURE__*/_react.default.createElement(BmAccordionDetails, null, children), trailingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
121
129
|
icon: trailingIcon,
|
|
122
130
|
size: size
|
|
123
|
-
}));
|
|
131
|
+
}), value.expandIconPosition === "right" && Dropdown(value, rest));
|
|
124
132
|
});
|
|
125
133
|
};
|
|
126
134
|
|
|
@@ -135,6 +143,7 @@ BmAccordion.propTypes = {
|
|
|
135
143
|
children: _propTypes.default.object,
|
|
136
144
|
size: _propTypes.default.string,
|
|
137
145
|
expandIcon: _propTypes.default.string,
|
|
146
|
+
expandIconPosition: _propTypes.default.string,
|
|
138
147
|
leadingIcon: _propTypes.default.node,
|
|
139
148
|
trailingIcon: _propTypes.default.node,
|
|
140
149
|
disabled: _propTypes.default.bool,
|
|
@@ -61,6 +61,16 @@ var _default = {
|
|
|
61
61
|
summary: undefined
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
+
expandIconPosition: {
|
|
65
|
+
options: ["left", "right"],
|
|
66
|
+
control: {
|
|
67
|
+
type: "select"
|
|
68
|
+
},
|
|
69
|
+
description: "Position of the expand Icon",
|
|
70
|
+
defaultValue: {
|
|
71
|
+
summary: "left"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
64
74
|
leadingIcon: {
|
|
65
75
|
description: "Material-UI icon(optional)",
|
|
66
76
|
defaultValue: {
|
|
@@ -81,6 +91,10 @@ var optionSize = {
|
|
|
81
91
|
medium: "medium",
|
|
82
92
|
large: "large"
|
|
83
93
|
};
|
|
94
|
+
var optionExpandIcon = {
|
|
95
|
+
left: "left",
|
|
96
|
+
right: "medium"
|
|
97
|
+
};
|
|
84
98
|
|
|
85
99
|
var Accordion = function Accordion() {
|
|
86
100
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Accordion.default, {
|
|
@@ -89,7 +103,8 @@ var Accordion = function Accordion() {
|
|
|
89
103
|
}, /*#__PURE__*/_react.default.createElement(_Accordion.default.Title, {
|
|
90
104
|
leadingIcon: /*#__PURE__*/_react.default.createElement(_icons.Home, null),
|
|
91
105
|
trailingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
92
|
-
size: (0, _addonKnobs.select)("size", optionSize, "large")
|
|
106
|
+
size: (0, _addonKnobs.select)("size", optionSize, "large"),
|
|
107
|
+
expandIconPosition: (0, _addonKnobs.select)("expandIconPosition", optionExpandIcon, "left")
|
|
93
108
|
}, /*#__PURE__*/_react.default.createElement("h3", null, (0, _addonKnobs.text)("children", "Accordion"))), /*#__PURE__*/_react.default.createElement(_Accordion.default.Body, null, "Accordion Body")));
|
|
94
109
|
};
|
|
95
110
|
|
|
@@ -21,7 +21,7 @@ var _iconStyles = require("../../iconStyles");
|
|
|
21
21
|
|
|
22
22
|
var _colors = require("../../colors");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["state", "file", "src", "fileName"],
|
|
24
|
+
var _excluded = ["state", "file", "src", "fileName", "onDownload"],
|
|
25
25
|
_excluded2 = ["state", "src", "fileName"],
|
|
26
26
|
_excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName"];
|
|
27
27
|
|
|
@@ -37,7 +37,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
37
37
|
|
|
38
38
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
39
39
|
|
|
40
|
-
var BmChat = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n ", "\n"])),
|
|
40
|
+
var BmChat = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n ", "\n"])), ''
|
|
41
41
|
/* border: 0.071rem solid ${BmGrey400}; */
|
|
42
42
|
);
|
|
43
43
|
|
|
@@ -46,15 +46,15 @@ BmChat.Body = _styledComponents.default.div(_templateObject2 || (_templateObject
|
|
|
46
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) {
|
|
47
47
|
var state = _ref.state;
|
|
48
48
|
|
|
49
|
-
if (state ===
|
|
50
|
-
return
|
|
49
|
+
if (state === 'inbound') {
|
|
50
|
+
return 'flex-start';
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
if (state ===
|
|
54
|
-
return
|
|
53
|
+
if (state === 'outbound') {
|
|
54
|
+
return 'flex-end';
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
return
|
|
57
|
+
return 'row';
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
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"])));
|
|
@@ -63,8 +63,8 @@ var Messages = _styledComponents.default.div(_templateObject5 || (_templateObjec
|
|
|
63
63
|
var state = _ref2.state;
|
|
64
64
|
|
|
65
65
|
if (state) {
|
|
66
|
-
if (state ===
|
|
67
|
-
if (state ===
|
|
66
|
+
if (state === 'inbound') return "".concat(_colors.BmPrimaryWhite);
|
|
67
|
+
if (state === 'outbound') return "".concat(_colors.BmPrimaryBlue);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -72,8 +72,8 @@ var Messages = _styledComponents.default.div(_templateObject5 || (_templateObjec
|
|
|
72
72
|
var state = _ref3.state;
|
|
73
73
|
|
|
74
74
|
if (state) {
|
|
75
|
-
if (state ===
|
|
76
|
-
if (state ===
|
|
75
|
+
if (state === 'inbound') return "".concat(_colors.BmPrimaryBlack);
|
|
76
|
+
if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -81,8 +81,8 @@ var Messages = _styledComponents.default.div(_templateObject5 || (_templateObjec
|
|
|
81
81
|
var state = _ref4.state;
|
|
82
82
|
|
|
83
83
|
if (state) {
|
|
84
|
-
if (state ===
|
|
85
|
-
if (state ===
|
|
84
|
+
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
85
|
+
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -93,14 +93,14 @@ var MessagesSubDetails = _styledComponents.default.div(_templateObject6 || (_tem
|
|
|
93
93
|
var handleState = function handleState(_ref5) {
|
|
94
94
|
var session = _ref5.session;
|
|
95
95
|
|
|
96
|
-
if (session ===
|
|
96
|
+
if (session === 'bot') {
|
|
97
97
|
return /*#__PURE__*/_react.default.createElement(_avatars.default, {
|
|
98
98
|
size: "small",
|
|
99
99
|
user: "chatbot"
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
if (session ===
|
|
103
|
+
if (session === 'live') {
|
|
104
104
|
return /*#__PURE__*/_react.default.createElement(_avatars.default, {
|
|
105
105
|
size: "small",
|
|
106
106
|
user: "employee"
|
|
@@ -113,8 +113,8 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
|
|
|
113
113
|
var state = _ref6.state;
|
|
114
114
|
|
|
115
115
|
if (state) {
|
|
116
|
-
if (state ===
|
|
117
|
-
if (state ===
|
|
116
|
+
if (state === 'inbound') return "".concat(_colors.BmPrimaryWhite);
|
|
117
|
+
if (state === 'outbound') return "".concat(_colors.BmPrimaryBlue);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -122,8 +122,8 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
|
|
|
122
122
|
var state = _ref7.state;
|
|
123
123
|
|
|
124
124
|
if (state) {
|
|
125
|
-
if (state ===
|
|
126
|
-
if (state ===
|
|
125
|
+
if (state === 'inbound') return "".concat(_colors.BmPrimaryBlack);
|
|
126
|
+
if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -131,8 +131,8 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
|
|
|
131
131
|
var state = _ref8.state;
|
|
132
132
|
|
|
133
133
|
if (state) {
|
|
134
|
-
if (state ===
|
|
135
|
-
if (state ===
|
|
134
|
+
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
135
|
+
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -140,14 +140,14 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
|
|
|
140
140
|
var state = _ref9.state;
|
|
141
141
|
|
|
142
142
|
if (state) {
|
|
143
|
-
if (state ===
|
|
144
|
-
if (state ===
|
|
143
|
+
if (state === 'inbound') return "".concat(_colors.BmPrimaryBlue);
|
|
144
|
+
if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
return "".concat(_colors.BmPrimaryWhite);
|
|
148
|
-
},
|
|
148
|
+
}, ''
|
|
149
149
|
/* max-width: 100%; */
|
|
150
|
-
,
|
|
150
|
+
, ''
|
|
151
151
|
/* max-height: 100%; */
|
|
152
152
|
);
|
|
153
153
|
|
|
@@ -156,6 +156,7 @@ var BmFileAttachment = function BmFileAttachment(_ref10) {
|
|
|
156
156
|
file = _ref10.file,
|
|
157
157
|
src = _ref10.src,
|
|
158
158
|
fileName = _ref10.fileName,
|
|
159
|
+
onDownload = _ref10.onDownload,
|
|
159
160
|
rest = _objectWithoutProperties(_ref10, _excluded);
|
|
160
161
|
|
|
161
162
|
return /*#__PURE__*/_react.default.createElement(FileAttachmentWrapper, _extends({
|
|
@@ -163,7 +164,8 @@ var BmFileAttachment = function BmFileAttachment(_ref10) {
|
|
|
163
164
|
}, rest), /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
164
165
|
icon: /*#__PURE__*/_react.default.createElement(_FilePresent.default, null)
|
|
165
166
|
}), fileName, /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
166
|
-
icon: /*#__PURE__*/_react.default.createElement(_Download.default, null)
|
|
167
|
+
icon: /*#__PURE__*/_react.default.createElement(_Download.default, null),
|
|
168
|
+
onClick: onDownload
|
|
167
169
|
}));
|
|
168
170
|
}; //Start of Component for Images
|
|
169
171
|
|
|
@@ -172,8 +174,8 @@ var BmImageWrapper = _styledComponents.default.div(_templateObject8 || (_templat
|
|
|
172
174
|
var state = _ref11.state;
|
|
173
175
|
|
|
174
176
|
if (state) {
|
|
175
|
-
if (state ===
|
|
176
|
-
if (state ===
|
|
177
|
+
if (state === 'inbound') return "".concat(_colors.BmPrimaryBlack);
|
|
178
|
+
if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
|
|
177
179
|
}
|
|
178
180
|
|
|
179
181
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -181,8 +183,8 @@ var BmImageWrapper = _styledComponents.default.div(_templateObject8 || (_templat
|
|
|
181
183
|
var state = _ref12.state;
|
|
182
184
|
|
|
183
185
|
if (state) {
|
|
184
|
-
if (state ===
|
|
185
|
-
if (state ===
|
|
186
|
+
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
187
|
+
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
186
188
|
}
|
|
187
189
|
|
|
188
190
|
return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -190,7 +192,7 @@ var BmImageWrapper = _styledComponents.default.div(_templateObject8 || (_templat
|
|
|
190
192
|
|
|
191
193
|
exports.BmImageWrapper = BmImageWrapper;
|
|
192
194
|
|
|
193
|
-
var BmImage = _styledComponents.default.img(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", "\n width: 100%;\n object-fit: cover;\n flex-grow: 1;\n"])),
|
|
195
|
+
var BmImage = _styledComponents.default.img(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", "\n width: 100%;\n object-fit: cover;\n flex-grow: 1;\n"])), ''
|
|
194
196
|
/* Fix width */
|
|
195
197
|
);
|
|
196
198
|
|
|
@@ -234,7 +236,7 @@ BmChat.Details = function (_ref14) {
|
|
|
234
236
|
|
|
235
237
|
return /*#__PURE__*/_react.default.createElement(Details, _extends({
|
|
236
238
|
state: state
|
|
237
|
-
}, rest), /*#__PURE__*/_react.default.createElement(MessageState, null, state ===
|
|
239
|
+
}, rest), /*#__PURE__*/_react.default.createElement(MessageState, null, state === 'inbound' && session && handleState({
|
|
238
240
|
state: state,
|
|
239
241
|
session: session
|
|
240
242
|
})), /*#__PURE__*/_react.default.createElement(MessageDetails, null, src && /*#__PURE__*/_react.default.createElement(BmImageChat, _extends({
|
|
@@ -247,15 +249,15 @@ BmChat.Details = function (_ref14) {
|
|
|
247
249
|
file: file,
|
|
248
250
|
fileName: fileName,
|
|
249
251
|
state: state
|
|
250
|
-
}, rest)), /*#__PURE__*/_react.default.createElement(MessagesSubDetails, null, displayTime && displayTime, status ===
|
|
252
|
+
}, rest)), /*#__PURE__*/_react.default.createElement(MessagesSubDetails, null, displayTime && displayTime, status === 'sent' && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
251
253
|
icon: /*#__PURE__*/_react.default.createElement(_icons.DoneAll, null),
|
|
252
254
|
color: "".concat(_colors.BmSecondaryDarkGreen),
|
|
253
255
|
size: "small"
|
|
254
|
-
}), status ===
|
|
256
|
+
}), status === 'failed' && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
255
257
|
icon: /*#__PURE__*/_react.default.createElement(_icons.Done, null),
|
|
256
258
|
color: "".concat(_colors.BmPrimaryBlack),
|
|
257
259
|
size: "small"
|
|
258
|
-
}))), /*#__PURE__*/_react.default.createElement(MessageState, null, state ===
|
|
260
|
+
}))), /*#__PURE__*/_react.default.createElement(MessageState, null, state === 'outbound' && session && handleState({
|
|
259
261
|
state: state,
|
|
260
262
|
session: session
|
|
261
263
|
})));
|
|
@@ -26,9 +26,10 @@ var _chartImg = _interopRequireDefault(require("../../../assets/chart-img.png"))
|
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
27
|
|
|
28
28
|
/* eslint-disable import/no-anonymous-default-export */
|
|
29
|
+
// TODO: ADD DESCRIPTION
|
|
29
30
|
var _default = {
|
|
30
31
|
component: _chatBody.default,
|
|
31
|
-
title:
|
|
32
|
+
title: 'components/Chat/MainChat/ChatBody'
|
|
32
33
|
};
|
|
33
34
|
exports.default = _default;
|
|
34
35
|
|
|
@@ -70,7 +71,10 @@ var ChatBody = function ChatBody() {
|
|
|
70
71
|
displayTime: /*#__PURE__*/_react.default.createElement("p", null, "10:00am"),
|
|
71
72
|
status: "failed",
|
|
72
73
|
fileName: /*#__PURE__*/_react.default.createElement("p", null, "file.csv"),
|
|
73
|
-
file: _chartImg.default
|
|
74
|
+
file: _chartImg.default,
|
|
75
|
+
onDownload: function onDownload() {
|
|
76
|
+
alert('hello');
|
|
77
|
+
}
|
|
74
78
|
})), /*#__PURE__*/_react.default.createElement(_chatBody.default.Footer, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
75
79
|
className: "chat-footer"
|
|
76
80
|
}, /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
@@ -85,7 +89,7 @@ var ChatBody = function ChatBody() {
|
|
|
85
89
|
}), /*#__PURE__*/_react.default.createElement(_input.BmInput, {
|
|
86
90
|
placeholder: "Enter Message",
|
|
87
91
|
style: {
|
|
88
|
-
flex:
|
|
92
|
+
flex: '1'
|
|
89
93
|
}
|
|
90
94
|
}), /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
91
95
|
icon: /*#__PURE__*/_react.default.createElement(_Send.default, null),
|
|
@@ -126,8 +126,7 @@ var BmProgressRing = function BmProgressRing(props) {
|
|
|
126
126
|
var circleRef = (0, _react.useRef)(null);
|
|
127
127
|
var size = props.size,
|
|
128
128
|
progress = props.progress,
|
|
129
|
-
variant = props.variant
|
|
130
|
-
children = props.children;
|
|
129
|
+
variant = props.variant;
|
|
131
130
|
var initialMeasure = measurement(size);
|
|
132
131
|
circumference = initialMeasure.circumference;
|
|
133
132
|
radius = initialMeasure.radius;
|
|
@@ -31,10 +31,11 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
31
31
|
|
|
32
32
|
var BmTabWrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 1rem;\n background: ", ";\n box-shadow: ", ";\n > *:not(:last-child) {\n margin-right: 0.5rem;\n }\n ", "\n\n &:hover {\n box-shadow: ", ";\n }\n"])), _colors.BmPrimaryWhite, function (_ref) {
|
|
33
33
|
var state = _ref.state,
|
|
34
|
-
disabled = _ref.disabled
|
|
34
|
+
disabled = _ref.disabled,
|
|
35
|
+
stateColor = _ref.stateColor;
|
|
35
36
|
|
|
36
37
|
if (state === "active" && !disabled) {
|
|
37
|
-
return "inset 0px -3px 0px ".concat(_colors.BmPrimaryBlue);
|
|
38
|
+
return "inset 0px -3px 0px ".concat(stateColor ? stateColor : _colors.BmPrimaryBlue);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
return "none";
|
|
@@ -86,6 +87,7 @@ BmTab.propTypes = {
|
|
|
86
87
|
leadingIcon: _propTypes.default.node,
|
|
87
88
|
state: _propTypes.default.string,
|
|
88
89
|
color: _propTypes.default.string,
|
|
90
|
+
stateColor: _propTypes.default.string,
|
|
89
91
|
size: _propTypes.default.string,
|
|
90
92
|
disabled: _propTypes.default.bool
|
|
91
93
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.DisabledTab = exports.BasicTab = void 0;
|
|
6
|
+
exports.default = exports.DisabledTab = exports.ColoredTab = exports.BasicTab = void 0;
|
|
7
7
|
|
|
8
8
|
var _icons = require("@material-ui/icons");
|
|
9
9
|
|
|
@@ -31,6 +31,15 @@ var _default = {
|
|
|
31
31
|
},
|
|
32
32
|
description: "State of the Tabs (optional)"
|
|
33
33
|
},
|
|
34
|
+
stateColor: {
|
|
35
|
+
control: {
|
|
36
|
+
type: "text"
|
|
37
|
+
},
|
|
38
|
+
description: "Color of the active state",
|
|
39
|
+
defaultValue: {
|
|
40
|
+
summary: "primary blue"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
34
43
|
size: {
|
|
35
44
|
options: ["small", "medium", "large"],
|
|
36
45
|
control: {
|
|
@@ -59,7 +68,7 @@ BasicTab.args = {
|
|
|
59
68
|
leadingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
60
69
|
trailingIcon: /*#__PURE__*/_react.default.createElement(_icons.KeyboardArrowDown, null),
|
|
61
70
|
disabled: false,
|
|
62
|
-
state:
|
|
71
|
+
state: "active"
|
|
63
72
|
};
|
|
64
73
|
var DisabledTab = MainTab.bind({});
|
|
65
74
|
exports.DisabledTab = DisabledTab;
|
|
@@ -68,4 +77,14 @@ DisabledTab.args = {
|
|
|
68
77
|
leadingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
69
78
|
trailingIcon: /*#__PURE__*/_react.default.createElement(_icons.KeyboardArrowDown, null),
|
|
70
79
|
disabled: true
|
|
80
|
+
};
|
|
81
|
+
var ColoredTab = MainTab.bind({});
|
|
82
|
+
exports.ColoredTab = ColoredTab;
|
|
83
|
+
ColoredTab.args = {
|
|
84
|
+
children: /*#__PURE__*/_react.default.createElement("h3", null, "Tabs"),
|
|
85
|
+
leadingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
86
|
+
trailingIcon: /*#__PURE__*/_react.default.createElement(_icons.KeyboardArrowDown, null),
|
|
87
|
+
disabled: false,
|
|
88
|
+
state: "active",
|
|
89
|
+
stateColor: "red"
|
|
71
90
|
};
|
package/package.json
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
2
|
+
"name": "beem-component",
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "dist/components/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "react-scripts start",
|
|
8
|
+
"build": "react-scripts build",
|
|
9
|
+
"test": "react-scripts test",
|
|
10
|
+
"eject": "react-scripts eject",
|
|
11
|
+
"clean": "rimraf dist",
|
|
12
|
+
"compile": "npm run clean && cross-env NODE_ENV=production babel src/lib --out-dir dist --copy-files --ignore __tests__,spec.js,test.js,stories.js,__snapshots__",
|
|
13
|
+
"storybook": "start-storybook -p 6006",
|
|
14
|
+
"build-storybook": "build-storybook"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"react": "^17.0.2",
|
|
18
|
+
"react-dom": "^17.0.2",
|
|
19
|
+
"react-scripts": "4.0.3",
|
|
20
|
+
"web-vitals": "^1.1.2"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@emotion/react": "^11.7.1",
|
|
24
|
+
"@emotion/styled": "^11.6.0",
|
|
25
|
+
"@material-ui/core": "^4.11.4",
|
|
26
|
+
"@material-ui/icons": "^4.11.2",
|
|
27
|
+
"@mui/icons-material": "^5.2.1",
|
|
28
|
+
"@mui/material": "^5.2.3",
|
|
29
|
+
"js-file-download": "^0.4.12",
|
|
30
|
+
"node-sass": "^6.0.1",
|
|
31
|
+
"polished": "^4.1.3",
|
|
32
|
+
"react": "^17.0.2",
|
|
33
|
+
"react-dom": "^17.0.2",
|
|
34
|
+
"react-router-dom": "^5.3.0",
|
|
35
|
+
"react-scripts": "4.0.3",
|
|
36
|
+
"save": "^2.4.0",
|
|
37
|
+
"styled-components": "^5.3.0",
|
|
38
|
+
"web-vitals": "^1.1.2"
|
|
39
|
+
},
|
|
40
|
+
"eslintConfig": {
|
|
41
|
+
"extends": [
|
|
42
|
+
"react-app",
|
|
43
|
+
"react-app/jest"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"browserslist": {
|
|
47
|
+
"production": [
|
|
48
|
+
">0.2%",
|
|
49
|
+
"not dead",
|
|
50
|
+
"not op_mini all"
|
|
51
|
+
],
|
|
52
|
+
"development": [
|
|
53
|
+
"last 1 chrome version",
|
|
54
|
+
"last 1 firefox version",
|
|
55
|
+
"last 1 safari version"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@babel/cli": "^7.14.8",
|
|
60
|
+
"@babel/preset-env": "^7.14.8",
|
|
61
|
+
"@babel/preset-react": "^7.14.5",
|
|
62
|
+
"cross-env": "^7.0.3",
|
|
63
|
+
"@storybook/addon-actions": "^6.3.2",
|
|
64
|
+
"@storybook/addon-controls": "^6.3.12",
|
|
65
|
+
"@storybook/addon-docs": "^6.3.12",
|
|
66
|
+
"@storybook/addon-essentials": "^6.3.12",
|
|
67
|
+
"@storybook/addon-knobs": "^6.3.1",
|
|
68
|
+
"@storybook/addon-links": "^6.3.2",
|
|
69
|
+
"@storybook/addons": "^6.4.9",
|
|
70
|
+
"@storybook/node-logger": "^6.3.2",
|
|
71
|
+
"@storybook/preset-create-react-app": "^3.2.0",
|
|
72
|
+
"@storybook/react": "^6.3.2",
|
|
73
|
+
"@storybook/theming": "^6.4.9",
|
|
74
|
+
"storybook-addon-jsx": "^7.3.14"
|
|
75
|
+
}
|
|
76
|
+
}
|
package/src/App.js
CHANGED
|
@@ -1,78 +1,87 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
BmIcons,
|
|
7
|
-
BmNoteBar,
|
|
8
|
-
BmTab,
|
|
9
|
-
BmAccordion,
|
|
10
|
-
BmBtnIcon,
|
|
11
|
-
MainWrapper,
|
|
12
|
-
BmButtonDropDown,
|
|
13
|
-
} from "./lib/components";
|
|
14
|
-
import { GlobalStyle } from "./lib/components/globalStyles";
|
|
15
|
-
import "./lib/assets/css/sidebar.scss";
|
|
16
|
-
import BmBanner from "./lib/components/BannerCard/bannerCards";
|
|
17
|
-
import { FileCopyOutlined, Home } from "@material-ui/icons";
|
|
18
|
-
import BmProgressRing from "./lib/components/ProgressRing/progressRing";
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../src/main.scss';
|
|
3
|
+
import { BmAccordion, BmTab, BmChat } from './lib/components';
|
|
4
|
+
import { GlobalStyle } from './lib/components/globalStyles';
|
|
5
|
+
import './lib/assets/css/sidebar.scss';
|
|
19
6
|
|
|
20
7
|
export const App = () => {
|
|
8
|
+
const image =
|
|
9
|
+
'https://bm-chatbot-images.s3.eu-west-1.amazonaws.com/Vector.jpg?AWSAccessKeyId=AKIAVCAYXA54EPKHSRGL&Expires=1726995050&Signature=kP4gVPac4c7Sol2PBgGZbQ2TjLM%3D';
|
|
21
10
|
return (
|
|
22
11
|
<>
|
|
23
12
|
<GlobalStyle />
|
|
24
13
|
{/* <MainWrapper> */}
|
|
25
|
-
<
|
|
26
|
-
|
|
14
|
+
<BmChat>
|
|
15
|
+
<BmChat.Body>
|
|
16
|
+
<BmChat.Details
|
|
17
|
+
state='inbound'
|
|
18
|
+
session='bot'
|
|
19
|
+
displayTime={<p>12:00pm</p>}
|
|
20
|
+
status='sent'
|
|
21
|
+
>
|
|
22
|
+
<p>Inbound Text Message</p>
|
|
23
|
+
</BmChat.Details>
|
|
24
|
+
<BmChat.Details
|
|
25
|
+
state='inbound'
|
|
26
|
+
session='live'
|
|
27
|
+
displayTime={<p>12:00pm</p>}
|
|
28
|
+
status='sent'
|
|
29
|
+
fileName={<p>chat.png</p>}
|
|
30
|
+
src={image}
|
|
31
|
+
/>
|
|
32
|
+
<BmChat.Details
|
|
33
|
+
state='inbound'
|
|
34
|
+
session='live'
|
|
35
|
+
displayTime={<p>10:00am</p>}
|
|
36
|
+
status='failed'
|
|
37
|
+
fileName={<p>file.csv</p>}
|
|
38
|
+
onDownload={() => {
|
|
39
|
+
alert('hello');
|
|
40
|
+
}}
|
|
41
|
+
file={image}
|
|
42
|
+
/>
|
|
43
|
+
<BmChat.Details
|
|
44
|
+
state='outbound'
|
|
45
|
+
session='bot'
|
|
46
|
+
displayTime={<p>12:00pm</p>}
|
|
47
|
+
status='sent'
|
|
48
|
+
>
|
|
49
|
+
<p>Outbound Text Message</p>
|
|
50
|
+
</BmChat.Details>
|
|
51
|
+
<BmChat.Details
|
|
52
|
+
state='outbound'
|
|
53
|
+
session='live'
|
|
54
|
+
displayTime={<p>12:00pm</p>}
|
|
55
|
+
status='sent'
|
|
56
|
+
fileName={<p>chat.png</p>}
|
|
57
|
+
onDownload={() => {
|
|
58
|
+
alert('hello');
|
|
59
|
+
}}
|
|
60
|
+
src={image}
|
|
61
|
+
/>
|
|
62
|
+
<BmChat.Details
|
|
63
|
+
state='outbound'
|
|
64
|
+
session='live'
|
|
65
|
+
displayTime={<p>10:00am</p>}
|
|
66
|
+
status='failed'
|
|
67
|
+
fileName={<p>file.csv</p>}
|
|
68
|
+
file={image}
|
|
69
|
+
|
|
70
|
+
/>
|
|
71
|
+
</BmChat.Body>
|
|
72
|
+
{/* <BmChat.Footer>
|
|
73
|
+
<div className='chat-footer'>
|
|
74
|
+
<BmIcons icon={<EmojiEmotionsIcon />} size='xlarge' />
|
|
75
|
+
<BmIcons icon={<AttachFileIcon />} size='xlarge' />
|
|
76
|
+
<BmIcons icon={<QuickreplyIcon />} size='xlarge' />
|
|
77
|
+
<BmInput placeholder='Enter Message' style={{ flex: '1' }} />
|
|
78
|
+
<BmIcons icon={<SendIcon />} size='xlarge' />
|
|
79
|
+
</div>
|
|
80
|
+
</BmChat.Footer> */}
|
|
81
|
+
</BmChat>
|
|
82
|
+
<BmTab state='active' stateColor='red'>
|
|
27
83
|
Hello
|
|
28
|
-
</BmNoteBar>
|
|
29
|
-
<BmButton color="purple" variant="neutral" leadingIcon={<Home />}>
|
|
30
|
-
Hello
|
|
31
|
-
</BmButton>
|
|
32
|
-
<BmBtnIcon icon={<Home />} color="red" />
|
|
33
|
-
<BmButton color="pink" variant="secondary">
|
|
34
|
-
Hello
|
|
35
|
-
</BmButton>
|
|
36
|
-
<BmButton color="pink" variant="tertiary" disabled>
|
|
37
|
-
Hello
|
|
38
|
-
</BmButton>
|
|
39
|
-
<BmBanner
|
|
40
|
-
border="dashed"
|
|
41
|
-
content="center"
|
|
42
|
-
bannerBg="default"
|
|
43
|
-
closeButton
|
|
44
|
-
color="red"
|
|
45
|
-
>
|
|
46
|
-
<BmIcons icon={<FileCopyOutlined />} />
|
|
47
|
-
<h3>Message Title</h3>
|
|
48
|
-
<p>Message Text</p>
|
|
49
|
-
<div>
|
|
50
|
-
<BmButton variant="neutral" size="small">
|
|
51
|
-
Label
|
|
52
|
-
</BmButton>
|
|
53
|
-
</div>
|
|
54
|
-
</BmBanner>
|
|
55
|
-
<BmCard>
|
|
56
|
-
<BmCard.Header>
|
|
57
|
-
<h3>Card Header</h3>
|
|
58
|
-
</BmCard.Header>
|
|
59
|
-
<BmCard.Body>
|
|
60
|
-
<p>Hello</p>
|
|
61
|
-
<BmProgressRing progress="70" size="50" />
|
|
62
|
-
</BmCard.Body>
|
|
63
|
-
<BmCard.Footer>Card Footer</BmCard.Footer>
|
|
64
|
-
</BmCard>
|
|
65
|
-
<BmProgressRing progress="70" size="45" />
|
|
66
|
-
<BmTab state="active">
|
|
67
|
-
<h3>Tabs</h3>
|
|
68
84
|
</BmTab>
|
|
69
|
-
<BmNoteBar closeButton>
|
|
70
|
-
<p>Hello</p>
|
|
71
|
-
</BmNoteBar>
|
|
72
|
-
<BmAccordion Open>
|
|
73
|
-
<BmAccordion.Title>Hello</BmAccordion.Title>
|
|
74
|
-
<BmAccordion.Body>Helloooo</BmAccordion.Body>
|
|
75
|
-
</BmAccordion>
|
|
76
85
|
{/* </MainWrapper> */}
|
|
77
86
|
</>
|
|
78
87
|
);
|
|
@@ -44,12 +44,12 @@ const BmAccordionWrapper = styled.div`
|
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
|
-
const BmAccordion = ({ children, disabled, expandIcon, Open, ...rest }) => {
|
|
47
|
+
const BmAccordion = ({ children, disabled, expandIcon, Open, expandIconPosition, ...rest }) => {
|
|
48
48
|
const [toggle, setToggle] = useState(Open ? true : false);
|
|
49
49
|
|
|
50
50
|
return (
|
|
51
51
|
<BmAccordionWrapper>
|
|
52
|
-
<Provider value={{ toggle, setToggle, disabled, expandIcon }}>
|
|
52
|
+
<Provider value={{ toggle, setToggle, disabled, expandIcon, expandIconPosition, ...rest }}>
|
|
53
53
|
{children}
|
|
54
54
|
</Provider>
|
|
55
55
|
</BmAccordionWrapper>
|
|
@@ -74,10 +74,12 @@ BmAccordion.Title = ({
|
|
|
74
74
|
: value.setToggle(false)
|
|
75
75
|
}
|
|
76
76
|
>
|
|
77
|
-
{
|
|
77
|
+
{value.expandIconPosition === "left" ||
|
|
78
|
+
(value.expandIconPosition === undefined && Dropdown(value, rest))}
|
|
78
79
|
{leadingIcon && <BmIcons icon={leadingIcon} size={size} />}
|
|
79
80
|
<BmAccordionDetails>{children}</BmAccordionDetails>
|
|
80
81
|
{trailingIcon && <BmIcons icon={trailingIcon} size={size} />}
|
|
82
|
+
{value.expandIconPosition === "right" && Dropdown(value, rest)}
|
|
81
83
|
</BmAccordionMenu>
|
|
82
84
|
)}
|
|
83
85
|
</Consumer>
|
|
@@ -94,6 +96,7 @@ BmAccordion.propTypes = {
|
|
|
94
96
|
children: PropTypes.object,
|
|
95
97
|
size: PropTypes.string,
|
|
96
98
|
expandIcon: PropTypes.string,
|
|
99
|
+
expandIconPosition: PropTypes.string,
|
|
97
100
|
leadingIcon: PropTypes.node,
|
|
98
101
|
trailingIcon: PropTypes.node,
|
|
99
102
|
disabled: PropTypes.bool,
|
|
@@ -33,6 +33,12 @@ export default {
|
|
|
33
33
|
description: "'none' or Material-UI icon (optional)",
|
|
34
34
|
defaultValue: { summary: undefined },
|
|
35
35
|
},
|
|
36
|
+
expandIconPosition: {
|
|
37
|
+
options: ["left", "right"],
|
|
38
|
+
control: { type: "select" },
|
|
39
|
+
description: "Position of the expand Icon",
|
|
40
|
+
defaultValue: { summary: "left" },
|
|
41
|
+
},
|
|
36
42
|
leadingIcon: {
|
|
37
43
|
description: "Material-UI icon(optional)",
|
|
38
44
|
defaultValue: { summary: undefined },
|
|
@@ -50,14 +56,27 @@ const optionSize = {
|
|
|
50
56
|
large: "large",
|
|
51
57
|
};
|
|
52
58
|
|
|
59
|
+
const optionExpandIcon = {
|
|
60
|
+
left: "left",
|
|
61
|
+
right: "medium",
|
|
62
|
+
};
|
|
63
|
+
|
|
53
64
|
export const Accordion = () => {
|
|
54
65
|
return (
|
|
55
66
|
<div>
|
|
56
|
-
<BmAccordion
|
|
67
|
+
<BmAccordion
|
|
68
|
+
disabled={boolean("disabled", false)}
|
|
69
|
+
Open={boolean("disabled", false)}
|
|
70
|
+
>
|
|
57
71
|
<BmAccordion.Title
|
|
58
72
|
leadingIcon={<Home />}
|
|
59
73
|
trailingIcon={<Favorite />}
|
|
60
74
|
size={select("size", optionSize, "large")}
|
|
75
|
+
expandIconPosition={select(
|
|
76
|
+
"expandIconPosition",
|
|
77
|
+
optionExpandIcon,
|
|
78
|
+
"left",
|
|
79
|
+
)}
|
|
61
80
|
>
|
|
62
81
|
<h3>{text("children", "Accordion")}</h3>
|
|
63
82
|
</BmAccordion.Title>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Done, DoneAll } from
|
|
3
|
-
import FilePresentIcon from
|
|
4
|
-
import DownloadIcon from
|
|
5
|
-
import styled from
|
|
6
|
-
import BmAvatar from
|
|
7
|
-
import { BmIcons } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Done, DoneAll } from '@material-ui/icons';
|
|
3
|
+
import FilePresentIcon from '@mui/icons-material/FilePresent';
|
|
4
|
+
import DownloadIcon from '@mui/icons-material/Download';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import BmAvatar from '../../Avatars/avatars';
|
|
7
|
+
import { BmIcons } from '../../iconStyles';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
BmPrimaryWhite,
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
BmPrimaryBlack,
|
|
13
13
|
BmSecondaryDarkGreen,
|
|
14
14
|
BmGrey200,
|
|
15
|
-
} from
|
|
15
|
+
} from '../../colors';
|
|
16
16
|
|
|
17
17
|
const BmChat = styled.div`
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-direction: column;
|
|
20
20
|
height: 100%;
|
|
21
|
-
${
|
|
21
|
+
${'' /* border: 0.071rem solid ${BmGrey400}; */}
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
24
|
BmChat.Body = styled.div`
|
|
@@ -33,13 +33,13 @@ BmChat.Body = styled.div`
|
|
|
33
33
|
const Details = styled.div`
|
|
34
34
|
display: flex;
|
|
35
35
|
justify-content: ${({ state }) => {
|
|
36
|
-
if (state ===
|
|
37
|
-
return
|
|
36
|
+
if (state === 'inbound') {
|
|
37
|
+
return 'flex-start';
|
|
38
38
|
}
|
|
39
|
-
if (state ===
|
|
40
|
-
return
|
|
39
|
+
if (state === 'outbound') {
|
|
40
|
+
return 'flex-end';
|
|
41
41
|
}
|
|
42
|
-
return
|
|
42
|
+
return 'row';
|
|
43
43
|
}};
|
|
44
44
|
> *:not(:last-child) {
|
|
45
45
|
margin-right: 1rem;
|
|
@@ -68,22 +68,22 @@ const Messages = styled.div`
|
|
|
68
68
|
padding: 0.5rem;
|
|
69
69
|
background: ${({ state }) => {
|
|
70
70
|
if (state) {
|
|
71
|
-
if (state ===
|
|
72
|
-
if (state ===
|
|
71
|
+
if (state === 'inbound') return `${BmPrimaryWhite}`;
|
|
72
|
+
if (state === 'outbound') return `${BmPrimaryBlue}`;
|
|
73
73
|
}
|
|
74
74
|
return `${BmPrimaryWhite}`;
|
|
75
75
|
}};
|
|
76
76
|
color: ${({ state }) => {
|
|
77
77
|
if (state) {
|
|
78
|
-
if (state ===
|
|
79
|
-
if (state ===
|
|
78
|
+
if (state === 'inbound') return `${BmPrimaryBlack}`;
|
|
79
|
+
if (state === 'outbound') return `${BmPrimaryWhite}`;
|
|
80
80
|
}
|
|
81
81
|
return `${BmPrimaryWhite}`;
|
|
82
82
|
}};
|
|
83
83
|
border-radius: ${({ state }) => {
|
|
84
84
|
if (state) {
|
|
85
|
-
if (state ===
|
|
86
|
-
if (state ===
|
|
85
|
+
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
86
|
+
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
87
87
|
}
|
|
88
88
|
return `${BmPrimaryWhite}`;
|
|
89
89
|
}};
|
|
@@ -103,11 +103,11 @@ const MessagesSubDetails = styled.div`
|
|
|
103
103
|
`;
|
|
104
104
|
|
|
105
105
|
const handleState = ({ session }) => {
|
|
106
|
-
if (session ===
|
|
107
|
-
return <BmAvatar size=
|
|
106
|
+
if (session === 'bot') {
|
|
107
|
+
return <BmAvatar size='small' user='chatbot' />;
|
|
108
108
|
}
|
|
109
|
-
if (session ===
|
|
110
|
-
return <BmAvatar size=
|
|
109
|
+
if (session === 'live') {
|
|
110
|
+
return <BmAvatar size='small' user='employee' />;
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
|
|
@@ -119,22 +119,22 @@ const FileAttachmentWrapper = styled.div`
|
|
|
119
119
|
padding: 1rem;
|
|
120
120
|
background: ${({ state }) => {
|
|
121
121
|
if (state) {
|
|
122
|
-
if (state ===
|
|
123
|
-
if (state ===
|
|
122
|
+
if (state === 'inbound') return `${BmPrimaryWhite}`;
|
|
123
|
+
if (state === 'outbound') return `${BmPrimaryBlue}`;
|
|
124
124
|
}
|
|
125
125
|
return `${BmPrimaryWhite}`;
|
|
126
126
|
}};
|
|
127
127
|
color: ${({ state }) => {
|
|
128
128
|
if (state) {
|
|
129
|
-
if (state ===
|
|
130
|
-
if (state ===
|
|
129
|
+
if (state === 'inbound') return `${BmPrimaryBlack}`;
|
|
130
|
+
if (state === 'outbound') return `${BmPrimaryWhite}`;
|
|
131
131
|
}
|
|
132
132
|
return `${BmPrimaryWhite}`;
|
|
133
133
|
}};
|
|
134
134
|
border-radius: ${({ state }) => {
|
|
135
135
|
if (state) {
|
|
136
|
-
if (state ===
|
|
137
|
-
if (state ===
|
|
136
|
+
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
137
|
+
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
138
138
|
}
|
|
139
139
|
return `${BmPrimaryWhite}`;
|
|
140
140
|
}};
|
|
@@ -151,22 +151,29 @@ const FileAttachmentWrapper = styled.div`
|
|
|
151
151
|
align-items: center;
|
|
152
152
|
color: ${({ state }) => {
|
|
153
153
|
if (state) {
|
|
154
|
-
if (state ===
|
|
155
|
-
if (state ===
|
|
154
|
+
if (state === 'inbound') return `${BmPrimaryBlue}`;
|
|
155
|
+
if (state === 'outbound') return `${BmPrimaryWhite}`;
|
|
156
156
|
}
|
|
157
157
|
return `${BmPrimaryWhite}`;
|
|
158
158
|
}};
|
|
159
159
|
}
|
|
160
|
-
${
|
|
161
|
-
${
|
|
160
|
+
${'' /* max-width: 100%; */}
|
|
161
|
+
${'' /* max-height: 100%; */}
|
|
162
162
|
`;
|
|
163
163
|
|
|
164
|
-
const BmFileAttachment = ({
|
|
164
|
+
const BmFileAttachment = ({
|
|
165
|
+
state,
|
|
166
|
+
file,
|
|
167
|
+
src,
|
|
168
|
+
fileName,
|
|
169
|
+
onDownload,
|
|
170
|
+
...rest
|
|
171
|
+
}) => {
|
|
165
172
|
return (
|
|
166
173
|
<FileAttachmentWrapper state={state} {...rest}>
|
|
167
174
|
<BmIcons icon={<FilePresentIcon />} />
|
|
168
175
|
{fileName}
|
|
169
|
-
<BmIcons icon={<DownloadIcon />} />
|
|
176
|
+
<BmIcons icon={<DownloadIcon />} onClick={onDownload} />
|
|
170
177
|
</FileAttachmentWrapper>
|
|
171
178
|
);
|
|
172
179
|
};
|
|
@@ -176,15 +183,15 @@ export const BmImageWrapper = styled.div`
|
|
|
176
183
|
flex-direction: column;
|
|
177
184
|
color: ${({ state }) => {
|
|
178
185
|
if (state) {
|
|
179
|
-
if (state ===
|
|
180
|
-
if (state ===
|
|
186
|
+
if (state === 'inbound') return `${BmPrimaryBlack}`;
|
|
187
|
+
if (state === 'outbound') return `${BmPrimaryWhite}`;
|
|
181
188
|
}
|
|
182
189
|
return `${BmPrimaryWhite}`;
|
|
183
190
|
}};
|
|
184
191
|
border-radius: ${({ state }) => {
|
|
185
192
|
if (state) {
|
|
186
|
-
if (state ===
|
|
187
|
-
if (state ===
|
|
193
|
+
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
194
|
+
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
188
195
|
}
|
|
189
196
|
return `${BmPrimaryWhite}`;
|
|
190
197
|
}};
|
|
@@ -192,7 +199,7 @@ export const BmImageWrapper = styled.div`
|
|
|
192
199
|
`;
|
|
193
200
|
|
|
194
201
|
export const BmImage = styled.img`
|
|
195
|
-
${
|
|
202
|
+
${'' /* Fix width */}
|
|
196
203
|
width: 100%;
|
|
197
204
|
object-fit: cover;
|
|
198
205
|
flex-grow: 1;
|
|
@@ -202,7 +209,7 @@ export const BmImageChat = ({ state, src, fileName, ...rest }) => {
|
|
|
202
209
|
return (
|
|
203
210
|
<>
|
|
204
211
|
<BmImageWrapper state={state} {...rest}>
|
|
205
|
-
<BmImage src={src} alt=
|
|
212
|
+
<BmImage src={src} alt='src' />
|
|
206
213
|
{fileName && (
|
|
207
214
|
<BmFileAttachment
|
|
208
215
|
state={state}
|
|
@@ -239,7 +246,7 @@ BmChat.Details = ({
|
|
|
239
246
|
<Details state={state} {...rest}>
|
|
240
247
|
{/* Adding for mobile */}
|
|
241
248
|
<MessageState>
|
|
242
|
-
{state ===
|
|
249
|
+
{state === 'inbound' && session && handleState({ state, session })}
|
|
243
250
|
</MessageState>
|
|
244
251
|
<MessageDetails>
|
|
245
252
|
{/* For Images */}
|
|
@@ -259,20 +266,20 @@ BmChat.Details = ({
|
|
|
259
266
|
)}
|
|
260
267
|
<MessagesSubDetails>
|
|
261
268
|
{displayTime && displayTime}
|
|
262
|
-
{status ===
|
|
269
|
+
{status === 'sent' && (
|
|
263
270
|
<BmIcons
|
|
264
271
|
icon={<DoneAll />}
|
|
265
272
|
color={`${BmSecondaryDarkGreen}`}
|
|
266
|
-
size=
|
|
273
|
+
size='small'
|
|
267
274
|
/>
|
|
268
275
|
)}
|
|
269
|
-
{status ===
|
|
270
|
-
<BmIcons icon={<Done />} color={`${BmPrimaryBlack}`} size=
|
|
276
|
+
{status === 'failed' && (
|
|
277
|
+
<BmIcons icon={<Done />} color={`${BmPrimaryBlack}`} size='small' />
|
|
271
278
|
)}
|
|
272
279
|
</MessagesSubDetails>
|
|
273
280
|
</MessageDetails>
|
|
274
281
|
<MessageState>
|
|
275
|
-
{state ===
|
|
282
|
+
{state === 'outbound' && session && handleState({ state, session })}
|
|
276
283
|
</MessageState>
|
|
277
284
|
</Details>
|
|
278
285
|
);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import React from
|
|
3
|
-
import BmChat from
|
|
4
|
-
import { BmIcons } from
|
|
5
|
-
import EmojiEmotionsIcon from
|
|
6
|
-
import AttachFileIcon from
|
|
7
|
-
import QuickreplyIcon from
|
|
8
|
-
import SendIcon from
|
|
9
|
-
import { BmInput } from
|
|
10
|
-
import image from
|
|
11
|
-
|
|
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 { BmInput } from '../../input';
|
|
10
|
+
import image from '../../../assets/chart-img.png';
|
|
11
|
+
// TODO: ADD DESCRIPTION
|
|
12
12
|
export default {
|
|
13
13
|
component: BmChat,
|
|
14
|
-
title:
|
|
14
|
+
title: 'components/Chat/MainChat/ChatBody',
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export const ChatBody = () => {
|
|
@@ -19,61 +19,64 @@ export const ChatBody = () => {
|
|
|
19
19
|
<BmChat>
|
|
20
20
|
<BmChat.Body>
|
|
21
21
|
<BmChat.Details
|
|
22
|
-
state=
|
|
23
|
-
session=
|
|
22
|
+
state='inbound'
|
|
23
|
+
session='bot'
|
|
24
24
|
displayTime={<p>12:00pm</p>}
|
|
25
|
-
status=
|
|
25
|
+
status='sent'
|
|
26
26
|
>
|
|
27
27
|
<p>Inbound Text Message</p>
|
|
28
28
|
</BmChat.Details>
|
|
29
29
|
<BmChat.Details
|
|
30
|
-
state=
|
|
31
|
-
session=
|
|
30
|
+
state='inbound'
|
|
31
|
+
session='live'
|
|
32
32
|
displayTime={<p>12:00pm</p>}
|
|
33
|
-
status=
|
|
33
|
+
status='sent'
|
|
34
34
|
fileName={<p>chat.png</p>}
|
|
35
35
|
src={image}
|
|
36
36
|
/>
|
|
37
37
|
<BmChat.Details
|
|
38
|
-
state=
|
|
39
|
-
session=
|
|
38
|
+
state='inbound'
|
|
39
|
+
session='live'
|
|
40
40
|
displayTime={<p>10:00am</p>}
|
|
41
|
-
status=
|
|
41
|
+
status='failed'
|
|
42
42
|
fileName={<p>file.csv</p>}
|
|
43
43
|
file={image}
|
|
44
44
|
/>
|
|
45
45
|
<BmChat.Details
|
|
46
|
-
state=
|
|
47
|
-
session=
|
|
46
|
+
state='outbound'
|
|
47
|
+
session='bot'
|
|
48
48
|
displayTime={<p>12:00pm</p>}
|
|
49
|
-
status=
|
|
49
|
+
status='sent'
|
|
50
50
|
>
|
|
51
51
|
<p>Outbound Text Message</p>
|
|
52
52
|
</BmChat.Details>
|
|
53
53
|
<BmChat.Details
|
|
54
|
-
state=
|
|
55
|
-
session=
|
|
54
|
+
state='outbound'
|
|
55
|
+
session='live'
|
|
56
56
|
displayTime={<p>12:00pm</p>}
|
|
57
|
-
status=
|
|
57
|
+
status='sent'
|
|
58
58
|
fileName={<p>chat.png</p>}
|
|
59
59
|
src={image}
|
|
60
60
|
/>
|
|
61
61
|
<BmChat.Details
|
|
62
|
-
state=
|
|
63
|
-
session=
|
|
62
|
+
state='outbound'
|
|
63
|
+
session='live'
|
|
64
64
|
displayTime={<p>10:00am</p>}
|
|
65
|
-
status=
|
|
65
|
+
status='failed'
|
|
66
66
|
fileName={<p>file.csv</p>}
|
|
67
67
|
file={image}
|
|
68
|
+
onDownload={() => {
|
|
69
|
+
alert('hello');
|
|
70
|
+
}}
|
|
68
71
|
/>
|
|
69
72
|
</BmChat.Body>
|
|
70
73
|
<BmChat.Footer>
|
|
71
|
-
<div className=
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
<div className='chat-footer'>
|
|
75
|
+
<BmIcons icon={<EmojiEmotionsIcon />} size='xlarge' />
|
|
76
|
+
<BmIcons icon={<AttachFileIcon />} size='xlarge' />
|
|
77
|
+
<BmIcons icon={<QuickreplyIcon />} size='xlarge' />
|
|
78
|
+
<BmInput placeholder='Enter Message' style={{ flex: '1' }} />
|
|
79
|
+
<BmIcons icon={<SendIcon />} size='xlarge' />
|
|
77
80
|
</div>
|
|
78
81
|
</BmChat.Footer>
|
|
79
82
|
</BmChat>
|
|
@@ -88,7 +88,7 @@ const Text = styled.text`
|
|
|
88
88
|
const BmProgressRing = (props) => {
|
|
89
89
|
const [offset, setOffset] = useState(0);
|
|
90
90
|
const circleRef = useRef(null);
|
|
91
|
-
const { size, progress, variant
|
|
91
|
+
const { size, progress, variant } = props;
|
|
92
92
|
|
|
93
93
|
const initialMeasure = measurement(size);
|
|
94
94
|
|
|
@@ -11,9 +11,9 @@ const BmTabWrapper = styled.div`
|
|
|
11
11
|
align-items: center;
|
|
12
12
|
padding: 1rem;
|
|
13
13
|
background: ${BmPrimaryWhite};
|
|
14
|
-
box-shadow: ${({ state, disabled }) => {
|
|
14
|
+
box-shadow: ${({ state, disabled, stateColor }) => {
|
|
15
15
|
if (state === "active" && !disabled) {
|
|
16
|
-
return `inset 0px -3px 0px ${BmPrimaryBlue}`;
|
|
16
|
+
return `inset 0px -3px 0px ${stateColor ? stateColor : BmPrimaryBlue}`;
|
|
17
17
|
}
|
|
18
18
|
return "none";
|
|
19
19
|
}};
|
|
@@ -86,6 +86,7 @@ BmTab.propTypes = {
|
|
|
86
86
|
leadingIcon: PropTypes.node,
|
|
87
87
|
state: PropTypes.string,
|
|
88
88
|
color: PropTypes.string,
|
|
89
|
+
stateColor: PropTypes.string,
|
|
89
90
|
size: PropTypes.string,
|
|
90
91
|
disabled: PropTypes.bool,
|
|
91
92
|
};
|
|
@@ -16,6 +16,11 @@ export default {
|
|
|
16
16
|
control: { type: "select" },
|
|
17
17
|
description: "State of the Tabs (optional)",
|
|
18
18
|
},
|
|
19
|
+
stateColor: {
|
|
20
|
+
control: { type: "text" },
|
|
21
|
+
description: "Color of the active state",
|
|
22
|
+
defaultValue: { summary: "primary blue" },
|
|
23
|
+
},
|
|
19
24
|
size: {
|
|
20
25
|
options: ["small", "medium", "large"],
|
|
21
26
|
control: { type: "select" },
|
|
@@ -23,8 +28,7 @@ export default {
|
|
|
23
28
|
defaultValue: { summary: "large" },
|
|
24
29
|
},
|
|
25
30
|
disabled: {
|
|
26
|
-
description:
|
|
27
|
-
"Disabled tab",
|
|
31
|
+
description: "Disabled tab",
|
|
28
32
|
},
|
|
29
33
|
},
|
|
30
34
|
};
|
|
@@ -37,7 +41,7 @@ BasicTab.args = {
|
|
|
37
41
|
leadingIcon: <Favorite />,
|
|
38
42
|
trailingIcon: <KeyboardArrowDown />,
|
|
39
43
|
disabled: false,
|
|
40
|
-
state:
|
|
44
|
+
state: "active",
|
|
41
45
|
};
|
|
42
46
|
|
|
43
47
|
export const DisabledTab = MainTab.bind({});
|
|
@@ -47,3 +51,13 @@ DisabledTab.args = {
|
|
|
47
51
|
trailingIcon: <KeyboardArrowDown />,
|
|
48
52
|
disabled: true,
|
|
49
53
|
};
|
|
54
|
+
|
|
55
|
+
export const ColoredTab = MainTab.bind({});
|
|
56
|
+
ColoredTab.args = {
|
|
57
|
+
children: <h3>Tabs</h3>,
|
|
58
|
+
leadingIcon: <Favorite />,
|
|
59
|
+
trailingIcon: <KeyboardArrowDown />,
|
|
60
|
+
disabled: false,
|
|
61
|
+
state: "active",
|
|
62
|
+
stateColor: "red",
|
|
63
|
+
};
|