@alfalab/core-components-base-modal
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [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) | ||
### Features | ||
* **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)) | ||
## [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) | ||
@@ -8,0 +19,0 @@ |
@@ -14,2 +14,3 @@ 'use strict'; | ||
var coreComponentsStack = require('@alfalab/core-components-stack'); | ||
require('@alfalab/core-components-global-store'); | ||
var utils = require('./utils.js'); | ||
@@ -51,3 +52,3 @@ | ||
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"}; | ||
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"}; | ||
require('./index.css') | ||
@@ -54,0 +55,0 @@ |
@@ -14,2 +14,3 @@ 'use strict'; | ||
var coreComponentsStack = require('@alfalab/core-components-stack/dist/cssm'); | ||
require('@alfalab/core-components-global-store/dist/cssm'); | ||
var utils = require('./utils.js'); | ||
@@ -16,0 +17,0 @@ var styles = require('./index.module.css'); |
@@ -15,2 +15,3 @@ 'use strict'; | ||
require('@alfalab/core-components-stack/dist/cssm'); | ||
require('@alfalab/core-components-global-store/dist/cssm'); | ||
var utils = require('./utils.js'); | ||
@@ -17,0 +18,0 @@ require('./index.module.css'); |
@@ -5,2 +5,4 @@ 'use strict'; | ||
var coreComponentsGlobalStore = require('@alfalab/core-components-global-store/dist/cssm'); | ||
function isScrolledToTop(target) { | ||
@@ -36,6 +38,6 @@ return target.scrollTop <= 0; | ||
}; | ||
var restoreStylesStore = []; | ||
var restoreContainerStyles = function (container) { | ||
var index = restoreStylesStore.findIndex(function (s) { return s.container === container; }); | ||
var existingStyles = restoreStylesStore[index]; | ||
var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles(); | ||
var index = modalRestoreStyles.findIndex(function (s) { return s.container === container; }); | ||
var existingStyles = modalRestoreStyles[index]; | ||
if (!existingStyles) | ||
@@ -45,3 +47,3 @@ return; | ||
if (existingStyles.modals <= 0) { | ||
restoreStylesStore.splice(index, 1); | ||
modalRestoreStyles.splice(index, 1); | ||
existingStyles.styles.forEach(function (_a) { | ||
@@ -61,3 +63,4 @@ var value = _a.value, el = _a.el, key = _a.key; | ||
return; | ||
var existingStyles = restoreStylesStore.find(function (s) { return s.container === container; }); | ||
var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles(); | ||
var existingStyles = modalRestoreStyles.find(function (s) { return s.container === container; }); | ||
if (existingStyles) { | ||
@@ -97,3 +100,3 @@ existingStyles.modals += 1; | ||
scrollContainer.style.overflow = 'hidden'; | ||
restoreStylesStore.push({ | ||
modalRestoreStyles.push({ | ||
container: container, | ||
@@ -100,0 +103,0 @@ modals: 1, |
@@ -10,2 +10,3 @@ import React, { forwardRef, useState, useRef, useCallback, useMemo, useEffect } from 'react'; | ||
import { stackingOrder, Stack } from '@alfalab/core-components-stack/dist/esm'; | ||
import '@alfalab/core-components-global-store/dist/esm'; | ||
import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar } from './utils.js'; | ||
@@ -40,3 +41,3 @@ | ||
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"}; | ||
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"}; | ||
require('./index.css') | ||
@@ -43,0 +44,0 @@ |
@@ -11,2 +11,3 @@ export { BaseModal, BaseModalContext } from './Component.js'; | ||
import '@alfalab/core-components-stack/dist/esm'; | ||
import '@alfalab/core-components-global-store/dist/esm'; | ||
export { handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js'; |
@@ -0,1 +1,3 @@ | ||
import { getModalStore } from '@alfalab/core-components-global-store/dist/esm'; | ||
function isScrolledToTop(target) { | ||
@@ -31,6 +33,6 @@ return target.scrollTop <= 0; | ||
}; | ||
var restoreStylesStore = []; | ||
var restoreContainerStyles = function (container) { | ||
var index = restoreStylesStore.findIndex(function (s) { return s.container === container; }); | ||
var existingStyles = restoreStylesStore[index]; | ||
var modalRestoreStyles = getModalStore().getRestoreStyles(); | ||
var index = modalRestoreStyles.findIndex(function (s) { return s.container === container; }); | ||
var existingStyles = modalRestoreStyles[index]; | ||
if (!existingStyles) | ||
@@ -40,3 +42,3 @@ return; | ||
if (existingStyles.modals <= 0) { | ||
restoreStylesStore.splice(index, 1); | ||
modalRestoreStyles.splice(index, 1); | ||
existingStyles.styles.forEach(function (_a) { | ||
@@ -56,3 +58,4 @@ var value = _a.value, el = _a.el, key = _a.key; | ||
return; | ||
var existingStyles = restoreStylesStore.find(function (s) { return s.container === container; }); | ||
var modalRestoreStyles = getModalStore().getRestoreStyles(); | ||
var existingStyles = modalRestoreStyles.find(function (s) { return s.container === container; }); | ||
if (existingStyles) { | ||
@@ -92,3 +95,3 @@ existingStyles.modals += 1; | ||
scrollContainer.style.overflow = 'hidden'; | ||
restoreStylesStore.push({ | ||
modalRestoreStyles.push({ | ||
container: container, | ||
@@ -95,0 +98,0 @@ modals: 1, |
@@ -15,2 +15,3 @@ 'use strict'; | ||
require('@alfalab/core-components-stack'); | ||
require('@alfalab/core-components-global-store'); | ||
var utils = require('./utils.js'); | ||
@@ -17,0 +18,0 @@ |
@@ -10,5 +10,6 @@ import React, { forwardRef, useState, useRef, useCallback, useMemo, useEffect } from 'react'; | ||
import { stackingOrder, Stack } from '@alfalab/core-components-stack/dist/modern'; | ||
import '@alfalab/core-components-global-store/dist/modern'; | ||
import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar } from './utils.js'; | ||
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"}; | ||
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"}; | ||
require('./index.css') | ||
@@ -15,0 +16,0 @@ |
@@ -10,3 +10,4 @@ import 'react'; | ||
import '@alfalab/core-components-stack/dist/modern'; | ||
import '@alfalab/core-components-global-store/dist/modern'; | ||
export { handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js'; | ||
export { BaseModal, BaseModalContext } from './Component.js'; |
@@ -0,1 +1,3 @@ | ||
import { getModalStore } from '@alfalab/core-components-global-store/dist/modern'; | ||
function isScrolledToTop(target) { | ||
@@ -31,6 +33,6 @@ return target.scrollTop <= 0; | ||
}; | ||
const restoreStylesStore = []; | ||
const restoreContainerStyles = (container) => { | ||
const index = restoreStylesStore.findIndex(s => s.container === container); | ||
const existingStyles = restoreStylesStore[index]; | ||
const modalRestoreStyles = getModalStore().getRestoreStyles(); | ||
const index = modalRestoreStyles.findIndex(s => s.container === container); | ||
const existingStyles = modalRestoreStyles[index]; | ||
if (!existingStyles) | ||
@@ -40,3 +42,3 @@ return; | ||
if (existingStyles.modals <= 0) { | ||
restoreStylesStore.splice(index, 1); | ||
modalRestoreStyles.splice(index, 1); | ||
existingStyles.styles.forEach(({ value, el, key }) => { | ||
@@ -55,3 +57,4 @@ if (value) { | ||
return; | ||
const existingStyles = restoreStylesStore.find(s => s.container === container); | ||
const modalRestoreStyles = getModalStore().getRestoreStyles(); | ||
const existingStyles = modalRestoreStyles.find(s => s.container === container); | ||
if (existingStyles) { | ||
@@ -91,3 +94,3 @@ existingStyles.modals += 1; | ||
scrollContainer.style.overflow = 'hidden'; | ||
restoreStylesStore.push({ | ||
modalRestoreStyles.push({ | ||
container, | ||
@@ -94,0 +97,0 @@ modals: 1, |
@@ -5,2 +5,4 @@ 'use strict'; | ||
var coreComponentsGlobalStore = require('@alfalab/core-components-global-store'); | ||
function isScrolledToTop(target) { | ||
@@ -36,6 +38,6 @@ return target.scrollTop <= 0; | ||
}; | ||
var restoreStylesStore = []; | ||
var restoreContainerStyles = function (container) { | ||
var index = restoreStylesStore.findIndex(function (s) { return s.container === container; }); | ||
var existingStyles = restoreStylesStore[index]; | ||
var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles(); | ||
var index = modalRestoreStyles.findIndex(function (s) { return s.container === container; }); | ||
var existingStyles = modalRestoreStyles[index]; | ||
if (!existingStyles) | ||
@@ -45,3 +47,3 @@ return; | ||
if (existingStyles.modals <= 0) { | ||
restoreStylesStore.splice(index, 1); | ||
modalRestoreStyles.splice(index, 1); | ||
existingStyles.styles.forEach(function (_a) { | ||
@@ -61,3 +63,4 @@ var value = _a.value, el = _a.el, key = _a.key; | ||
return; | ||
var existingStyles = restoreStylesStore.find(function (s) { return s.container === container; }); | ||
var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles(); | ||
var existingStyles = modalRestoreStyles.find(function (s) { return s.container === container; }); | ||
if (existingStyles) { | ||
@@ -97,3 +100,3 @@ existingStyles.modals += 1; | ||
scrollContainer.style.overflow = 'hidden'; | ||
restoreStylesStore.push({ | ||
modalRestoreStyles.push({ | ||
container: container, | ||
@@ -100,0 +103,0 @@ modals: 1, |
{ | ||
"name": "@alfalab/core-components-base-modal", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "BaseModal component", | ||
@@ -19,2 +19,3 @@ "keywords": [], | ||
"@alfalab/core-components-backdrop": "^2.0.1", | ||
"@alfalab/core-components-global-store": "^1.1.0", | ||
"@alfalab/core-components-portal": "^2.0.1", | ||
@@ -34,3 +35,3 @@ "@alfalab/core-components-stack": "^3.0.1", | ||
}, | ||
"gitHead": "a80a4377703da0cb8fd257612117ef3eb2d9bc42" | ||
"gitHead": "d35b2d43cbc90ecb7665c682a2de13733bc03eb0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99273
2216
10
+ Added@alfalab/core-components-global-store@1.1.3(transitive)