beem-component 1.4.4 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ChatComponents/ChatBody/chatBody.js +1 -1
- package/dist/components/Modals/modal.js +1 -1
- package/dist/components/Tags/tags.js +67 -13
- package/dist/components/Tags/tags.stories.js +29 -8
- package/package.json +1 -1
- package/src/App.js +6 -81
- package/src/index.js +1 -1
- package/src/lib/components/ChatComponents/ChatBody/chatBody.js +1 -1
- package/src/lib/components/Modals/modal.js +1 -0
- package/src/lib/components/Tags/tags.js +31 -8
- package/src/lib/components/Tags/tags.stories.js +24 -7
- package/dist/components/Modals/modal copy.js +0 -160
- package/src/lib/components/Modals/modal copy.js +0 -159
|
@@ -41,7 +41,7 @@ var BmChat = _styledComponents.default.div(_templateObject || (_templateObject =
|
|
|
41
41
|
/* border: 0.071rem solid ${BmGrey400}; */
|
|
42
42
|
);
|
|
43
43
|
|
|
44
|
-
BmChat.Body = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column-reverse;\n padding: 0rem
|
|
44
|
+
BmChat.Body = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column-reverse;\n padding: 0rem 1rem;\n flex-grow: 1;\n overflow: auto;\n height: 100%;\n"])));
|
|
45
45
|
|
|
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;
|
|
@@ -112,7 +112,7 @@ var BmModal = function BmModal(_ref) {
|
|
|
112
112
|
|
|
113
113
|
exports.BmModal = BmModal;
|
|
114
114
|
|
|
115
|
-
var ModalHeader = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n"])));
|
|
115
|
+
var ModalHeader = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items:center;\n"])));
|
|
116
116
|
|
|
117
117
|
BmModal.Header = function (_ref2) {
|
|
118
118
|
var children = _ref2.children,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.BmTag = void 0;
|
|
7
9
|
|
|
8
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
10
12
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
13
|
|
|
@@ -15,18 +17,36 @@ var _iconStyles = require("../iconStyles");
|
|
|
15
17
|
|
|
16
18
|
var _colors = require("../../components/colors");
|
|
17
19
|
|
|
18
|
-
var
|
|
20
|
+
var _icons = require("@material-ui/icons");
|
|
21
|
+
|
|
22
|
+
var _excluded = ["variant", "size", "disabled", "children", "leadingIcon", "trailingIcon", "color", "closeButton", "onHide"];
|
|
19
23
|
|
|
20
24
|
var _templateObject;
|
|
21
25
|
|
|
22
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
27
|
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
24
32
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
33
|
|
|
26
34
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
35
|
|
|
28
36
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
29
37
|
|
|
38
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
+
|
|
40
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
+
|
|
42
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43
|
+
|
|
44
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
45
|
+
|
|
46
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
+
|
|
48
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
+
|
|
30
50
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
31
51
|
|
|
32
52
|
var Color = function Color(_ref) {
|
|
@@ -44,25 +64,36 @@ var Color = function Color(_ref) {
|
|
|
44
64
|
return "".concat(_colors.BmPrimaryBlack);
|
|
45
65
|
};
|
|
46
66
|
|
|
47
|
-
var BeemTag = _styledComponents.default.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display:
|
|
48
|
-
|
|
67
|
+
var BeemTag = _styledComponents.default.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n display: ", ";\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 0.25rem 0.5rem;\n border-radius: 0.25rem;\n background: ", ";\n border: 0.071rem solid\n ", ";\n > * {\n color: ", ";\n text-transform: uppercase;\n }\n\n > *:not(:last-child) {\n margin-right: 0.5rem;\n }\n"])), ""
|
|
68
|
+
/* display: flex; */
|
|
69
|
+
, function (_ref2) {
|
|
70
|
+
var closeButton = _ref2.closeButton,
|
|
71
|
+
show = _ref2.show;
|
|
72
|
+
|
|
73
|
+
if (!closeButton) {
|
|
74
|
+
return "flex";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return show ? "flex" : "none";
|
|
78
|
+
}, function (_ref3) {
|
|
79
|
+
var variant = _ref3.variant;
|
|
49
80
|
if (variant === "neutral") return "".concat(_colors.BmGrey100);
|
|
50
81
|
if (variant === "success") return "".concat(_colors.BmSecondaryDarkGreen);
|
|
51
82
|
if (variant === "warning") return "".concat(_colors.BmPrimaryGold);
|
|
52
83
|
if (variant === "danger") return "".concat(_colors.BmSecondaryRed);
|
|
53
84
|
if (variant === "light") return "".concat(_colors.BmPrimaryWhite);
|
|
54
85
|
if (!variant) return "".concat(_colors.BmGrey100);
|
|
55
|
-
}, function (
|
|
56
|
-
var variant =
|
|
86
|
+
}, function (_ref4) {
|
|
87
|
+
var variant = _ref4.variant;
|
|
57
88
|
if (variant === "neutral") return "".concat(_colors.BmGrey100);
|
|
58
89
|
if (variant === "success") return "".concat(_colors.BmSecondaryDarkGreen);
|
|
59
90
|
if (variant === "warning") return "".concat(_colors.BmPrimaryGold);
|
|
60
91
|
if (variant === "danger") return "".concat(_colors.BmSecondaryRed);
|
|
61
92
|
if (variant === "light") return "".concat(_colors.BmGrey400);
|
|
62
93
|
return "".concat(_colors.BmGrey100);
|
|
63
|
-
}, function (
|
|
64
|
-
var variant =
|
|
65
|
-
color =
|
|
94
|
+
}, function (_ref5) {
|
|
95
|
+
var variant = _ref5.variant,
|
|
96
|
+
color = _ref5.color;
|
|
66
97
|
return Color({
|
|
67
98
|
variant: variant,
|
|
68
99
|
color: color
|
|
@@ -70,6 +101,11 @@ var BeemTag = _styledComponents.default.button(_templateObject || (_templateObje
|
|
|
70
101
|
});
|
|
71
102
|
|
|
72
103
|
var BmTag = function BmTag(props) {
|
|
104
|
+
var _useState = (0, _react.useState)(true),
|
|
105
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
106
|
+
toggle = _useState2[0],
|
|
107
|
+
setToggle = _useState2[1];
|
|
108
|
+
|
|
73
109
|
var variant = props.variant,
|
|
74
110
|
size = props.size,
|
|
75
111
|
disabled = props.disabled,
|
|
@@ -77,6 +113,8 @@ var BmTag = function BmTag(props) {
|
|
|
77
113
|
leadingIcon = props.leadingIcon,
|
|
78
114
|
trailingIcon = props.trailingIcon,
|
|
79
115
|
color = props.color,
|
|
116
|
+
closeButton = props.closeButton,
|
|
117
|
+
onHide = props.onHide,
|
|
80
118
|
rest = _objectWithoutProperties(props, _excluded);
|
|
81
119
|
|
|
82
120
|
return /*#__PURE__*/_react.default.createElement(BeemTag, _extends({
|
|
@@ -84,7 +122,9 @@ var BmTag = function BmTag(props) {
|
|
|
84
122
|
variant: variant,
|
|
85
123
|
disabled: disabled,
|
|
86
124
|
children: children,
|
|
87
|
-
color: color
|
|
125
|
+
color: color,
|
|
126
|
+
closeButton: closeButton,
|
|
127
|
+
show: toggle
|
|
88
128
|
}, rest), leadingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
89
129
|
disabled: disabled,
|
|
90
130
|
icon: leadingIcon,
|
|
@@ -93,7 +133,7 @@ var BmTag = function BmTag(props) {
|
|
|
93
133
|
color: color,
|
|
94
134
|
variant: variant
|
|
95
135
|
}),
|
|
96
|
-
size: size ||
|
|
136
|
+
size: size || "small"
|
|
97
137
|
}), children, trailingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
98
138
|
icon: trailingIcon,
|
|
99
139
|
disabled: disabled,
|
|
@@ -101,7 +141,20 @@ var BmTag = function BmTag(props) {
|
|
|
101
141
|
color: color,
|
|
102
142
|
variant: variant
|
|
103
143
|
}),
|
|
104
|
-
size: size ||
|
|
144
|
+
size: size || "small"
|
|
145
|
+
}), closeButton && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
146
|
+
icon: /*#__PURE__*/_react.default.createElement(_icons.Clear, null),
|
|
147
|
+
color: Color({
|
|
148
|
+
color: color,
|
|
149
|
+
variant: variant
|
|
150
|
+
}),
|
|
151
|
+
size: size ? size : "small",
|
|
152
|
+
style: {
|
|
153
|
+
marginLeft: "auto"
|
|
154
|
+
},
|
|
155
|
+
onClick: function onClick() {
|
|
156
|
+
return onHide && onHide(setToggle(!toggle));
|
|
157
|
+
}
|
|
105
158
|
}));
|
|
106
159
|
};
|
|
107
160
|
|
|
@@ -112,5 +165,6 @@ BmTag.propTypes = {
|
|
|
112
165
|
leadingIcon: _propTypes.default.node,
|
|
113
166
|
color: _propTypes.default.string,
|
|
114
167
|
size: _propTypes.default.string,
|
|
115
|
-
variant: _propTypes.default.string
|
|
168
|
+
variant: _propTypes.default.string,
|
|
169
|
+
closeButton: _propTypes.default.bool
|
|
116
170
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.
|
|
6
|
+
exports.default = exports.TagsWithCloseButton = exports.Tags = void 0;
|
|
7
7
|
|
|
8
8
|
var _icons = require("@material-ui/icons");
|
|
9
9
|
|
|
@@ -24,6 +24,15 @@ var _default = {
|
|
|
24
24
|
},
|
|
25
25
|
description: "Color of the Icons and Text, will work only if variant is not present"
|
|
26
26
|
},
|
|
27
|
+
closeButton: {
|
|
28
|
+
control: {
|
|
29
|
+
type: "boolean"
|
|
30
|
+
},
|
|
31
|
+
description: "Will display (x) - Optional"
|
|
32
|
+
},
|
|
33
|
+
onHide: {
|
|
34
|
+
description: "Handles closing of tags, will only work if closeButton is present (Optional)"
|
|
35
|
+
},
|
|
27
36
|
size: {
|
|
28
37
|
options: ["xsmall", "small", "medium", "large", "xlarge"],
|
|
29
38
|
control: {
|
|
@@ -48,15 +57,27 @@ var _default = {
|
|
|
48
57
|
};
|
|
49
58
|
exports.default = _default;
|
|
50
59
|
|
|
51
|
-
var
|
|
60
|
+
var MainTag = function MainTag(args) {
|
|
52
61
|
return /*#__PURE__*/_react.default.createElement(_tags.BmTag, args);
|
|
53
62
|
};
|
|
54
63
|
|
|
55
|
-
var
|
|
56
|
-
exports.
|
|
57
|
-
|
|
58
|
-
children: /*#__PURE__*/_react.default.createElement("p", null, "
|
|
64
|
+
var Tags = MainTag.bind({});
|
|
65
|
+
exports.Tags = Tags;
|
|
66
|
+
Tags.args = {
|
|
67
|
+
children: /*#__PURE__*/_react.default.createElement("p", null, "Tags"),
|
|
59
68
|
leadingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
60
69
|
trailingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
61
|
-
variant:
|
|
62
|
-
};
|
|
70
|
+
variant: "success"
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var TagsWithCloseButton = function TagsWithCloseButton() {
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(_tags.BmTag, {
|
|
75
|
+
variant: "light",
|
|
76
|
+
closeButton: true,
|
|
77
|
+
onHide: function onHide() {
|
|
78
|
+
return console.log("Hide Tag");
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, "TAG"));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.TagsWithCloseButton = TagsWithCloseButton;
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -1,88 +1,13 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
3
|
-
import { BmTab, BmChat } from './lib/components';
|
|
4
|
-
import { GlobalStyle } from './lib/components/globalStyles';
|
|
5
|
-
import './lib/assets/css/sidebar.scss';
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BmTag, GlobalStyle } from "./lib/components";
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
const image =
|
|
9
|
-
'https://bm-chatbot-images.s3.eu-west-1.amazonaws.com/Vector.jpg?AWSAccessKeyId=AKIAVCAYXA54EPKHSRGL&Expires=1726995050&Signature=kP4gVPac4c7Sol2PBgGZbQ2TjLM%3D';
|
|
4
|
+
const App = () => {
|
|
10
5
|
return (
|
|
11
6
|
<>
|
|
12
7
|
<GlobalStyle />
|
|
13
|
-
{
|
|
14
|
-
|
|
15
|
-
|
|
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>
|
|
85
|
-
{/* </MainWrapper> */}
|
|
8
|
+
<BmTag variant="success" closeButton onHide={() => console.log("aaaaa")}>
|
|
9
|
+
<p>hello</p>
|
|
10
|
+
</BmTag>
|
|
86
11
|
</>
|
|
87
12
|
);
|
|
88
13
|
};
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { BmIcons } from "../iconStyles";
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
BmGrey400,
|
|
12
12
|
BmPrimaryGold,
|
|
13
13
|
} from "../../components/colors";
|
|
14
|
+
import { Clear } from "@material-ui/icons";
|
|
14
15
|
|
|
15
16
|
const Color = ({ variant, color }) => {
|
|
16
17
|
if (variant === "success" || variant === "warning" || variant === "danger") {
|
|
@@ -23,11 +24,17 @@ const Color = ({ variant, color }) => {
|
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
const BeemTag = styled.button`
|
|
26
|
-
display: flex;
|
|
27
|
+
${"" /* display: flex; */}
|
|
28
|
+
display: ${({ closeButton, show }) => {
|
|
29
|
+
if (!closeButton) {
|
|
30
|
+
return "flex";
|
|
31
|
+
}
|
|
32
|
+
return show ? "flex" : "none";
|
|
33
|
+
}};
|
|
27
34
|
flex-direction: row;
|
|
28
35
|
justify-content: center;
|
|
29
36
|
align-items: center;
|
|
30
|
-
padding: 0.
|
|
37
|
+
padding: 0.25rem 0.5rem;
|
|
31
38
|
border-radius: 0.25rem;
|
|
32
39
|
background: ${({ variant }) => {
|
|
33
40
|
if (variant === "neutral") return `${BmGrey100}`;
|
|
@@ -57,6 +64,8 @@ const BeemTag = styled.button`
|
|
|
57
64
|
`;
|
|
58
65
|
|
|
59
66
|
export const BmTag = (props) => {
|
|
67
|
+
const [toggle, setToggle] = useState(true);
|
|
68
|
+
|
|
60
69
|
const {
|
|
61
70
|
variant,
|
|
62
71
|
size,
|
|
@@ -65,6 +74,8 @@ export const BmTag = (props) => {
|
|
|
65
74
|
leadingIcon,
|
|
66
75
|
trailingIcon,
|
|
67
76
|
color,
|
|
77
|
+
closeButton,
|
|
78
|
+
onHide,
|
|
68
79
|
...rest
|
|
69
80
|
} = props;
|
|
70
81
|
|
|
@@ -75,6 +86,8 @@ export const BmTag = (props) => {
|
|
|
75
86
|
disabled={disabled}
|
|
76
87
|
children={children}
|
|
77
88
|
color={color}
|
|
89
|
+
closeButton={closeButton}
|
|
90
|
+
show={toggle}
|
|
78
91
|
{...rest}
|
|
79
92
|
>
|
|
80
93
|
{leadingIcon && (
|
|
@@ -82,8 +95,8 @@ export const BmTag = (props) => {
|
|
|
82
95
|
disabled={disabled}
|
|
83
96
|
icon={leadingIcon}
|
|
84
97
|
variant={variant}
|
|
85
|
-
color={Color({color, variant})}
|
|
86
|
-
size={size ||
|
|
98
|
+
color={Color({ color, variant })}
|
|
99
|
+
size={size || "small"}
|
|
87
100
|
/>
|
|
88
101
|
)}
|
|
89
102
|
{children}
|
|
@@ -91,8 +104,17 @@ export const BmTag = (props) => {
|
|
|
91
104
|
<BmIcons
|
|
92
105
|
icon={trailingIcon}
|
|
93
106
|
disabled={disabled}
|
|
94
|
-
color={Color({color, variant})}
|
|
95
|
-
size={size ||
|
|
107
|
+
color={Color({ color, variant })}
|
|
108
|
+
size={size || "small"}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
{closeButton && (
|
|
112
|
+
<BmIcons
|
|
113
|
+
icon={<Clear />}
|
|
114
|
+
color={Color({ color, variant })}
|
|
115
|
+
size={size ? size : "small"}
|
|
116
|
+
style={{ marginLeft: "auto" }}
|
|
117
|
+
onClick={() => onHide && onHide(setToggle(!toggle))}
|
|
96
118
|
/>
|
|
97
119
|
)}
|
|
98
120
|
</BeemTag>
|
|
@@ -106,4 +128,5 @@ BmTag.propTypes = {
|
|
|
106
128
|
color: PropTypes.string,
|
|
107
129
|
size: PropTypes.string,
|
|
108
130
|
variant: PropTypes.string,
|
|
109
|
-
|
|
131
|
+
closeButton: PropTypes.bool,
|
|
132
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import { Favorite
|
|
2
|
+
import { Favorite } from "@material-ui/icons";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { BmTag } from "./tags";
|
|
5
5
|
|
|
@@ -9,7 +9,16 @@ export default {
|
|
|
9
9
|
argTypes: {
|
|
10
10
|
color: {
|
|
11
11
|
control: { type: "text" },
|
|
12
|
-
description:
|
|
12
|
+
description:
|
|
13
|
+
"Color of the Icons and Text, will work only if variant is not present",
|
|
14
|
+
},
|
|
15
|
+
closeButton: {
|
|
16
|
+
control: { type: "boolean" },
|
|
17
|
+
description: "Will display (x) - Optional",
|
|
18
|
+
},
|
|
19
|
+
onHide: {
|
|
20
|
+
description:
|
|
21
|
+
"Handles closing of tags, will only work if closeButton is present (Optional)",
|
|
13
22
|
},
|
|
14
23
|
size: {
|
|
15
24
|
options: ["xsmall", "small", "medium", "large", "xlarge"],
|
|
@@ -26,12 +35,20 @@ export default {
|
|
|
26
35
|
},
|
|
27
36
|
};
|
|
28
37
|
|
|
29
|
-
const
|
|
38
|
+
const MainTag = (args) => <BmTag {...args} />;
|
|
30
39
|
|
|
31
|
-
export const
|
|
32
|
-
|
|
33
|
-
children: <p>
|
|
40
|
+
export const Tags = MainTag.bind({});
|
|
41
|
+
Tags.args = {
|
|
42
|
+
children: <p>Tags</p>,
|
|
34
43
|
leadingIcon: <Favorite />,
|
|
35
44
|
trailingIcon: <Favorite />,
|
|
36
|
-
variant:
|
|
45
|
+
variant: "success",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const TagsWithCloseButton = () => {
|
|
49
|
+
return (
|
|
50
|
+
<BmTag variant="light" closeButton onHide={() => console.log("Hide Tag")}>
|
|
51
|
+
<p>TAG</p>
|
|
52
|
+
</BmTag>
|
|
53
|
+
);
|
|
37
54
|
};
|
|
@@ -1,160 +0,0 @@
|
|
|
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
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = exports.Overlay = exports.ModalWrapper = exports.ModalContent = exports.HeaderWrapper = exports.HeaderText = exports.Close = exports.BmModal = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _icons = require("@material-ui/icons");
|
|
13
|
-
|
|
14
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
-
|
|
16
|
-
var _colors = require("../colors");
|
|
17
|
-
|
|
18
|
-
var _iconStyles = require("../iconStyles");
|
|
19
|
-
|
|
20
|
-
var _excluded = ["children", "show", "size", "centered", "setShowModals"],
|
|
21
|
-
_excluded2 = ["children", "leadingIcon", "trailingIcon", "size", "closeButton", "show"];
|
|
22
|
-
|
|
23
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
24
|
-
|
|
25
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
-
|
|
27
|
-
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); }
|
|
28
|
-
|
|
29
|
-
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; }
|
|
30
|
-
|
|
31
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
32
|
-
|
|
33
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
34
|
-
|
|
35
|
-
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."); }
|
|
36
|
-
|
|
37
|
-
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); }
|
|
38
|
-
|
|
39
|
-
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; }
|
|
40
|
-
|
|
41
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
42
|
-
|
|
43
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
44
|
-
|
|
45
|
-
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; }
|
|
46
|
-
|
|
47
|
-
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; }
|
|
48
|
-
|
|
49
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
50
|
-
|
|
51
|
-
var _React$createContext = /*#__PURE__*/_react.default.createContext(),
|
|
52
|
-
Provider = _React$createContext.Provider,
|
|
53
|
-
Consumer = _React$createContext.Consumer;
|
|
54
|
-
|
|
55
|
-
var Overlay = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n \tposition: fixed;\n top: 0;\n left: 0;\n z-index: 9999;\n width: 100%;\n height: 100%;\n background-color: ", ";\n}\n"])), _colors.BmBgGrey45);
|
|
56
|
-
|
|
57
|
-
exports.Overlay = Overlay;
|
|
58
|
-
|
|
59
|
-
var ModalContent = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n border-radius: 0.25rem;\n padding: 1rem;\n margin: auto;\n background: ", ";\n width: ", ";\n > *:not(:last-child) {\n margin-bottom: 1rem;\n }\n"])), _colors.BmPrimaryWhite, function (_ref) {
|
|
60
|
-
var size = _ref.size;
|
|
61
|
-
|
|
62
|
-
if (size) {
|
|
63
|
-
console.log({
|
|
64
|
-
size: size
|
|
65
|
-
});
|
|
66
|
-
if (size === "small") return "21.429rem";
|
|
67
|
-
if (size === "default") return "35.714rem";
|
|
68
|
-
if (size === "large") return "57.143rem";
|
|
69
|
-
if (size === "xlarge") return "81.429rem";
|
|
70
|
-
return size;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return "35.714rem";
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
exports.ModalContent = ModalContent;
|
|
77
|
-
|
|
78
|
-
var ModalWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n z-index: 9999;\n overflow-x: auto;\n overflow-y: auto;\n outline: 0;\n position: fixed;\n height: auto;\n top: ", ";\n left: 50%;\n transform: translate(-50%, -50%);\n"])), function (_ref2) {
|
|
79
|
-
var centered = _ref2.centered;
|
|
80
|
-
|
|
81
|
-
if (centered) {
|
|
82
|
-
return "50%";
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return "10%";
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
exports.ModalWrapper = ModalWrapper;
|
|
89
|
-
|
|
90
|
-
var HeaderWrapper = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n padding: 1.143rem 0rem;\n"])));
|
|
91
|
-
|
|
92
|
-
exports.HeaderWrapper = HeaderWrapper;
|
|
93
|
-
|
|
94
|
-
var HeaderText = _styledComponents.default.h2(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n text-align: center;\n display: flex;\n color: ", ";\n margin-left: auto;\n"])), _colors.BmPrimaryBlack);
|
|
95
|
-
|
|
96
|
-
exports.HeaderText = HeaderText;
|
|
97
|
-
|
|
98
|
-
var Close = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n margin-left: auto;\n"])));
|
|
99
|
-
|
|
100
|
-
exports.Close = Close;
|
|
101
|
-
|
|
102
|
-
var BmModal = function BmModal(_ref3) {
|
|
103
|
-
var children = _ref3.children,
|
|
104
|
-
show = _ref3.show,
|
|
105
|
-
size = _ref3.size,
|
|
106
|
-
centered = _ref3.centered,
|
|
107
|
-
setShowModals = _ref3.setShowModals,
|
|
108
|
-
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
109
|
-
|
|
110
|
-
var _useState = (0, _react.useState)(show),
|
|
111
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
112
|
-
toggle = _useState2[0],
|
|
113
|
-
setToggle = _useState2[1];
|
|
114
|
-
|
|
115
|
-
(0, _react.useEffect)(function () {
|
|
116
|
-
setToggle(show);
|
|
117
|
-
}, [show]);
|
|
118
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, toggle && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Overlay, null), /*#__PURE__*/_react.default.createElement(ModalWrapper, {
|
|
119
|
-
showModal: show,
|
|
120
|
-
centered: centered
|
|
121
|
-
}, /*#__PURE__*/_react.default.createElement(Provider, {
|
|
122
|
-
value: {
|
|
123
|
-
toggle: toggle,
|
|
124
|
-
setToggle: setToggle,
|
|
125
|
-
size: size,
|
|
126
|
-
show: show
|
|
127
|
-
}
|
|
128
|
-
}, /*#__PURE__*/_react.default.createElement(ModalContent, _extends({
|
|
129
|
-
size: size
|
|
130
|
-
}, rest), children)))));
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
exports.BmModal = BmModal;
|
|
134
|
-
|
|
135
|
-
var ModalHeader = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n"])));
|
|
136
|
-
|
|
137
|
-
BmModal.Header = function (_ref4) {
|
|
138
|
-
var children = _ref4.children,
|
|
139
|
-
leadingIcon = _ref4.leadingIcon,
|
|
140
|
-
trailingIcon = _ref4.trailingIcon,
|
|
141
|
-
size = _ref4.size,
|
|
142
|
-
closeButton = _ref4.closeButton,
|
|
143
|
-
show = _ref4.show,
|
|
144
|
-
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
145
|
-
|
|
146
|
-
return /*#__PURE__*/_react.default.createElement(Consumer, null, function (value) {
|
|
147
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ModalHeader, rest, JSON.stringify(value), children, closeButton && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, _extends({
|
|
148
|
-
size: "xlarge",
|
|
149
|
-
icon: /*#__PURE__*/_react.default.createElement(_icons.Clear, null),
|
|
150
|
-
onClick: function onClick() {
|
|
151
|
-
return value.setToggle(!value.toggle);
|
|
152
|
-
}
|
|
153
|
-
}, rest))));
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
BmModal.Body = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n"])));
|
|
158
|
-
BmModal.Footer = _styledComponents.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n"])));
|
|
159
|
-
var _default = BmModal;
|
|
160
|
-
exports.default = _default;
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useCallback, useState } from "react";
|
|
2
|
-
import { Clear } from "@material-ui/icons";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { BmBgGrey45, BmPrimaryBlack, BmPrimaryWhite } from "../colors";
|
|
5
|
-
import { BmIcons } from "../iconStyles";
|
|
6
|
-
|
|
7
|
-
const { Provider, Consumer } = React.createContext();
|
|
8
|
-
|
|
9
|
-
export const Overlay = styled.div`
|
|
10
|
-
position: fixed;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
z-index: 9999;
|
|
14
|
-
width: 100%;
|
|
15
|
-
height: 100%;
|
|
16
|
-
background-color: ${BmBgGrey45};
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
19
|
-
export const ModalContent = styled.div`
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
border-radius: 0.25rem;
|
|
23
|
-
padding: 1rem;
|
|
24
|
-
margin: auto;
|
|
25
|
-
background: ${BmPrimaryWhite};
|
|
26
|
-
width: ${({ size }) => {
|
|
27
|
-
if (size) {
|
|
28
|
-
console.log({ size });
|
|
29
|
-
if (size === "small") return "21.429rem";
|
|
30
|
-
if (size === "default") return "35.714rem";
|
|
31
|
-
if (size === "large") return "57.143rem";
|
|
32
|
-
if (size === "xlarge") return "81.429rem";
|
|
33
|
-
return size;
|
|
34
|
-
}
|
|
35
|
-
return "35.714rem";
|
|
36
|
-
}};
|
|
37
|
-
> *:not(:last-child) {
|
|
38
|
-
margin-bottom: 1rem;
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
export const ModalWrapper = styled.div`
|
|
43
|
-
z-index: 9999;
|
|
44
|
-
overflow-x: auto;
|
|
45
|
-
overflow-y: auto;
|
|
46
|
-
outline: 0;
|
|
47
|
-
position: fixed;
|
|
48
|
-
height: auto;
|
|
49
|
-
top: ${({ centered }) => {
|
|
50
|
-
if (centered) {
|
|
51
|
-
return "50%";
|
|
52
|
-
}
|
|
53
|
-
return "10%";
|
|
54
|
-
}};
|
|
55
|
-
left: 50%;
|
|
56
|
-
transform: translate(-50%, -50%);
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
export const HeaderWrapper = styled.div`
|
|
60
|
-
display: flex;
|
|
61
|
-
flex-direction: row;
|
|
62
|
-
justify-content: space-between;
|
|
63
|
-
padding: 1.143rem 0rem;
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
export const HeaderText = styled.h2`
|
|
67
|
-
text-align: center;
|
|
68
|
-
display: flex;
|
|
69
|
-
color: ${BmPrimaryBlack};
|
|
70
|
-
margin-left: auto;
|
|
71
|
-
`;
|
|
72
|
-
|
|
73
|
-
export const Close = styled.div`
|
|
74
|
-
display: flex;
|
|
75
|
-
justify-content: flex-end;
|
|
76
|
-
margin-left: auto;
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
|
-
export const BmModal = ({
|
|
80
|
-
children,
|
|
81
|
-
show,
|
|
82
|
-
size,
|
|
83
|
-
centered,
|
|
84
|
-
setShowModals,
|
|
85
|
-
...rest
|
|
86
|
-
}) => {
|
|
87
|
-
const [toggle, setToggle] = useState(show);
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
setToggle(show);
|
|
90
|
-
}, [show]);
|
|
91
|
-
return (
|
|
92
|
-
<>
|
|
93
|
-
{toggle && (
|
|
94
|
-
<>
|
|
95
|
-
<Overlay />
|
|
96
|
-
<ModalWrapper showModal={show} centered={centered}>
|
|
97
|
-
<Provider value={{ toggle, setToggle, size, show }}>
|
|
98
|
-
<ModalContent size={size} {...rest}>
|
|
99
|
-
{children}
|
|
100
|
-
</ModalContent>
|
|
101
|
-
</Provider>
|
|
102
|
-
</ModalWrapper>
|
|
103
|
-
</>
|
|
104
|
-
)}
|
|
105
|
-
</>
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const ModalHeader = styled.div`
|
|
110
|
-
display: flex;
|
|
111
|
-
flex-direction: row;
|
|
112
|
-
justify-content: space-between;
|
|
113
|
-
`;
|
|
114
|
-
|
|
115
|
-
BmModal.Header = ({
|
|
116
|
-
children,
|
|
117
|
-
leadingIcon,
|
|
118
|
-
trailingIcon,
|
|
119
|
-
size,
|
|
120
|
-
closeButton,
|
|
121
|
-
show,
|
|
122
|
-
...rest
|
|
123
|
-
}) => {
|
|
124
|
-
return (
|
|
125
|
-
<Consumer>
|
|
126
|
-
{(value) => (
|
|
127
|
-
<>
|
|
128
|
-
<ModalHeader {...rest}>
|
|
129
|
-
{JSON.stringify(value)}
|
|
130
|
-
{children}
|
|
131
|
-
{closeButton && (
|
|
132
|
-
<BmIcons
|
|
133
|
-
size="xlarge"
|
|
134
|
-
icon={<Clear />}
|
|
135
|
-
onClick={() =>
|
|
136
|
-
value.setToggle(!value.toggle)
|
|
137
|
-
}
|
|
138
|
-
{...rest}
|
|
139
|
-
/>
|
|
140
|
-
)}
|
|
141
|
-
</ModalHeader>
|
|
142
|
-
</>
|
|
143
|
-
)}
|
|
144
|
-
</Consumer>
|
|
145
|
-
);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
BmModal.Body = styled.div`
|
|
149
|
-
display: flex;
|
|
150
|
-
flex-direction: column;
|
|
151
|
-
justify-content: space-between;
|
|
152
|
-
`;
|
|
153
|
-
|
|
154
|
-
BmModal.Footer = styled.div`
|
|
155
|
-
display: flex;
|
|
156
|
-
justify-content: space-between;
|
|
157
|
-
`;
|
|
158
|
-
|
|
159
|
-
export default BmModal;
|