@dnb/eufemia 9.17.1 → 9.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,8 +22,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
22
22
  import "core-js/modules/es.array.filter.js";
23
23
  import "core-js/modules/es.object.to-string.js";
24
24
  import "core-js/modules/web.dom-collections.for-each.js";
25
- import "core-js/modules/es.regexp.exec.js";
26
25
  import "core-js/modules/es.parse-float.js";
26
+ import "core-js/modules/es.regexp.exec.js";
27
27
 
28
28
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
29
29
 
@@ -57,6 +57,31 @@ var ModalContent = function (_React$PureComponent) {
57
57
  triggeredByEvent: null
58
58
  });
59
59
 
60
+ _defineProperty(_assertThisInitialized(_this), "lockBody", function () {
61
+ var modalRoots = getListOfModalRoots();
62
+ var firstLevel = modalRoots[0];
63
+
64
+ if (firstLevel === _assertThisInitialized(_this)) {
65
+ _this._ii = new InteractionInvalidation();
66
+
67
+ _this._ii.setBypassSelector(['.dnb-modal__content *', "#dnb-modal-".concat(_this.props.root_id || 'root', " *")].filter(Boolean));
68
+
69
+ _this._ii.activate();
70
+ } else {
71
+ modalRoots.forEach(function (modal) {
72
+ if (modal !== _assertThisInitialized(_this) && typeof modal._iiLocal === 'undefined' && typeof modal._contentRef !== 'undefined') {
73
+ modal._iiLocal = new InteractionInvalidation();
74
+
75
+ modal._iiLocal.activate(modal._contentRef.current);
76
+ }
77
+ });
78
+ }
79
+
80
+ if (typeof document !== 'undefined') {
81
+ document.addEventListener('keydown', _this.onKeyDownHandler);
82
+ }
83
+ });
84
+
60
85
  _defineProperty(_assertThisInitialized(_this), "_androidFocusHelper", function () {
61
86
  clearTimeout(_this._androidFocusTimeout);
62
87
  _this._androidFocusTimeout = setTimeout(function () {
@@ -67,7 +92,7 @@ var ModalContent = function (_React$PureComponent) {
67
92
  document.activeElement.scrollIntoView();
68
93
  }
69
94
  } catch (e) {}
70
- }, 100);
95
+ }, parseFloat(_this.props.animation_duration) / 2);
71
96
  });
72
97
 
73
98
  _defineProperty(_assertThisInitialized(_this), "preventClick", function (e) {
@@ -122,8 +147,6 @@ var ModalContent = function (_React$PureComponent) {
122
147
  _createClass(ModalContent, [{
123
148
  key: "componentDidMount",
124
149
  value: function componentDidMount() {
125
- var _this2 = this;
126
-
127
150
  this.addToIndex();
128
151
  this.removeScrollPossibility();
129
152
  this.setFocus();
@@ -136,9 +159,7 @@ var ModalContent = function (_React$PureComponent) {
136
159
  if (isTrue(this.props.no_animation) || process.env.NODE_ENV === 'test') {
137
160
  this.lockBody();
138
161
  } else {
139
- this._lockTimeout = setTimeout(function () {
140
- _this2.lockBody();
141
- }, 500);
162
+ this._lockTimeout = setTimeout(this.lockBody, parseFloat(this.props.animation_duration) * 1.2);
142
163
  }
143
164
  }
144
165
  }, {
@@ -148,34 +169,6 @@ var ModalContent = function (_React$PureComponent) {
148
169
  clearTimeout(this._lockTimeout);
149
170
  this.removeLocks();
150
171
  }
151
- }, {
152
- key: "lockBody",
153
- value: function lockBody() {
154
- var _this3 = this;
155
-
156
- var modalRoots = getListOfModalRoots();
157
- var firstLevel = modalRoots[0];
158
-
159
- if (firstLevel === this) {
160
- this._ii = new InteractionInvalidation();
161
-
162
- this._ii.setBypassSelector(['.dnb-modal__content *', "#dnb-modal-".concat(this.props.root_id || 'root', " *")].filter(Boolean));
163
-
164
- this._ii.activate();
165
- } else {
166
- modalRoots.forEach(function (modal) {
167
- if (modal !== _this3 && typeof modal._iiLocal === 'undefined' && typeof modal._contentRef !== 'undefined') {
168
- modal._iiLocal = new InteractionInvalidation();
169
-
170
- modal._iiLocal.activate(modal._contentRef.current);
171
- }
172
- });
173
- }
174
-
175
- if (typeof document !== 'undefined') {
176
- document.addEventListener('keydown', this.onKeyDownHandler);
177
- }
178
- }
179
172
  }, {
180
173
  key: "removeLocks",
181
174
  value: function removeLocks() {
@@ -248,7 +241,7 @@ var ModalContent = function (_React$PureComponent) {
248
241
  }, {
249
242
  key: "removeFromIndex",
250
243
  value: function removeFromIndex() {
251
- var _this4 = this;
244
+ var _this2 = this;
252
245
 
253
246
  if (typeof window !== 'undefined') {
254
247
  try {
@@ -257,7 +250,7 @@ var ModalContent = function (_React$PureComponent) {
257
250
  }
258
251
 
259
252
  window.__modalStack = window.__modalStack.filter(function (cur) {
260
- return cur !== _this4;
253
+ return cur !== _this2;
261
254
  });
262
255
  } catch (e) {
263
256
  warn(e);
@@ -312,7 +305,7 @@ var ModalContent = function (_React$PureComponent) {
312
305
  key: "closeModal",
313
306
  value: function closeModal(event, _ref) {
314
307
  var _event$persist,
315
- _this5 = this;
308
+ _this3 = this;
316
309
 
317
310
  var triggeredBy = _ref.triggeredBy,
318
311
  params = _objectWithoutProperties(_ref, _excluded);
@@ -322,7 +315,7 @@ var ModalContent = function (_React$PureComponent) {
322
315
  triggeredBy: triggeredBy,
323
316
  triggeredByEvent: event
324
317
  }, function () {
325
- _this5.props.closeModal(event, _objectSpread({
318
+ _this3.props.closeModal(event, _objectSpread({
326
319
  triggeredBy: triggeredBy
327
320
  }, params));
328
321
  });