beem-component 1.9.7 → 1.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ChatComponents/ContactCards/contactCards.js +2 -16
- package/dist/components/MojaAccordion/MojaAccordion.js +119 -0
- package/dist/components/index.js +7 -0
- package/package.json +1 -1
- package/src/App.js +63 -392
- package/src/lib/components/ChatComponents/ContactCards/contactCards.js +2 -5
- package/src/lib/components/MojaAccordion/MojaAccordion.js +126 -0
- package/src/lib/components/index.js +2 -0
|
@@ -1,23 +1,14 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.BmContactCheckbox = exports.BmContactCard = void 0;
|
|
8
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _colors = require("../../colors");
|
|
11
10
|
var _excluded = ["className", "checked", "label", "value", "disabled", "onChange"];
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
-
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."); }
|
|
17
|
-
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); }
|
|
18
|
-
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; }
|
|
19
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
20
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
12
|
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; }
|
|
22
13
|
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
14
|
/* eslint-disable jsx-a11y/label-has-associated-control */
|
|
@@ -50,18 +41,13 @@ var CheckboxContainer = _styledComponents.default.div.withConfig({
|
|
|
50
41
|
});
|
|
51
42
|
var BmContactCheckbox = function BmContactCheckbox(_ref4) {
|
|
52
43
|
var className = _ref4.className,
|
|
53
|
-
|
|
44
|
+
checked = _ref4.checked,
|
|
54
45
|
label = _ref4.label,
|
|
55
46
|
value = _ref4.value,
|
|
56
47
|
disabled = _ref4.disabled,
|
|
57
48
|
onChange = _ref4.onChange,
|
|
58
49
|
props = _objectWithoutProperties(_ref4, _excluded);
|
|
59
|
-
var _useState = (0, _react.useState)(defaultChecked),
|
|
60
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
61
|
-
checked = _useState2[0],
|
|
62
|
-
setChecked = _useState2[1];
|
|
63
50
|
var handleChange = function handleChange(event) {
|
|
64
|
-
setChecked(event.target.checked);
|
|
65
51
|
if (onChange) {
|
|
66
52
|
onChange(event);
|
|
67
53
|
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _icons = require("@material-ui/icons");
|
|
12
|
+
var _iconStyles = require("../iconStyles");
|
|
13
|
+
var _excluded = ["children", "disabled", "expandIcon", "Open", "expandIconPosition"],
|
|
14
|
+
_excluded2 = ["children", "leadingIcon", "trailingIcon", "size"];
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
24
|
+
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."); }
|
|
25
|
+
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); }
|
|
26
|
+
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; }
|
|
27
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
28
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
+
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; }
|
|
30
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
31
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
32
|
+
var _React$createContext = /*#__PURE__*/_react.default.createContext({}),
|
|
33
|
+
Provider = _React$createContext.Provider,
|
|
34
|
+
Consumer = _React$createContext.Consumer;
|
|
35
|
+
var Dropdown = function Dropdown(value, rest) {
|
|
36
|
+
if (value.expandIcon && value.expandIcon === 'none') {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!value.expandIcon) {
|
|
40
|
+
return value.toggle ? /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, _extends({
|
|
41
|
+
icon: /*#__PURE__*/_react.default.createElement(_icons.KeyboardArrowUp, null)
|
|
42
|
+
}, rest)) : /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, _extends({
|
|
43
|
+
icon: /*#__PURE__*/_react.default.createElement(_icons.KeyboardArrowDown, null)
|
|
44
|
+
}, rest));
|
|
45
|
+
}
|
|
46
|
+
if (value.expandIcon && value.expandIcon !== 'none') {
|
|
47
|
+
return /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
48
|
+
icon: value.expandIcon
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var BmAccordionMenu = _styledComponents.default.div.withConfig({
|
|
53
|
+
displayName: "MojaAccordion__BmAccordionMenu"
|
|
54
|
+
})(["display:flex;align-items:center;flex-direction:row;padding:0.571rem 1.143rem;background:#f9fafb;> *:not(:last-child){margin-right:0.5rem;}border-radius:0.4286rem;border:0.0714rem solid #eaecf0;"]);
|
|
55
|
+
var BmAccordionDetails = _styledComponents.default.div.withConfig({
|
|
56
|
+
displayName: "MojaAccordion__BmAccordionDetails"
|
|
57
|
+
})(["display:flex;justify-content:space-between;width:100%;"]);
|
|
58
|
+
var BmAccordionWrapper = _styledComponents.default.div.withConfig({
|
|
59
|
+
displayName: "MojaAccordion__BmAccordionWrapper"
|
|
60
|
+
})(["display:flex;flex-direction:column;"]);
|
|
61
|
+
var BmChatAccordion = function BmChatAccordion(_ref) {
|
|
62
|
+
var children = _ref.children,
|
|
63
|
+
disabled = _ref.disabled,
|
|
64
|
+
expandIcon = _ref.expandIcon,
|
|
65
|
+
Open = _ref.Open,
|
|
66
|
+
expandIconPosition = _ref.expandIconPosition,
|
|
67
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
68
|
+
var _useState = (0, _react.useState)(!!Open),
|
|
69
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
70
|
+
toggle = _useState2[0],
|
|
71
|
+
setToggle = _useState2[1];
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(BmAccordionWrapper, null, /*#__PURE__*/_react.default.createElement(Provider, {
|
|
73
|
+
value: _objectSpread({
|
|
74
|
+
toggle: toggle,
|
|
75
|
+
setToggle: setToggle,
|
|
76
|
+
disabled: disabled,
|
|
77
|
+
expandIcon: expandIcon,
|
|
78
|
+
expandIconPosition: expandIconPosition
|
|
79
|
+
}, rest)
|
|
80
|
+
}, children));
|
|
81
|
+
};
|
|
82
|
+
BmChatAccordion.Title = function (_ref2) {
|
|
83
|
+
var children = _ref2.children,
|
|
84
|
+
leadingIcon = _ref2.leadingIcon,
|
|
85
|
+
trailingIcon = _ref2.trailingIcon,
|
|
86
|
+
size = _ref2.size,
|
|
87
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(Consumer, null, function (value) {
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement(BmAccordionMenu, _extends({}, rest, {
|
|
90
|
+
onClick: function onClick() {
|
|
91
|
+
return !value.disabled || value.disabled === false ? value.setToggle(!value.toggle) : value.setToggle(false);
|
|
92
|
+
}
|
|
93
|
+
}), leadingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
94
|
+
icon: leadingIcon,
|
|
95
|
+
size: size
|
|
96
|
+
}), (value.expandIconPosition === 'left' || value.expandIconPosition === undefined) && Dropdown(value, rest), /*#__PURE__*/_react.default.createElement(BmAccordionDetails, null, children), trailingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
97
|
+
icon: trailingIcon,
|
|
98
|
+
size: size
|
|
99
|
+
}), value.expandIconPosition === 'right' && Dropdown(value, rest));
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
BmChatAccordion.Body = function (_ref3) {
|
|
103
|
+
var children = _ref3.children;
|
|
104
|
+
return /*#__PURE__*/_react.default.createElement(Consumer, null, function (value) {
|
|
105
|
+
return value.toggle && /*#__PURE__*/_react.default.createElement("div", null, children);
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
BmChatAccordion.propTypes = {
|
|
109
|
+
children: _propTypes.default.object,
|
|
110
|
+
size: _propTypes.default.string,
|
|
111
|
+
expandIcon: _propTypes.default.string,
|
|
112
|
+
expandIconPosition: _propTypes.default.string,
|
|
113
|
+
leadingIcon: _propTypes.default.node,
|
|
114
|
+
trailingIcon: _propTypes.default.node,
|
|
115
|
+
disabled: _propTypes.default.bool,
|
|
116
|
+
Open: _propTypes.default.bool
|
|
117
|
+
};
|
|
118
|
+
var _default = BmChatAccordion;
|
|
119
|
+
exports.default = _default;
|
package/dist/components/index.js
CHANGED
|
@@ -70,6 +70,12 @@ Object.defineProperty(exports, "BmChat", {
|
|
|
70
70
|
return _chatBody.default;
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
+
Object.defineProperty(exports, "BmChatAccordion", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function get() {
|
|
76
|
+
return _MojaAccordion.default;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
73
79
|
Object.defineProperty(exports, "BmChatForm", {
|
|
74
80
|
enumerable: true,
|
|
75
81
|
get: function get() {
|
|
@@ -417,6 +423,7 @@ var _buttonGroup = _interopRequireDefault(require("./ButtonGroup/buttonGroup"));
|
|
|
417
423
|
var _inputCounter = require("./InputCounter/inputCounter");
|
|
418
424
|
var _stepper = _interopRequireDefault(require("./Stepper/stepper"));
|
|
419
425
|
var _multipleDateSelector = _interopRequireDefault(require("./MultipleDateSelector/multipleDateSelector"));
|
|
426
|
+
var _MojaAccordion = _interopRequireDefault(require("./MojaAccordion/MojaAccordion"));
|
|
420
427
|
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); }
|
|
421
428
|
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; }
|
|
422
429
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// * eslint-disable func-style *
|
|
2
2
|
/* eslint-disable jsx-a11y/media-has-caption */
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
+
// import AbcIcon from '@mui/icons-material/Abc';
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
BmChat,
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
BmCounter,
|
|
11
12
|
BmTag,
|
|
12
13
|
BmContactCheckbox,
|
|
14
|
+
BmChatAccordion,
|
|
13
15
|
} from './lib/components';
|
|
14
16
|
|
|
15
17
|
const Chat = () => {
|
|
@@ -119,405 +121,51 @@ const Chat = () => {
|
|
|
119
121
|
prev_message: 'how are you????????',
|
|
120
122
|
},
|
|
121
123
|
},
|
|
122
|
-
{
|
|
123
|
-
message: 'how are you????????',
|
|
124
|
-
id: 20268,
|
|
125
|
-
time: '2024-01-22T10:03:23.000Z',
|
|
126
|
-
direction: 'inbound',
|
|
127
|
-
message_type: 'text',
|
|
128
|
-
messageId: null,
|
|
129
|
-
is_live_agent: true,
|
|
130
|
-
is_deleted: false,
|
|
131
|
-
is_comment: false,
|
|
132
|
-
channel: 'whatsapp',
|
|
133
|
-
sent_to_vendor: true,
|
|
134
|
-
replyMessageId: null,
|
|
135
|
-
agent_name: null,
|
|
136
|
-
df_agent_name: null,
|
|
137
|
-
resolve_time: null,
|
|
138
|
-
metadata: null,
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
message: 'hi\n',
|
|
142
|
-
id: 20267,
|
|
143
|
-
time: '2024-01-22T10:03:01.000Z',
|
|
144
|
-
direction: 'outbound',
|
|
145
|
-
message_type: null,
|
|
146
|
-
messageId: 'f38be83c-92b1-47a7-9e6a-0d209da0ad86',
|
|
147
|
-
is_live_agent: false,
|
|
148
|
-
is_deleted: false,
|
|
149
|
-
is_comment: false,
|
|
150
|
-
channel: 'whatsapp',
|
|
151
|
-
sent_to_vendor: true,
|
|
152
|
-
replyMessageId: null,
|
|
153
|
-
agent_name: 'arl@beem.co.tz',
|
|
154
|
-
df_agent_name: 'Dev arl',
|
|
155
|
-
resolve_time: null,
|
|
156
|
-
metadata: null,
|
|
157
|
-
statusDetails: {
|
|
158
|
-
statusCode: 3,
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
message: 'Sorry, what was that?',
|
|
163
|
-
id: 20266,
|
|
164
|
-
time: '2024-01-22T10:02:36.000Z',
|
|
165
|
-
direction: 'outbound',
|
|
166
|
-
message_type: 'text',
|
|
167
|
-
messageId: null,
|
|
168
|
-
is_live_agent: false,
|
|
169
|
-
is_deleted: false,
|
|
170
|
-
is_comment: false,
|
|
171
|
-
channel: 'whatsapp',
|
|
172
|
-
sent_to_vendor: true,
|
|
173
|
-
replyMessageId: null,
|
|
174
|
-
agent_name: null,
|
|
175
|
-
df_agent_name: null,
|
|
176
|
-
resolve_time: null,
|
|
177
|
-
metadata: null,
|
|
178
|
-
statusDetails: {
|
|
179
|
-
statusCode: 3,
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
message: 'how are you?',
|
|
184
|
-
id: 20265,
|
|
185
|
-
time: '2024-01-22T10:02:17.000Z',
|
|
186
|
-
direction: 'inbound',
|
|
187
|
-
message_type: 'text',
|
|
188
|
-
messageId: null,
|
|
189
|
-
is_live_agent: false,
|
|
190
|
-
is_deleted: false,
|
|
191
|
-
is_comment: false,
|
|
192
|
-
channel: 'whatsapp',
|
|
193
|
-
sent_to_vendor: true,
|
|
194
|
-
replyMessageId: null,
|
|
195
|
-
agent_name: null,
|
|
196
|
-
df_agent_name: null,
|
|
197
|
-
resolve_time: null,
|
|
198
|
-
metadata: null,
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
message: 'thank you for chatting with us!!! -Dev',
|
|
202
|
-
id: 20264,
|
|
203
|
-
time: '2024-01-22T09:55:00.000Z',
|
|
204
|
-
direction: 'outbound',
|
|
205
|
-
message_type: null,
|
|
206
|
-
messageId: null,
|
|
207
|
-
is_live_agent: true,
|
|
208
|
-
is_deleted: false,
|
|
209
|
-
is_comment: false,
|
|
210
|
-
channel: 'whatsapp',
|
|
211
|
-
sent_to_vendor: true,
|
|
212
|
-
replyMessageId: null,
|
|
213
|
-
agent_name: null,
|
|
214
|
-
df_agent_name: null,
|
|
215
|
-
resolve_time: null,
|
|
216
|
-
metadata: null,
|
|
217
|
-
statusDetails: {
|
|
218
|
-
statusCode: 3,
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
message: 'One more time?',
|
|
223
|
-
id: 20223,
|
|
224
|
-
time: '2024-01-19T11:00:59.000Z',
|
|
225
|
-
direction: 'outbound',
|
|
226
|
-
message_type: 'text',
|
|
227
|
-
messageId: null,
|
|
228
|
-
is_live_agent: false,
|
|
229
|
-
is_deleted: false,
|
|
230
|
-
is_comment: false,
|
|
231
|
-
channel: 'whatsapp',
|
|
232
|
-
sent_to_vendor: true,
|
|
233
|
-
replyMessageId: null,
|
|
234
|
-
agent_name: null,
|
|
235
|
-
df_agent_name: null,
|
|
236
|
-
resolve_time: null,
|
|
237
|
-
metadata: null,
|
|
238
|
-
statusDetails: {
|
|
239
|
-
statusCode: 3,
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
message: 'i am good',
|
|
244
|
-
id: 20222,
|
|
245
|
-
time: '2024-01-19T11:00:55.000Z',
|
|
246
|
-
direction: 'inbound',
|
|
247
|
-
message_type: 'text',
|
|
248
|
-
messageId: null,
|
|
249
|
-
is_live_agent: false,
|
|
250
|
-
is_deleted: false,
|
|
251
|
-
is_comment: false,
|
|
252
|
-
channel: 'whatsapp',
|
|
253
|
-
sent_to_vendor: true,
|
|
254
|
-
replyMessageId: null,
|
|
255
|
-
agent_name: null,
|
|
256
|
-
df_agent_name: null,
|
|
257
|
-
resolve_time: null,
|
|
258
|
-
metadata: {
|
|
259
|
-
id: 'ABEGJVaCQwSAAhCt33VV1Zivq9-48AP8bs_t',
|
|
260
|
-
prev_message: 'if it doesnt exists then to fetch',
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
message: 'how are you?',
|
|
265
|
-
id: 20220,
|
|
266
|
-
time: '2024-01-19T10:59:48.000Z',
|
|
267
|
-
direction: 'inbound',
|
|
268
|
-
message_type: 'text',
|
|
269
|
-
messageId: null,
|
|
270
|
-
is_live_agent: false,
|
|
271
|
-
is_deleted: false,
|
|
272
|
-
is_comment: false,
|
|
273
|
-
channel: 'whatsapp',
|
|
274
|
-
sent_to_vendor: true,
|
|
275
|
-
replyMessageId: null,
|
|
276
|
-
agent_name: null,
|
|
277
|
-
df_agent_name: null,
|
|
278
|
-
resolve_time: null,
|
|
279
|
-
metadata: null,
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
message: 'thank you for chatting with us!!! -Dev',
|
|
283
|
-
id: 20217,
|
|
284
|
-
time: '2024-01-19T09:55:00.000Z',
|
|
285
|
-
direction: 'outbound',
|
|
286
|
-
message_type: null,
|
|
287
|
-
messageId: null,
|
|
288
|
-
is_live_agent: true,
|
|
289
|
-
is_deleted: false,
|
|
290
|
-
is_comment: false,
|
|
291
|
-
channel: 'whatsapp',
|
|
292
|
-
sent_to_vendor: true,
|
|
293
|
-
replyMessageId: null,
|
|
294
|
-
agent_name: null,
|
|
295
|
-
df_agent_name: null,
|
|
296
|
-
resolve_time: null,
|
|
297
|
-
metadata: null,
|
|
298
|
-
statusDetails: {
|
|
299
|
-
statusCode: 3,
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
message: 'if it doesnt exists then to fetch',
|
|
304
|
-
id: 20208,
|
|
305
|
-
time: '2024-01-19T08:54:12.000Z',
|
|
306
|
-
direction: 'inbound',
|
|
307
|
-
message_type: 'text',
|
|
308
|
-
messageId: null,
|
|
309
|
-
is_live_agent: true,
|
|
310
|
-
is_deleted: false,
|
|
311
|
-
is_comment: false,
|
|
312
|
-
channel: 'whatsapp',
|
|
313
|
-
sent_to_vendor: true,
|
|
314
|
-
replyMessageId: null,
|
|
315
|
-
agent_name: null,
|
|
316
|
-
df_agent_name: null,
|
|
317
|
-
resolve_time: null,
|
|
318
|
-
metadata: null,
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
message: 'hi',
|
|
322
|
-
id: 20207,
|
|
323
|
-
time: '2024-01-19T08:49:23.000Z',
|
|
324
|
-
direction: 'inbound',
|
|
325
|
-
message_type: 'text',
|
|
326
|
-
messageId: null,
|
|
327
|
-
is_live_agent: true,
|
|
328
|
-
is_deleted: false,
|
|
329
|
-
is_comment: false,
|
|
330
|
-
channel: 'whatsapp',
|
|
331
|
-
sent_to_vendor: true,
|
|
332
|
-
replyMessageId: null,
|
|
333
|
-
agent_name: null,
|
|
334
|
-
df_agent_name: null,
|
|
335
|
-
resolve_time: null,
|
|
336
|
-
metadata: null,
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
message: 'hi',
|
|
340
|
-
id: 20206,
|
|
341
|
-
time: '2024-01-19T08:46:09.000Z',
|
|
342
|
-
direction: 'inbound',
|
|
343
|
-
message_type: 'text',
|
|
344
|
-
messageId: null,
|
|
345
|
-
is_live_agent: true,
|
|
346
|
-
is_deleted: false,
|
|
347
|
-
is_comment: false,
|
|
348
|
-
channel: 'whatsapp',
|
|
349
|
-
sent_to_vendor: true,
|
|
350
|
-
replyMessageId: null,
|
|
351
|
-
agent_name: null,
|
|
352
|
-
df_agent_name: null,
|
|
353
|
-
resolve_time: null,
|
|
354
|
-
metadata: null,
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
message: 'hi',
|
|
358
|
-
id: 20205,
|
|
359
|
-
time: '2024-01-19T08:43:58.000Z',
|
|
360
|
-
direction: 'inbound',
|
|
361
|
-
message_type: 'text',
|
|
362
|
-
messageId: null,
|
|
363
|
-
is_live_agent: true,
|
|
364
|
-
is_deleted: false,
|
|
365
|
-
is_comment: false,
|
|
366
|
-
channel: 'whatsapp',
|
|
367
|
-
sent_to_vendor: true,
|
|
368
|
-
replyMessageId: null,
|
|
369
|
-
agent_name: null,
|
|
370
|
-
df_agent_name: null,
|
|
371
|
-
resolve_time: null,
|
|
372
|
-
metadata: null,
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
message: 'hi',
|
|
376
|
-
id: 20204,
|
|
377
|
-
time: '2024-01-19T08:41:43.000Z',
|
|
378
|
-
direction: 'inbound',
|
|
379
|
-
message_type: 'text',
|
|
380
|
-
messageId: null,
|
|
381
|
-
is_live_agent: true,
|
|
382
|
-
is_deleted: false,
|
|
383
|
-
is_comment: false,
|
|
384
|
-
channel: 'whatsapp',
|
|
385
|
-
sent_to_vendor: true,
|
|
386
|
-
replyMessageId: null,
|
|
387
|
-
agent_name: null,
|
|
388
|
-
df_agent_name: null,
|
|
389
|
-
resolve_time: null,
|
|
390
|
-
metadata: null,
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
message: 'hi',
|
|
394
|
-
id: 20201,
|
|
395
|
-
time: '2024-01-19T08:40:27.000Z',
|
|
396
|
-
direction: 'inbound',
|
|
397
|
-
message_type: 'text',
|
|
398
|
-
messageId: null,
|
|
399
|
-
is_live_agent: true,
|
|
400
|
-
is_deleted: false,
|
|
401
|
-
is_comment: false,
|
|
402
|
-
channel: 'whatsapp',
|
|
403
|
-
sent_to_vendor: true,
|
|
404
|
-
replyMessageId: null,
|
|
405
|
-
agent_name: null,
|
|
406
|
-
df_agent_name: null,
|
|
407
|
-
resolve_time: null,
|
|
408
|
-
metadata: null,
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
message: 'hi',
|
|
412
|
-
id: 20200,
|
|
413
|
-
time: '2024-01-19T08:39:19.000Z',
|
|
414
|
-
direction: 'inbound',
|
|
415
|
-
message_type: 'text',
|
|
416
|
-
messageId: null,
|
|
417
|
-
is_live_agent: true,
|
|
418
|
-
is_deleted: false,
|
|
419
|
-
is_comment: false,
|
|
420
|
-
channel: 'whatsapp',
|
|
421
|
-
sent_to_vendor: true,
|
|
422
|
-
replyMessageId: null,
|
|
423
|
-
agent_name: null,
|
|
424
|
-
df_agent_name: null,
|
|
425
|
-
resolve_time: null,
|
|
426
|
-
metadata: null,
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
message: 'hi',
|
|
430
|
-
id: 20199,
|
|
431
|
-
time: '2024-01-19T08:37:26.000Z',
|
|
432
|
-
direction: 'inbound',
|
|
433
|
-
message_type: 'text',
|
|
434
|
-
messageId: null,
|
|
435
|
-
is_live_agent: true,
|
|
436
|
-
is_deleted: false,
|
|
437
|
-
is_comment: false,
|
|
438
|
-
channel: 'whatsapp',
|
|
439
|
-
sent_to_vendor: true,
|
|
440
|
-
replyMessageId: null,
|
|
441
|
-
agent_name: null,
|
|
442
|
-
df_agent_name: null,
|
|
443
|
-
resolve_time: null,
|
|
444
|
-
metadata: null,
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
message: 'hi',
|
|
448
|
-
id: 20198,
|
|
449
|
-
time: '2024-01-19T08:36:57.000Z',
|
|
450
|
-
direction: 'inbound',
|
|
451
|
-
message_type: 'text',
|
|
452
|
-
messageId: null,
|
|
453
|
-
is_live_agent: true,
|
|
454
|
-
is_deleted: false,
|
|
455
|
-
is_comment: false,
|
|
456
|
-
channel: 'whatsapp',
|
|
457
|
-
sent_to_vendor: true,
|
|
458
|
-
replyMessageId: null,
|
|
459
|
-
agent_name: null,
|
|
460
|
-
df_agent_name: null,
|
|
461
|
-
resolve_time: null,
|
|
462
|
-
metadata: null,
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
message: 'hi',
|
|
466
|
-
id: 20150,
|
|
467
|
-
time: '2024-01-18T12:47:26.000Z',
|
|
468
|
-
direction: 'inbound',
|
|
469
|
-
message_type: 'text',
|
|
470
|
-
messageId: null,
|
|
471
|
-
is_live_agent: true,
|
|
472
|
-
is_deleted: false,
|
|
473
|
-
is_comment: false,
|
|
474
|
-
channel: 'whatsapp',
|
|
475
|
-
sent_to_vendor: true,
|
|
476
|
-
replyMessageId: null,
|
|
477
|
-
agent_name: null,
|
|
478
|
-
df_agent_name: null,
|
|
479
|
-
resolve_time: null,
|
|
480
|
-
metadata: null,
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
message: 'https://bm-chatbot-images.s3.eu-west-1.amazonaws.com/short.jpg',
|
|
484
|
-
id: 20147,
|
|
485
|
-
time: '2024-01-18T09:57:52.000Z',
|
|
486
|
-
direction: 'outbound',
|
|
487
|
-
message_type: 'image/png',
|
|
488
|
-
messageId: 'ea15131f-2c55-43a3-b166-c38a2c4314b1',
|
|
489
|
-
is_live_agent: true,
|
|
490
|
-
is_deleted: false,
|
|
491
|
-
is_comment: false,
|
|
492
|
-
channel: 'whatsapp',
|
|
493
|
-
sent_to_vendor: true,
|
|
494
|
-
replyMessageId: null,
|
|
495
|
-
agent_name: 'arl@beem.co.tz',
|
|
496
|
-
df_agent_name: 'Dev arl',
|
|
497
|
-
resolve_time: null,
|
|
498
|
-
metadata: null,
|
|
499
|
-
statusDetails: {
|
|
500
|
-
statusCode: 3,
|
|
501
|
-
},
|
|
502
|
-
},
|
|
503
124
|
];
|
|
504
125
|
// State to manage the visibility of checkboxes
|
|
505
|
-
const [checkboxVisibility, setCheckboxVisibility] = useState(
|
|
126
|
+
const [checkboxVisibility, setCheckboxVisibility] = useState(msg);
|
|
506
127
|
|
|
507
128
|
// Handler function for the checkbox change event
|
|
508
|
-
const handleCheckboxChange = (
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
129
|
+
const handleCheckboxChange = (id) => {
|
|
130
|
+
// e.stopImmediatePropagation();
|
|
131
|
+
const updatedData = checkboxVisibility.map((user) => {
|
|
132
|
+
if (user.id === id) {
|
|
133
|
+
return {
|
|
134
|
+
...user,
|
|
135
|
+
checked: !user.checked,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return user;
|
|
139
|
+
});
|
|
140
|
+
setCheckboxVisibility(updatedData);
|
|
512
141
|
};
|
|
142
|
+
|
|
143
|
+
const selectAll = () => {
|
|
144
|
+
const updatedData = checkboxVisibility.map((user) => {
|
|
145
|
+
return {
|
|
146
|
+
...user,
|
|
147
|
+
checked: true,
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
setCheckboxVisibility(updatedData);
|
|
151
|
+
};
|
|
152
|
+
|
|
513
153
|
return (
|
|
514
154
|
<>
|
|
515
155
|
<GlobalStyle />
|
|
516
156
|
|
|
517
157
|
<BmChat>
|
|
518
158
|
<BmChat.Body>
|
|
519
|
-
|
|
520
|
-
|
|
159
|
+
<button type="button" onClick={selectAll}>
|
|
160
|
+
all
|
|
161
|
+
</button>
|
|
162
|
+
{checkboxVisibility.map((ms) => (
|
|
163
|
+
<BmContactCard
|
|
164
|
+
isVisible={ms.checked}
|
|
165
|
+
onClick={() => {
|
|
166
|
+
console.log('parent');
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
521
169
|
<BmContactCard.Profile>
|
|
522
170
|
<BmAvatar user="chatbot" size="medium" />
|
|
523
171
|
</BmContactCard.Profile>
|
|
@@ -525,12 +173,12 @@ const Chat = () => {
|
|
|
525
173
|
<BmContactCard.SubDetails>
|
|
526
174
|
<h3>Contact Names</h3>
|
|
527
175
|
<BmContactCheckbox
|
|
528
|
-
isVisible={
|
|
529
|
-
onChange={(
|
|
176
|
+
isVisible={ms.checked}
|
|
177
|
+
onChange={(e) => {
|
|
530
178
|
console.log(1);
|
|
531
|
-
handleCheckboxChange(
|
|
179
|
+
handleCheckboxChange(ms.id, e);
|
|
532
180
|
}}
|
|
533
|
-
checked={
|
|
181
|
+
checked={ms.checked}
|
|
534
182
|
/>
|
|
535
183
|
</BmContactCard.SubDetails>
|
|
536
184
|
<BmContactCard.SubDetails>
|
|
@@ -546,6 +194,29 @@ const Chat = () => {
|
|
|
546
194
|
))}
|
|
547
195
|
</BmChat.Body>
|
|
548
196
|
</BmChat>
|
|
197
|
+
<div>
|
|
198
|
+
<BmChatAccordion Open={false} expandIconPosition="right">
|
|
199
|
+
<BmChatAccordion.Title
|
|
200
|
+
// trailingIcon={<AbcIcon />}
|
|
201
|
+
// leadingIcon={<AbcIcon />}
|
|
202
|
+
>
|
|
203
|
+
<h3>tesxcxcxt</h3>
|
|
204
|
+
</BmChatAccordion.Title>
|
|
205
|
+
<BmChatAccordion.Body>
|
|
206
|
+
<div
|
|
207
|
+
style={{
|
|
208
|
+
marginTop: '.8571rem',
|
|
209
|
+
border: '.0714rem solid black',
|
|
210
|
+
borderRadius: '.4286rem',
|
|
211
|
+
padding: '.4286rem',
|
|
212
|
+
}}
|
|
213
|
+
>
|
|
214
|
+
<p>defdsfsdfsd</p>
|
|
215
|
+
<p>dsfsdfsdfdsfdsfsdf</p>
|
|
216
|
+
</div>
|
|
217
|
+
</BmChatAccordion.Body>
|
|
218
|
+
</BmChatAccordion>
|
|
219
|
+
</div>
|
|
549
220
|
</>
|
|
550
221
|
);
|
|
551
222
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import {
|
|
4
4
|
BmSecondaryBlue12,
|
|
5
5
|
BmGrey400,
|
|
@@ -52,17 +52,14 @@ const CheckboxContainer = styled.div`
|
|
|
52
52
|
|
|
53
53
|
export const BmContactCheckbox = ({
|
|
54
54
|
className,
|
|
55
|
-
checked
|
|
55
|
+
checked,
|
|
56
56
|
label,
|
|
57
57
|
value,
|
|
58
58
|
disabled,
|
|
59
59
|
onChange,
|
|
60
60
|
...props
|
|
61
61
|
}) => {
|
|
62
|
-
const [checked, setChecked] = useState(defaultChecked);
|
|
63
|
-
|
|
64
62
|
const handleChange = (event) => {
|
|
65
|
-
setChecked(event.target.checked);
|
|
66
63
|
if (onChange) {
|
|
67
64
|
onChange(event);
|
|
68
65
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/* eslint-disable react/display-name */
|
|
2
|
+
/* eslint-disable react/destructuring-assignment */
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { KeyboardArrowDown, KeyboardArrowUp } from '@material-ui/icons';
|
|
7
|
+
import { BmIcons } from '../iconStyles';
|
|
8
|
+
|
|
9
|
+
const { Provider, Consumer } = React.createContext({});
|
|
10
|
+
|
|
11
|
+
const Dropdown = (value, rest) => {
|
|
12
|
+
if (value.expandIcon && value.expandIcon === 'none') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!value.expandIcon) {
|
|
16
|
+
return value.toggle ? (
|
|
17
|
+
<BmIcons icon={<KeyboardArrowUp />} {...rest} />
|
|
18
|
+
) : (
|
|
19
|
+
<BmIcons icon={<KeyboardArrowDown />} {...rest} />
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
if (value.expandIcon && value.expandIcon !== 'none') {
|
|
23
|
+
return <BmIcons icon={value.expandIcon} />;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const BmAccordionMenu = styled.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
padding: 0.571rem 1.143rem;
|
|
31
|
+
background: #f9fafb;
|
|
32
|
+
> *:not(:last-child) {
|
|
33
|
+
margin-right: 0.5rem;
|
|
34
|
+
}
|
|
35
|
+
border-radius: 0.4286rem;
|
|
36
|
+
border: 0.0714rem solid #eaecf0;
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const BmAccordionDetails = styled.div`
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
width: 100%;
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
const BmAccordionWrapper = styled.div`
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
const BmChatAccordion = ({
|
|
51
|
+
children,
|
|
52
|
+
disabled,
|
|
53
|
+
expandIcon,
|
|
54
|
+
Open,
|
|
55
|
+
expandIconPosition,
|
|
56
|
+
...rest
|
|
57
|
+
}) => {
|
|
58
|
+
const [toggle, setToggle] = useState(!!Open);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<BmAccordionWrapper>
|
|
62
|
+
<Provider
|
|
63
|
+
value={{
|
|
64
|
+
toggle,
|
|
65
|
+
setToggle,
|
|
66
|
+
disabled,
|
|
67
|
+
expandIcon,
|
|
68
|
+
expandIconPosition,
|
|
69
|
+
...rest,
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{children}
|
|
73
|
+
</Provider>
|
|
74
|
+
</BmAccordionWrapper>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
BmChatAccordion.Title = ({
|
|
79
|
+
children,
|
|
80
|
+
leadingIcon,
|
|
81
|
+
trailingIcon,
|
|
82
|
+
size,
|
|
83
|
+
...rest
|
|
84
|
+
}) => {
|
|
85
|
+
return (
|
|
86
|
+
<Consumer>
|
|
87
|
+
{(value) => (
|
|
88
|
+
<BmAccordionMenu
|
|
89
|
+
{...rest}
|
|
90
|
+
onClick={() =>
|
|
91
|
+
!value.disabled || value.disabled === false
|
|
92
|
+
? value.setToggle(!value.toggle)
|
|
93
|
+
: value.setToggle(false)
|
|
94
|
+
}
|
|
95
|
+
>
|
|
96
|
+
{leadingIcon && <BmIcons icon={leadingIcon} size={size} />}
|
|
97
|
+
{(value.expandIconPosition === 'left' ||
|
|
98
|
+
value.expandIconPosition === undefined) &&
|
|
99
|
+
Dropdown(value, rest)}
|
|
100
|
+
<BmAccordionDetails>{children}</BmAccordionDetails>
|
|
101
|
+
{trailingIcon && <BmIcons icon={trailingIcon} size={size} />}
|
|
102
|
+
{value.expandIconPosition === 'right' && Dropdown(value, rest)}
|
|
103
|
+
</BmAccordionMenu>
|
|
104
|
+
)}
|
|
105
|
+
</Consumer>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
BmChatAccordion.Body = ({ children }) => {
|
|
110
|
+
return (
|
|
111
|
+
<Consumer>{(value) => value.toggle && <div>{children}</div>}</Consumer>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
BmChatAccordion.propTypes = {
|
|
116
|
+
children: PropTypes.object,
|
|
117
|
+
size: PropTypes.string,
|
|
118
|
+
expandIcon: PropTypes.string,
|
|
119
|
+
expandIconPosition: PropTypes.string,
|
|
120
|
+
leadingIcon: PropTypes.node,
|
|
121
|
+
trailingIcon: PropTypes.node,
|
|
122
|
+
disabled: PropTypes.bool,
|
|
123
|
+
Open: PropTypes.bool,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default BmChatAccordion;
|
|
@@ -73,6 +73,7 @@ import BmButtonGroup from './ButtonGroup/buttonGroup';
|
|
|
73
73
|
import { BmInputCounter } from './InputCounter/inputCounter';
|
|
74
74
|
import BmStepper from './Stepper/stepper';
|
|
75
75
|
import BmMultiDateSelector from './MultipleDateSelector/multipleDateSelector';
|
|
76
|
+
import BmChatAccordion from './MojaAccordion/MojaAccordion';
|
|
76
77
|
|
|
77
78
|
export {
|
|
78
79
|
BmAccordion,
|
|
@@ -123,6 +124,7 @@ export {
|
|
|
123
124
|
BmSegmentCompleteContent,
|
|
124
125
|
BmSegmentCompleteIcon,
|
|
125
126
|
BmSegmentCreateContent,
|
|
127
|
+
BmChatAccordion,
|
|
126
128
|
// Icons (Remove unused ones and check on the sizing for custom icons)
|
|
127
129
|
BmAvatarIcon,
|
|
128
130
|
BmIcons,
|