@micromag/core 0.3.17 → 0.3.20

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.
@@ -5,7 +5,6 @@
5
5
 
6
6
  .micromag-core-menus-breadcrumb-container .micromag-core-menus-breadcrumb-arrow+.micromag-core-menus-breadcrumb-arrow:before{content:">"}
7
7
 
8
-
9
8
  .micromag-core-menus-tabs-container{display:inline-block;position:relative}
10
9
  .micromag-core-modals-container{position:static}.micromag-core-modals-modals.micromag-core-modals-hasModals{position:fixed;z-index:1000;top:0;right:0;bottom:0;left:0;background-color:rgba(28,28,28,.2)}
11
10
  .micromag-core-modals-modal-container{position:absolute;top:0;left:0;width:100%;height:100%;display:-webkit-flex;display:-ms-flexbox;display:flex;overflow-y:auto}.micromag-core-modals-modal-container.micromag-core-modals-modal-center>.micromag-core-modals-modal-inner{margin:auto}.micromag-core-modals-modal-container.micromag-core-modals-modal-top>.micromag-core-modals-modal-inner{margin:0 auto;padding:1.75rem 0}
package/es/components.js CHANGED
@@ -1011,7 +1011,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
1011
1011
  Breadcrumb.propTypes = propTypes$A;
1012
1012
  Breadcrumb.defaultProps = defaultProps$A;
1013
1013
 
1014
- var _excluded$3 = ["id", "type", "className", "label", "children", "onClick", "active"];
1014
+ var _excluded$3 = ["type", "className", "label", "children", "onClick", "active"];
1015
1015
  var propTypes$z = {
1016
1016
  items: PropTypes.menuItems,
1017
1017
  children: PropTypes$1.node,
@@ -1045,20 +1045,36 @@ var Dropdown = function Dropdown(_ref) {
1045
1045
  onClickItem = _ref.onClickItem,
1046
1046
  onClickOutside = _ref.onClickOutside;
1047
1047
  var refContainer = useRef(null);
1048
+
1049
+ var _useState = useState(visible),
1050
+ _useState2 = _slicedToArray(_useState, 2),
1051
+ enabled = _useState2[0],
1052
+ setEnabled = _useState2[1];
1053
+
1048
1054
  var onDocumentClick = useCallback(function (e) {
1049
1055
  if (refContainer.current && !refContainer.current.contains(e.currentTarget) && onClickOutside !== null) {
1050
1056
  onClickOutside(e);
1051
1057
  }
1052
1058
  }, [refContainer.current, onClickOutside]);
1053
- useDocumentEvent('click', onDocumentClick, visible);
1059
+ useDocumentEvent('click', onDocumentClick, enabled); // Delay the outside click detection
1060
+
1061
+ useEffect(function () {
1062
+ var id = setTimeout(function () {
1063
+ setEnabled(visible);
1064
+ }, 100);
1065
+ return function () {
1066
+ clearTimeout(id);
1067
+ };
1068
+ }, [visible, setEnabled]);
1069
+ console.log('visible', visible); // eslint-disable-line
1070
+
1054
1071
  return /*#__PURE__*/React.createElement("div", {
1055
1072
  className: classNames(['dropdown-menu', (_ref2 = {}, _defineProperty(_ref2, "dropdown-menu-".concat(align), align !== null), _defineProperty(_ref2, "show", visible), _defineProperty(_ref2, className, className !== null), _ref2)]),
1056
1073
  ref: refContainer
1057
1074
  }, children !== null ? children : items.map(function (it, index) {
1058
1075
  var _ref3;
1059
1076
 
1060
- it.id;
1061
- var _it$type = it.type,
1077
+ var _it$type = it.type,
1062
1078
  type = _it$type === void 0 ? 'link' : _it$type,
1063
1079
  _it$className = it.className,
1064
1080
  customClassName = _it$className === void 0 ? null : _it$className,
@@ -3495,7 +3511,11 @@ var Screen = function Screen(_ref) {
3495
3511
  onEnableInteraction = _ref.onEnableInteraction,
3496
3512
  onDisableInteraction = _ref.onDisableInteraction,
3497
3513
  getMediaRef = _ref.getMediaRef;
3498
- var type = screen.type;
3514
+
3515
+ var _ref2 = screen || {},
3516
+ _ref2$type = _ref2.type,
3517
+ type = _ref2$type === void 0 ? null : _ref2$type;
3518
+
3499
3519
  var CustomScreenComponent = components !== null ? getComponentFromName(type, components) || null : null;
3500
3520
  var ContextScreenComponent = useScreenComponent(type);
3501
3521
  var ScreenComponent = CustomScreenComponent || ContextScreenComponent;
package/lib/components.js CHANGED
@@ -1034,7 +1034,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
1034
1034
  Breadcrumb.propTypes = propTypes$A;
1035
1035
  Breadcrumb.defaultProps = defaultProps$A;
1036
1036
 
1037
- var _excluded$3 = ["id", "type", "className", "label", "children", "onClick", "active"];
1037
+ var _excluded$3 = ["type", "className", "label", "children", "onClick", "active"];
1038
1038
  var propTypes$z = {
1039
1039
  items: core.PropTypes.menuItems,
1040
1040
  children: PropTypes__default["default"].node,
@@ -1068,20 +1068,36 @@ var Dropdown = function Dropdown(_ref) {
1068
1068
  onClickItem = _ref.onClickItem,
1069
1069
  onClickOutside = _ref.onClickOutside;
1070
1070
  var refContainer = React.useRef(null);
1071
+
1072
+ var _useState = React.useState(visible),
1073
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
1074
+ enabled = _useState2[0],
1075
+ setEnabled = _useState2[1];
1076
+
1071
1077
  var onDocumentClick = React.useCallback(function (e) {
1072
1078
  if (refContainer.current && !refContainer.current.contains(e.currentTarget) && onClickOutside !== null) {
1073
1079
  onClickOutside(e);
1074
1080
  }
1075
1081
  }, [refContainer.current, onClickOutside]);
1076
- hooks.useDocumentEvent('click', onDocumentClick, visible);
1082
+ hooks.useDocumentEvent('click', onDocumentClick, enabled); // Delay the outside click detection
1083
+
1084
+ React.useEffect(function () {
1085
+ var id = setTimeout(function () {
1086
+ setEnabled(visible);
1087
+ }, 100);
1088
+ return function () {
1089
+ clearTimeout(id);
1090
+ };
1091
+ }, [visible, setEnabled]);
1092
+ console.log('visible', visible); // eslint-disable-line
1093
+
1077
1094
  return /*#__PURE__*/React__default["default"].createElement("div", {
1078
1095
  className: classNames__default["default"](['dropdown-menu', (_ref2 = {}, _defineProperty__default["default"](_ref2, "dropdown-menu-".concat(align), align !== null), _defineProperty__default["default"](_ref2, "show", visible), _defineProperty__default["default"](_ref2, className, className !== null), _ref2)]),
1079
1096
  ref: refContainer
1080
1097
  }, children !== null ? children : items.map(function (it, index) {
1081
1098
  var _ref3;
1082
1099
 
1083
- it.id;
1084
- var _it$type = it.type,
1100
+ var _it$type = it.type,
1085
1101
  type = _it$type === void 0 ? 'link' : _it$type,
1086
1102
  _it$className = it.className,
1087
1103
  customClassName = _it$className === void 0 ? null : _it$className,
@@ -3518,7 +3534,11 @@ var Screen = function Screen(_ref) {
3518
3534
  onEnableInteraction = _ref.onEnableInteraction,
3519
3535
  onDisableInteraction = _ref.onDisableInteraction,
3520
3536
  getMediaRef = _ref.getMediaRef;
3521
- var type = screen.type;
3537
+
3538
+ var _ref2 = screen || {},
3539
+ _ref2$type = _ref2.type,
3540
+ type = _ref2$type === void 0 ? null : _ref2$type;
3541
+
3522
3542
  var CustomScreenComponent = components !== null ? utils.getComponentFromName(type, components) || null : null;
3523
3543
  var ContextScreenComponent = contexts.useScreenComponent(type);
3524
3544
  var ScreenComponent = CustomScreenComponent || ContextScreenComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/core",
3
- "version": "0.3.17",
3
+ "version": "0.3.20",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -132,5 +132,5 @@
132
132
  "publishConfig": {
133
133
  "access": "public"
134
134
  },
135
- "gitHead": "7cde59c640f44a8cf78de6c62e6396e9bbf5119d"
135
+ "gitHead": "b7cde2045021ba116088cada89ff492e95634fee"
136
136
  }