beem-component 1.3.9 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 === "inbound") {
50
- return "flex-start";
49
+ if (state === 'inbound') {
50
+ return 'flex-start';
51
51
  }
52
52
 
53
- if (state === "outbound") {
54
- return "flex-end";
53
+ if (state === 'outbound') {
54
+ return 'flex-end';
55
55
  }
56
56
 
57
- return "row";
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 === "inbound") return "".concat(_colors.BmPrimaryWhite);
67
- if (state === "outbound") return "".concat(_colors.BmPrimaryBlue);
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 === "inbound") return "".concat(_colors.BmPrimaryBlack);
76
- if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
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 === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
85
- if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
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 === "bot") {
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 === "live") {
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 === "inbound") return "".concat(_colors.BmPrimaryWhite);
117
- if (state === "outbound") return "".concat(_colors.BmPrimaryBlue);
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 === "inbound") return "".concat(_colors.BmPrimaryBlack);
126
- if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
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 === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
135
- if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
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 === "inbound") return "".concat(_colors.BmPrimaryBlue);
144
- if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
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 === "inbound") return "".concat(_colors.BmPrimaryBlack);
176
- if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
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 === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
185
- if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
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 === "inbound" && session && handleState({
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 === "sent" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
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 === "failed" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
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 === "outbound" && session && handleState({
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: "components/Chat/MainChat/ChatBody"
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: "1"
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: 'active'
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,6 +1,6 @@
1
1
  {
2
2
  "name": "beem-component",
3
- "version": "1.3.9",
3
+ "version": "1.4.2",
4
4
  "private": false,
5
5
  "main": "dist/components/index.js",
6
6
  "scripts": {
package/src/App.js CHANGED
@@ -1,21 +1,87 @@
1
- import React from "react";
2
- import "../src/main.scss";
3
- import {
4
- BmAccordion,
5
- } from "./lib/components";
6
- import { GlobalStyle } from "./lib/components/globalStyles";
7
- import "./lib/assets/css/sidebar.scss";
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';
8
6
 
9
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';
10
10
  return (
11
11
  <>
12
12
  <GlobalStyle />
13
13
  {/* <MainWrapper> */}
14
- <BmAccordion>
15
- <BmAccordion.Title>
16
- <p>Hello</p>
17
- </BmAccordion.Title>
18
- </BmAccordion>
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'>
83
+ Hello
84
+ </BmTab>
19
85
  {/* </MainWrapper> */}
20
86
  </>
21
87
  );