@alfalab/core-components-base-modal 3.0.2 → 3.1.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.1.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-base-modal@3.0.2...@alfalab/core-components-base-modal@3.1.0) (2022-01-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * **base-modal:** extract modal store to global ([#943](https://github.com/alfa-laboratory/core-components/issues/943)) ([9587f17](https://github.com/alfa-laboratory/core-components/commit/9587f1773bb690ac6696077509d4a519aa109198))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.0.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-base-modal@3.0.1...@alfalab/core-components-base-modal@3.0.2) (2021-09-14)
7
18
 
8
19
 
package/dist/Component.js CHANGED
@@ -11,6 +11,7 @@ var FocusLock = require('react-focus-lock');
11
11
  var coreComponentsPortal = require('@alfalab/core-components-portal');
12
12
  var coreComponentsBackdrop = require('@alfalab/core-components-backdrop');
13
13
  var coreComponentsStack = require('@alfalab/core-components-stack');
14
+ require('@alfalab/core-components-global-store');
14
15
  var utils = require('./utils.js');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -47,7 +48,7 @@ var __assign = function () {
47
48
  return __assign.apply(this, arguments);
48
49
  };
49
50
 
50
- var styles = {"component":"base-modal__component_nnjeq","wrapper":"base-modal__wrapper_nnjeq","content":"base-modal__content_nnjeq","hidden":"base-modal__hidden_nnjeq","backdrop":"base-modal__backdrop_nnjeq","appear":"base-modal__appear_nnjeq","enter":"base-modal__enter_nnjeq","appearActive":"base-modal__appearActive_nnjeq","enterActive":"base-modal__enterActive_nnjeq","exit":"base-modal__exit_nnjeq","exitActive":"base-modal__exitActive_nnjeq","exitDone":"base-modal__exitDone_nnjeq"};
51
+ var styles = {"component":"base-modal__component_rp8e5","wrapper":"base-modal__wrapper_rp8e5","content":"base-modal__content_rp8e5","hidden":"base-modal__hidden_rp8e5","backdrop":"base-modal__backdrop_rp8e5","appear":"base-modal__appear_rp8e5","enter":"base-modal__enter_rp8e5","appearActive":"base-modal__appearActive_rp8e5","enterActive":"base-modal__enterActive_rp8e5","exit":"base-modal__exit_rp8e5","exitActive":"base-modal__exitActive_rp8e5","exitDone":"base-modal__exitDone_rp8e5"};
51
52
  require('./index.css')
52
53
 
53
54
  var BaseModalContext = React__default['default'].createContext({
@@ -11,6 +11,7 @@ var FocusLock = require('react-focus-lock');
11
11
  var coreComponentsPortal = require('@alfalab/core-components-portal/dist/cssm');
12
12
  var coreComponentsBackdrop = require('@alfalab/core-components-backdrop/dist/cssm');
13
13
  var coreComponentsStack = require('@alfalab/core-components-stack/dist/cssm');
14
+ require('@alfalab/core-components-global-store/dist/cssm');
14
15
  var utils = require('./utils.js');
15
16
  var styles = require('./index.module.css');
16
17
 
@@ -12,6 +12,7 @@ require('react-focus-lock');
12
12
  require('@alfalab/core-components-portal/dist/cssm');
13
13
  require('@alfalab/core-components-backdrop/dist/cssm');
14
14
  require('@alfalab/core-components-stack/dist/cssm');
15
+ require('@alfalab/core-components-global-store/dist/cssm');
15
16
  var utils = require('./utils.js');
16
17
  require('./index.module.css');
17
18
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var coreComponentsGlobalStore = require('@alfalab/core-components-global-store/dist/cssm');
6
+
5
7
  function isScrolledToTop(target) {
6
8
  return target.scrollTop <= 0;
7
9
  }
@@ -32,15 +34,15 @@ var isOverflowing = function (container) {
32
34
  var getPaddingRight = function (node) {
33
35
  return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0;
34
36
  };
35
- var restoreStylesStore = [];
36
37
  var restoreContainerStyles = function (container) {
37
- var index = restoreStylesStore.findIndex(function (s) { return s.container === container; });
38
- var existingStyles = restoreStylesStore[index];
38
+ var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles();
39
+ var index = modalRestoreStyles.findIndex(function (s) { return s.container === container; });
40
+ var existingStyles = modalRestoreStyles[index];
39
41
  if (!existingStyles)
40
42
  return;
41
43
  existingStyles.modals -= 1;
42
44
  if (existingStyles.modals <= 0) {
43
- restoreStylesStore.splice(index, 1);
45
+ modalRestoreStyles.splice(index, 1);
44
46
  existingStyles.styles.forEach(function (_a) {
45
47
  var value = _a.value, el = _a.el, key = _a.key;
46
48
  if (value) {
@@ -55,7 +57,8 @@ var restoreContainerStyles = function (container) {
55
57
  var handleContainer = function (container) {
56
58
  if (!container)
57
59
  return;
58
- var existingStyles = restoreStylesStore.find(function (s) { return s.container === container; });
60
+ var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles();
61
+ var existingStyles = modalRestoreStyles.find(function (s) { return s.container === container; });
59
62
  if (existingStyles) {
60
63
  existingStyles.modals += 1;
61
64
  return;
@@ -90,7 +93,7 @@ var handleContainer = function (container) {
90
93
  });
91
94
  }
92
95
  scrollContainer.style.overflow = 'hidden';
93
- restoreStylesStore.push({
96
+ modalRestoreStyles.push({
94
97
  container: container,
95
98
  modals: 1,
96
99
  styles: containerStyles,
@@ -7,6 +7,7 @@ import FocusLock from 'react-focus-lock';
7
7
  import { Portal } from '@alfalab/core-components-portal/dist/esm';
8
8
  import { Backdrop } from '@alfalab/core-components-backdrop/dist/esm';
9
9
  import { stackingOrder, Stack } from '@alfalab/core-components-stack/dist/esm';
10
+ import '@alfalab/core-components-global-store/dist/esm';
10
11
  import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar } from './utils.js';
11
12
 
12
13
  /*! *****************************************************************************
@@ -36,7 +37,7 @@ var __assign = function () {
36
37
  return __assign.apply(this, arguments);
37
38
  };
38
39
 
39
- var styles = {"component":"base-modal__component_nnjeq","wrapper":"base-modal__wrapper_nnjeq","content":"base-modal__content_nnjeq","hidden":"base-modal__hidden_nnjeq","backdrop":"base-modal__backdrop_nnjeq","appear":"base-modal__appear_nnjeq","enter":"base-modal__enter_nnjeq","appearActive":"base-modal__appearActive_nnjeq","enterActive":"base-modal__enterActive_nnjeq","exit":"base-modal__exit_nnjeq","exitActive":"base-modal__exitActive_nnjeq","exitDone":"base-modal__exitDone_nnjeq"};
40
+ var styles = {"component":"base-modal__component_rp8e5","wrapper":"base-modal__wrapper_rp8e5","content":"base-modal__content_rp8e5","hidden":"base-modal__hidden_rp8e5","backdrop":"base-modal__backdrop_rp8e5","appear":"base-modal__appear_rp8e5","enter":"base-modal__enter_rp8e5","appearActive":"base-modal__appearActive_rp8e5","enterActive":"base-modal__enterActive_rp8e5","exit":"base-modal__exit_rp8e5","exitActive":"base-modal__exitActive_rp8e5","exitDone":"base-modal__exitDone_rp8e5"};
40
41
  require('./index.css')
41
42
 
42
43
  var BaseModalContext = React.createContext({
@@ -1,4 +1,4 @@
1
- /* hash: nnjeq */
1
+ /* hash: 1pbe4 */
2
2
  :root {
3
3
  --color-light-bg-primary: #fff;
4
4
  }
@@ -10,14 +10,14 @@
10
10
 
11
11
  /* Hard up */
12
12
  }
13
- .base-modal__component_nnjeq {
13
+ .base-modal__component_rp8e5 {
14
14
  position: relative;
15
15
  box-sizing: border-box;
16
16
  background: var(--color-light-bg-primary);
17
17
  margin: auto;
18
18
  flex-shrink: 0;
19
19
  }
20
- .base-modal__wrapper_nnjeq {
20
+ .base-modal__wrapper_rp8e5 {
21
21
  position: fixed;
22
22
  top: 0;
23
23
  left: 0;
@@ -30,33 +30,33 @@
30
30
  align-items: center;
31
31
  outline: 0;
32
32
  }
33
- .base-modal__content_nnjeq {
33
+ .base-modal__content_rp8e5 {
34
34
  width: 100%;
35
35
  height: 100%;
36
36
  display: flex;
37
37
  flex-direction: column;
38
38
  flex: 1;
39
39
  }
40
- .base-modal__hidden_nnjeq {
40
+ .base-modal__hidden_rp8e5 {
41
41
  display: none;
42
42
  }
43
- .base-modal__backdrop_nnjeq {
43
+ .base-modal__backdrop_rp8e5 {
44
44
  z-index: 0;
45
45
  }
46
- .base-modal__appear_nnjeq,
47
- .base-modal__enter_nnjeq {
46
+ .base-modal__appear_rp8e5,
47
+ .base-modal__enter_rp8e5 {
48
48
  opacity: 0;
49
49
  }
50
- .base-modal__appearActive_nnjeq,
51
- .base-modal__enterActive_nnjeq {
50
+ .base-modal__appearActive_rp8e5,
51
+ .base-modal__enterActive_rp8e5 {
52
52
  opacity: 1;
53
53
  transition: opacity 200ms ease-in;
54
54
  }
55
- .base-modal__exit_nnjeq {
55
+ .base-modal__exit_rp8e5 {
56
56
  opacity: 1;
57
57
  }
58
- .base-modal__exitActive_nnjeq,
59
- .base-modal__exitDone_nnjeq {
58
+ .base-modal__exitActive_rp8e5,
59
+ .base-modal__exitDone_rp8e5 {
60
60
  opacity: 0;
61
61
  transition: opacity 200ms ease-out;
62
62
  }
package/dist/esm/index.js CHANGED
@@ -8,4 +8,5 @@ import 'react-focus-lock';
8
8
  import '@alfalab/core-components-portal/dist/esm';
9
9
  import '@alfalab/core-components-backdrop/dist/esm';
10
10
  import '@alfalab/core-components-stack/dist/esm';
11
+ import '@alfalab/core-components-global-store/dist/esm';
11
12
  export { handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js';
package/dist/esm/utils.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { getModalStore } from '@alfalab/core-components-global-store/dist/esm';
2
+
1
3
  function isScrolledToTop(target) {
2
4
  return target.scrollTop <= 0;
3
5
  }
@@ -28,15 +30,15 @@ var isOverflowing = function (container) {
28
30
  var getPaddingRight = function (node) {
29
31
  return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0;
30
32
  };
31
- var restoreStylesStore = [];
32
33
  var restoreContainerStyles = function (container) {
33
- var index = restoreStylesStore.findIndex(function (s) { return s.container === container; });
34
- var existingStyles = restoreStylesStore[index];
34
+ var modalRestoreStyles = getModalStore().getRestoreStyles();
35
+ var index = modalRestoreStyles.findIndex(function (s) { return s.container === container; });
36
+ var existingStyles = modalRestoreStyles[index];
35
37
  if (!existingStyles)
36
38
  return;
37
39
  existingStyles.modals -= 1;
38
40
  if (existingStyles.modals <= 0) {
39
- restoreStylesStore.splice(index, 1);
41
+ modalRestoreStyles.splice(index, 1);
40
42
  existingStyles.styles.forEach(function (_a) {
41
43
  var value = _a.value, el = _a.el, key = _a.key;
42
44
  if (value) {
@@ -51,7 +53,8 @@ var restoreContainerStyles = function (container) {
51
53
  var handleContainer = function (container) {
52
54
  if (!container)
53
55
  return;
54
- var existingStyles = restoreStylesStore.find(function (s) { return s.container === container; });
56
+ var modalRestoreStyles = getModalStore().getRestoreStyles();
57
+ var existingStyles = modalRestoreStyles.find(function (s) { return s.container === container; });
55
58
  if (existingStyles) {
56
59
  existingStyles.modals += 1;
57
60
  return;
@@ -86,7 +89,7 @@ var handleContainer = function (container) {
86
89
  });
87
90
  }
88
91
  scrollContainer.style.overflow = 'hidden';
89
- restoreStylesStore.push({
92
+ modalRestoreStyles.push({
90
93
  container: container,
91
94
  modals: 1,
92
95
  styles: containerStyles,
package/dist/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: nnjeq */
1
+ /* hash: 1pbe4 */
2
2
  :root {
3
3
  --color-light-bg-primary: #fff;
4
4
  }
@@ -10,14 +10,14 @@
10
10
 
11
11
  /* Hard up */
12
12
  }
13
- .base-modal__component_nnjeq {
13
+ .base-modal__component_rp8e5 {
14
14
  position: relative;
15
15
  box-sizing: border-box;
16
16
  background: var(--color-light-bg-primary);
17
17
  margin: auto;
18
18
  flex-shrink: 0;
19
19
  }
20
- .base-modal__wrapper_nnjeq {
20
+ .base-modal__wrapper_rp8e5 {
21
21
  position: fixed;
22
22
  top: 0;
23
23
  left: 0;
@@ -30,33 +30,33 @@
30
30
  align-items: center;
31
31
  outline: 0;
32
32
  }
33
- .base-modal__content_nnjeq {
33
+ .base-modal__content_rp8e5 {
34
34
  width: 100%;
35
35
  height: 100%;
36
36
  display: flex;
37
37
  flex-direction: column;
38
38
  flex: 1;
39
39
  }
40
- .base-modal__hidden_nnjeq {
40
+ .base-modal__hidden_rp8e5 {
41
41
  display: none;
42
42
  }
43
- .base-modal__backdrop_nnjeq {
43
+ .base-modal__backdrop_rp8e5 {
44
44
  z-index: 0;
45
45
  }
46
- .base-modal__appear_nnjeq,
47
- .base-modal__enter_nnjeq {
46
+ .base-modal__appear_rp8e5,
47
+ .base-modal__enter_rp8e5 {
48
48
  opacity: 0;
49
49
  }
50
- .base-modal__appearActive_nnjeq,
51
- .base-modal__enterActive_nnjeq {
50
+ .base-modal__appearActive_rp8e5,
51
+ .base-modal__enterActive_rp8e5 {
52
52
  opacity: 1;
53
53
  transition: opacity 200ms ease-in;
54
54
  }
55
- .base-modal__exit_nnjeq {
55
+ .base-modal__exit_rp8e5 {
56
56
  opacity: 1;
57
57
  }
58
- .base-modal__exitActive_nnjeq,
59
- .base-modal__exitDone_nnjeq {
58
+ .base-modal__exitActive_rp8e5,
59
+ .base-modal__exitDone_rp8e5 {
60
60
  opacity: 0;
61
61
  transition: opacity 200ms ease-out;
62
62
  }
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ require('react-focus-lock');
12
12
  require('@alfalab/core-components-portal');
13
13
  require('@alfalab/core-components-backdrop');
14
14
  require('@alfalab/core-components-stack');
15
+ require('@alfalab/core-components-global-store');
15
16
  var utils = require('./utils.js');
16
17
 
17
18
 
@@ -7,9 +7,10 @@ import FocusLock from 'react-focus-lock';
7
7
  import { Portal } from '@alfalab/core-components-portal/dist/modern';
8
8
  import { Backdrop } from '@alfalab/core-components-backdrop/dist/modern';
9
9
  import { stackingOrder, Stack } from '@alfalab/core-components-stack/dist/modern';
10
+ import '@alfalab/core-components-global-store/dist/modern';
10
11
  import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar } from './utils.js';
11
12
 
12
- var styles = {"component":"base-modal__component_nnjeq","wrapper":"base-modal__wrapper_nnjeq","content":"base-modal__content_nnjeq","hidden":"base-modal__hidden_nnjeq","backdrop":"base-modal__backdrop_nnjeq","appear":"base-modal__appear_nnjeq","enter":"base-modal__enter_nnjeq","appearActive":"base-modal__appearActive_nnjeq","enterActive":"base-modal__enterActive_nnjeq","exit":"base-modal__exit_nnjeq","exitActive":"base-modal__exitActive_nnjeq","exitDone":"base-modal__exitDone_nnjeq"};
13
+ var styles = {"component":"base-modal__component_rp8e5","wrapper":"base-modal__wrapper_rp8e5","content":"base-modal__content_rp8e5","hidden":"base-modal__hidden_rp8e5","backdrop":"base-modal__backdrop_rp8e5","appear":"base-modal__appear_rp8e5","enter":"base-modal__enter_rp8e5","appearActive":"base-modal__appearActive_rp8e5","enterActive":"base-modal__enterActive_rp8e5","exit":"base-modal__exit_rp8e5","exitActive":"base-modal__exitActive_rp8e5","exitDone":"base-modal__exitDone_rp8e5"};
13
14
  require('./index.css')
14
15
 
15
16
  /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
@@ -1,4 +1,4 @@
1
- /* hash: nnjeq */
1
+ /* hash: 1pbe4 */
2
2
  :root {
3
3
  --color-light-bg-primary: #fff;
4
4
  }
@@ -10,14 +10,14 @@
10
10
 
11
11
  /* Hard up */
12
12
  }
13
- .base-modal__component_nnjeq {
13
+ .base-modal__component_rp8e5 {
14
14
  position: relative;
15
15
  box-sizing: border-box;
16
16
  background: var(--color-light-bg-primary);
17
17
  margin: auto;
18
18
  flex-shrink: 0;
19
19
  }
20
- .base-modal__wrapper_nnjeq {
20
+ .base-modal__wrapper_rp8e5 {
21
21
  position: fixed;
22
22
  top: 0;
23
23
  left: 0;
@@ -30,33 +30,33 @@
30
30
  align-items: center;
31
31
  outline: 0;
32
32
  }
33
- .base-modal__content_nnjeq {
33
+ .base-modal__content_rp8e5 {
34
34
  width: 100%;
35
35
  height: 100%;
36
36
  display: flex;
37
37
  flex-direction: column;
38
38
  flex: 1;
39
39
  }
40
- .base-modal__hidden_nnjeq {
40
+ .base-modal__hidden_rp8e5 {
41
41
  display: none;
42
42
  }
43
- .base-modal__backdrop_nnjeq {
43
+ .base-modal__backdrop_rp8e5 {
44
44
  z-index: 0;
45
45
  }
46
- .base-modal__appear_nnjeq,
47
- .base-modal__enter_nnjeq {
46
+ .base-modal__appear_rp8e5,
47
+ .base-modal__enter_rp8e5 {
48
48
  opacity: 0;
49
49
  }
50
- .base-modal__appearActive_nnjeq,
51
- .base-modal__enterActive_nnjeq {
50
+ .base-modal__appearActive_rp8e5,
51
+ .base-modal__enterActive_rp8e5 {
52
52
  opacity: 1;
53
53
  transition: opacity 200ms ease-in;
54
54
  }
55
- .base-modal__exit_nnjeq {
55
+ .base-modal__exit_rp8e5 {
56
56
  opacity: 1;
57
57
  }
58
- .base-modal__exitActive_nnjeq,
59
- .base-modal__exitDone_nnjeq {
58
+ .base-modal__exitActive_rp8e5,
59
+ .base-modal__exitDone_rp8e5 {
60
60
  opacity: 0;
61
61
  transition: opacity 200ms ease-out;
62
62
  }
@@ -7,5 +7,6 @@ import 'react-focus-lock';
7
7
  import '@alfalab/core-components-portal/dist/modern';
8
8
  import '@alfalab/core-components-backdrop/dist/modern';
9
9
  import '@alfalab/core-components-stack/dist/modern';
10
+ import '@alfalab/core-components-global-store/dist/modern';
10
11
  export { handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js';
11
12
  export { BaseModal, BaseModalContext } from './Component.js';
@@ -1,3 +1,5 @@
1
+ import { getModalStore } from '@alfalab/core-components-global-store/dist/modern';
2
+
1
3
  function isScrolledToTop(target) {
2
4
  return target.scrollTop <= 0;
3
5
  }
@@ -28,15 +30,15 @@ const isOverflowing = (container) => {
28
30
  const getPaddingRight = (node) => {
29
31
  return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0;
30
32
  };
31
- const restoreStylesStore = [];
32
33
  const restoreContainerStyles = (container) => {
33
- const index = restoreStylesStore.findIndex(s => s.container === container);
34
- const existingStyles = restoreStylesStore[index];
34
+ const modalRestoreStyles = getModalStore().getRestoreStyles();
35
+ const index = modalRestoreStyles.findIndex(s => s.container === container);
36
+ const existingStyles = modalRestoreStyles[index];
35
37
  if (!existingStyles)
36
38
  return;
37
39
  existingStyles.modals -= 1;
38
40
  if (existingStyles.modals <= 0) {
39
- restoreStylesStore.splice(index, 1);
41
+ modalRestoreStyles.splice(index, 1);
40
42
  existingStyles.styles.forEach(({ value, el, key }) => {
41
43
  if (value) {
42
44
  el.style.setProperty(key, value);
@@ -50,7 +52,8 @@ const restoreContainerStyles = (container) => {
50
52
  const handleContainer = (container) => {
51
53
  if (!container)
52
54
  return;
53
- const existingStyles = restoreStylesStore.find(s => s.container === container);
55
+ const modalRestoreStyles = getModalStore().getRestoreStyles();
56
+ const existingStyles = modalRestoreStyles.find(s => s.container === container);
54
57
  if (existingStyles) {
55
58
  existingStyles.modals += 1;
56
59
  return;
@@ -85,7 +88,7 @@ const handleContainer = (container) => {
85
88
  });
86
89
  }
87
90
  scrollContainer.style.overflow = 'hidden';
88
- restoreStylesStore.push({
91
+ modalRestoreStyles.push({
89
92
  container,
90
93
  modals: 1,
91
94
  styles: containerStyles,
package/dist/utils.js CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var coreComponentsGlobalStore = require('@alfalab/core-components-global-store');
6
+
5
7
  function isScrolledToTop(target) {
6
8
  return target.scrollTop <= 0;
7
9
  }
@@ -32,15 +34,15 @@ var isOverflowing = function (container) {
32
34
  var getPaddingRight = function (node) {
33
35
  return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0;
34
36
  };
35
- var restoreStylesStore = [];
36
37
  var restoreContainerStyles = function (container) {
37
- var index = restoreStylesStore.findIndex(function (s) { return s.container === container; });
38
- var existingStyles = restoreStylesStore[index];
38
+ var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles();
39
+ var index = modalRestoreStyles.findIndex(function (s) { return s.container === container; });
40
+ var existingStyles = modalRestoreStyles[index];
39
41
  if (!existingStyles)
40
42
  return;
41
43
  existingStyles.modals -= 1;
42
44
  if (existingStyles.modals <= 0) {
43
- restoreStylesStore.splice(index, 1);
45
+ modalRestoreStyles.splice(index, 1);
44
46
  existingStyles.styles.forEach(function (_a) {
45
47
  var value = _a.value, el = _a.el, key = _a.key;
46
48
  if (value) {
@@ -55,7 +57,8 @@ var restoreContainerStyles = function (container) {
55
57
  var handleContainer = function (container) {
56
58
  if (!container)
57
59
  return;
58
- var existingStyles = restoreStylesStore.find(function (s) { return s.container === container; });
60
+ var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles();
61
+ var existingStyles = modalRestoreStyles.find(function (s) { return s.container === container; });
59
62
  if (existingStyles) {
60
63
  existingStyles.modals += 1;
61
64
  return;
@@ -90,7 +93,7 @@ var handleContainer = function (container) {
90
93
  });
91
94
  }
92
95
  scrollContainer.style.overflow = 'hidden';
93
- restoreStylesStore.push({
96
+ modalRestoreStyles.push({
94
97
  container: container,
95
98
  modals: 1,
96
99
  styles: containerStyles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-base-modal",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "BaseModal component",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@alfalab/core-components-backdrop": "^2.0.1",
19
+ "@alfalab/core-components-global-store": "^1.1.0",
19
20
  "@alfalab/core-components-portal": "^2.0.1",
20
21
  "@alfalab/core-components-stack": "^3.0.1",
21
22
  "classnames": "^2.2.6",
@@ -30,5 +31,5 @@
30
31
  "peerDependencies": {
31
32
  "react": "^16.9.0 || ^17.0.1"
32
33
  },
33
- "gitHead": "a80a4377703da0cb8fd257612117ef3eb2d9bc42"
34
+ "gitHead": "d35b2d43cbc90ecb7665c682a2de13733bc03eb0"
34
35
  }