beem-component 1.5.3 → 1.5.5
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.
|
@@ -15,6 +15,8 @@ var _colors = require("../colors");
|
|
|
15
15
|
|
|
16
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
17
|
|
|
18
|
+
var _excluded = ["children", "showList", "setShowList"];
|
|
19
|
+
|
|
18
20
|
var _templateObject;
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -23,6 +25,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
25
|
|
|
24
26
|
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; }
|
|
25
27
|
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
26
34
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
27
35
|
|
|
28
36
|
var show = function show(isOpen) {
|
|
@@ -46,7 +54,9 @@ var BmListBoxWrapper = _styledComponents.default.div(_templateObject || (_templa
|
|
|
46
54
|
var BmListBox = function BmListBox(_ref) {
|
|
47
55
|
var children = _ref.children,
|
|
48
56
|
showList = _ref.showList,
|
|
49
|
-
setShowList = _ref.setShowList
|
|
57
|
+
setShowList = _ref.setShowList,
|
|
58
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
59
|
+
|
|
50
60
|
var ref = (0, _react.useRef)();
|
|
51
61
|
(0, _react.useEffect)(function () {
|
|
52
62
|
var checkIfClickedOutside = function checkIfClickedOutside(e) {
|
|
@@ -60,7 +70,7 @@ var BmListBox = function BmListBox(_ref) {
|
|
|
60
70
|
document.removeEventListener("mousedown", checkIfClickedOutside);
|
|
61
71
|
};
|
|
62
72
|
}, [setShowList, showList]);
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(BmListBoxWrapper, {
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(BmListBoxWrapper, _extends({
|
|
64
74
|
ref: ref,
|
|
65
75
|
onClick: function onClick() {
|
|
66
76
|
setShowList(function (oldState) {
|
|
@@ -68,7 +78,7 @@ var BmListBox = function BmListBox(_ref) {
|
|
|
68
78
|
});
|
|
69
79
|
},
|
|
70
80
|
isOpen: showList
|
|
71
|
-
}, children);
|
|
81
|
+
}, rest), children);
|
|
72
82
|
};
|
|
73
83
|
|
|
74
84
|
exports.BmListBox = BmListBox;
|
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ const BmListBoxWrapper = styled.div`
|
|
|
31
31
|
cursor: pointer;
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
-
export const BmListBox = ({ children, showList, setShowList }) => {
|
|
34
|
+
export const BmListBox = ({ children, showList, setShowList, ...rest }) => {
|
|
35
35
|
const ref = useRef();
|
|
36
36
|
|
|
37
37
|
useEffect(() => {
|
|
@@ -53,6 +53,7 @@ export const BmListBox = ({ children, showList, setShowList }) => {
|
|
|
53
53
|
setShowList((oldState) => !oldState);
|
|
54
54
|
}}
|
|
55
55
|
isOpen={showList}
|
|
56
|
+
{...rest}
|
|
56
57
|
>
|
|
57
58
|
{children}
|
|
58
59
|
</BmListBoxWrapper>
|