@hh.ru/magritte-ui-full-screen-loader 1.1.4 → 1.1.6
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/FullScreenLoader.js +1 -1
- package/FullScreenLoader.js.map +1 -1
- package/index.css +21 -21
- package/package.json +8 -8
package/FullScreenLoader.js
CHANGED
|
@@ -10,7 +10,7 @@ import { Layer } from '@hh.ru/magritte-ui-layer';
|
|
|
10
10
|
import { Loader } from '@hh.ru/magritte-ui-loader';
|
|
11
11
|
import { ThemeWrapper } from '@hh.ru/magritte-ui-theme-wrapper';
|
|
12
12
|
|
|
13
|
-
var styles = {"animation-timeout":"magritte-animation-timeout___aTdGa_1-1-
|
|
13
|
+
var styles = {"animation-timeout":"magritte-animation-timeout___aTdGa_1-1-6","animationTimeout":"magritte-animation-timeout___aTdGa_1-1-6","enter-animation":"magritte-enter-animation___TqSXR_1-1-6","enterAnimation":"magritte-enter-animation___TqSXR_1-1-6","enter-animation-active":"magritte-enter-animation-active___Jfsvw_1-1-6","enterAnimationActive":"magritte-enter-animation-active___Jfsvw_1-1-6","exit-animation":"magritte-exit-animation___6VlKj_1-1-6","exitAnimation":"magritte-exit-animation___6VlKj_1-1-6","exit-animation-active":"magritte-exit-animation-active___VanCA_1-1-6","exitAnimationActive":"magritte-exit-animation-active___VanCA_1-1-6","overlay":"magritte-overlay___YsKtP_1-1-6","loader":"magritte-loader___vx7PF_1-1-6"};
|
|
14
14
|
|
|
15
15
|
const CSS_CLASSES = {
|
|
16
16
|
enter: styles.enterAnimation,
|
package/FullScreenLoader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullScreenLoader.js","sources":["
|
|
1
|
+
{"version":3,"file":"FullScreenLoader.js","sources":["src/FullScreenLoader.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { CSSTransition } from 'react-transition-group';\nimport classnames from 'classnames';\n\nimport { useServerEnv } from '@hh.ru/magritte-common-is-server-env';\nimport { disableScroll, TimeoutCallback } from '@hh.ru/magritte-common-modal-helper';\nimport { Layer } from '@hh.ru/magritte-ui-layer';\nimport { Loader, LoaderProps } from '@hh.ru/magritte-ui-loader';\nimport { ThemeWrapper } from '@hh.ru/magritte-ui-theme-wrapper';\n\nimport styles from './full-screen-loader.less';\n\ntype AnimationTimeout = { enter: number; exit: number };\n\nexport interface FullScreenLoaderProps {\n loading: boolean;\n}\n\nconst CSS_CLASSES = {\n enter: styles.enterAnimation,\n enterActive: styles.enterAnimationActive,\n exit: styles.exitAnimation,\n exitActive: styles.exitAnimationActive,\n};\n\nconst toInteger = (value: string) => {\n const result = parseInt(value, 10);\n return !Number.isNaN(result) ? result : 0;\n};\n\nexport const FullScreenLoader: React.FC<FullScreenLoaderProps & Omit<LoaderProps, 'size'>> = ({\n loading,\n ...props\n}) => {\n const [animationTimeout, setAnimationTimeout] = useState<AnimationTimeout | null>(null);\n const animationTimeoutRef = useRef(animationTimeout);\n animationTimeoutRef.current = animationTimeout;\n const animatedElementRef = useRef(null);\n\n useEffect(() => {\n const animationTimeoutElement = document.createElement('div');\n animationTimeoutElement.classList.add(styles.animationTimeout);\n document.body.appendChild(animationTimeoutElement);\n const style = window.getComputedStyle(animationTimeoutElement);\n const enter = toInteger(style.getPropertyValue('--enter-animation-duration'));\n const exit = toInteger(style.getPropertyValue('--exit-animation-duration'));\n setAnimationTimeout({ enter, exit });\n document.body.removeChild(animationTimeoutElement);\n }, [setAnimationTimeout]);\n\n useEffect(() => {\n if (loading) {\n let enableScroll: TimeoutCallback | undefined = disableScroll();\n return () => {\n enableScroll?.(animationTimeoutRef.current?.exit);\n enableScroll = undefined;\n };\n }\n\n return void 0;\n }, [loading]);\n\n const isServerEnv = useServerEnv();\n if (!animationTimeout || isServerEnv) {\n return null;\n }\n\n return createPortal(\n <CSSTransition\n appear\n classNames={CSS_CLASSES}\n in={loading}\n mountOnEnter\n nodeRef={animatedElementRef}\n timeout={animationTimeout}\n unmountOnExit\n >\n <ThemeWrapper>\n {(themeClass) => (\n <Layer layer=\"full-screen-loader\">\n <div\n className={classnames(styles.animationTimeout, styles.overlay, themeClass)}\n ref={animatedElementRef}\n >\n <div className={styles.loader}>\n <Loader initial=\"contrast\" size={48} {...props} />\n </div>\n </div>\n </Layer>\n )}\n </ThemeWrapper>\n </CSSTransition>,\n document.body\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;AAmBA,MAAM,WAAW,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC,cAAc;IAC5B,WAAW,EAAE,MAAM,CAAC,oBAAoB;IACxC,IAAI,EAAE,MAAM,CAAC,aAAa;IAC1B,UAAU,EAAE,MAAM,CAAC,mBAAmB;CACzC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAa,KAAI;IAChC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,IAAA,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEK,MAAM,gBAAgB,GAAgE,CAAC,EAC1F,OAAO,EACP,GAAG,KAAK,EACX,KAAI;IACD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAA0B,IAAI,CAAC,CAAC;AACxF,IAAA,MAAM,mBAAmB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACrD,IAAA,mBAAmB,CAAC,OAAO,GAAG,gBAAgB,CAAC;AAC/C,IAAA,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAExC,SAAS,CAAC,MAAK;QACX,MAAM,uBAAuB,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9D,uBAAuB,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC/D,QAAA,QAAQ,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AAK,EAAC,EAAA,KAAK,EAAC,oBAAoB,EAAA,QAAA,EAC7BA,GACI,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,EAC1E,GAAG,EAAE,kBAAkB,YAEvBA,GAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,MAAM,EACzB,QAAA,EAAAA,GAAA,CAAC,MAAM,EAAC,EAAA,OAAO,EAAC,UAAU,EAAC,IAAI,EAAE,EAAE,KAAM,KAAK,EAAA,CAAI,GAChD,EACJ,CAAA,EAAA,CACF,CACX,EACU,CAAA,EAAA,CACH,EAChB,QAAQ,CAAC,IAAI,CAChB,CAAC;AACN;;;;"}
|
package/index.css
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
:root{
|
|
2
|
-
--magritte-color-background-overlay-v24-4-
|
|
3
|
-
--magritte-color-background-constant-secondary-v24-4-
|
|
2
|
+
--magritte-color-background-overlay-v24-4-1:#20262b99;
|
|
3
|
+
--magritte-color-background-constant-secondary-v24-4-1:#303030;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
:root{
|
|
7
|
-
--magritte-semantic-animation-ease-in-out-200-timing-function-v24-4-
|
|
8
|
-
--magritte-semantic-animation-ease-in-out-200-duration-v24-4-
|
|
9
|
-
--magritte-semantic-animation-ease-in-out-300-timing-function-v24-4-
|
|
10
|
-
--magritte-semantic-animation-ease-in-out-300-duration-v24-4-
|
|
7
|
+
--magritte-semantic-animation-ease-in-out-200-timing-function-v24-4-1:cubic-bezier(0.25, 0.1, 0.25, 1);
|
|
8
|
+
--magritte-semantic-animation-ease-in-out-200-duration-v24-4-1:200ms;
|
|
9
|
+
--magritte-semantic-animation-ease-in-out-300-timing-function-v24-4-1:cubic-bezier(0.25, 0.1, 0.25, 1);
|
|
10
|
+
--magritte-semantic-animation-ease-in-out-300-duration-v24-4-1:300ms;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.magritte-night-theme{
|
|
14
|
-
--magritte-color-background-constant-secondary-v24-4-
|
|
14
|
+
--magritte-color-background-constant-secondary-v24-4-1:#343c43;
|
|
15
15
|
}
|
|
16
|
-
.magritte-animation-timeout___aTdGa_1-1-
|
|
16
|
+
.magritte-animation-timeout___aTdGa_1-1-6{
|
|
17
17
|
--enter-animation-duration:0ms;
|
|
18
18
|
--exit-animation-duration:0ms;
|
|
19
19
|
}
|
|
20
20
|
@media (prefers-reduced-motion: no-preference){
|
|
21
|
-
.magritte-animation-timeout___aTdGa_1-1-
|
|
22
|
-
--enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v24-4-
|
|
23
|
-
--exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-4-
|
|
21
|
+
.magritte-animation-timeout___aTdGa_1-1-6{
|
|
22
|
+
--enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v24-4-1);
|
|
23
|
+
--exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-4-1);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
.magritte-enter-animation___TqSXR_1-1-
|
|
26
|
+
.magritte-enter-animation___TqSXR_1-1-6{
|
|
27
27
|
opacity:0;
|
|
28
28
|
}
|
|
29
|
-
.magritte-enter-animation-active___Jfsvw_1-1-
|
|
29
|
+
.magritte-enter-animation-active___Jfsvw_1-1-6{
|
|
30
30
|
opacity:1;
|
|
31
31
|
transition-property:opacity;
|
|
32
32
|
transition-duration:var(--enter-animation-duration);
|
|
33
|
-
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v24-4-
|
|
33
|
+
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v24-4-1);
|
|
34
34
|
}
|
|
35
|
-
.magritte-exit-animation___6VlKj_1-1-
|
|
35
|
+
.magritte-exit-animation___6VlKj_1-1-6{
|
|
36
36
|
opacity:1;
|
|
37
37
|
}
|
|
38
|
-
.magritte-exit-animation-active___VanCA_1-1-
|
|
38
|
+
.magritte-exit-animation-active___VanCA_1-1-6{
|
|
39
39
|
opacity:0;
|
|
40
40
|
transition-property:opacity;
|
|
41
41
|
transition-duration:var(--exit-animation-duration);
|
|
42
|
-
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v24-4-
|
|
42
|
+
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v24-4-1);
|
|
43
43
|
}
|
|
44
|
-
.magritte-overlay___YsKtP_1-1-
|
|
44
|
+
.magritte-overlay___YsKtP_1-1-6{
|
|
45
45
|
display:flex;
|
|
46
46
|
align-items:center;
|
|
47
47
|
justify-content:center;
|
|
48
48
|
position:fixed;
|
|
49
49
|
inset:0;
|
|
50
|
-
background-color:var(--magritte-color-background-overlay-v24-4-
|
|
50
|
+
background-color:var(--magritte-color-background-overlay-v24-4-1);
|
|
51
51
|
}
|
|
52
|
-
.magritte-loader___vx7PF_1-1-
|
|
53
|
-
background-color:var(--magritte-color-background-constant-secondary-v24-4-
|
|
52
|
+
.magritte-loader___vx7PF_1-1-6{
|
|
53
|
+
background-color:var(--magritte-color-background-constant-secondary-v24-4-1);
|
|
54
54
|
border-radius:28px;
|
|
55
55
|
line-height:0;
|
|
56
56
|
padding:20px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-full-screen-loader",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"watch": "yarn root:watch $(pwd)"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@hh.ru/magritte-common-is-server-env": "1.0.
|
|
23
|
-
"@hh.ru/magritte-common-modal-helper": "1.3.
|
|
24
|
-
"@hh.ru/magritte-design-tokens": "24.4.
|
|
25
|
-
"@hh.ru/magritte-ui-layer": "3.2.
|
|
26
|
-
"@hh.ru/magritte-ui-loader": "2.1.
|
|
27
|
-
"@hh.ru/magritte-ui-theme-wrapper": "1.1.
|
|
22
|
+
"@hh.ru/magritte-common-is-server-env": "1.0.8",
|
|
23
|
+
"@hh.ru/magritte-common-modal-helper": "1.3.1",
|
|
24
|
+
"@hh.ru/magritte-design-tokens": "24.4.1",
|
|
25
|
+
"@hh.ru/magritte-ui-layer": "3.2.2",
|
|
26
|
+
"@hh.ru/magritte-ui-loader": "2.1.6",
|
|
27
|
+
"@hh.ru/magritte-ui-theme-wrapper": "1.1.12"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"classnames": ">=2.3.2",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "9a088ded46caac9429f3e9fadaf055300b36990e"
|
|
39
39
|
}
|