@mantine/nprogress 5.0.0-alpha.7 → 5.0.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/README.md +1 -1
- package/package.json +7 -6
- package/cjs/NProgress.js +0 -135
- package/cjs/NProgress.js.map +0 -1
- package/cjs/mantine-nprogress/src/NavigationProgress.js +0 -126
- package/cjs/mantine-nprogress/src/NavigationProgress.js.map +0 -1
- package/cjs/mantine-nprogress/src/events.js +0 -23
- package/cjs/mantine-nprogress/src/events.js.map +0 -1
- package/cjs/mantine-nprogress/src/index.js +0 -17
- package/cjs/mantine-nprogress/src/index.js.map +0 -1
- package/cjs/mantine-styles/esm/theme/utils/get-default-z-index/get-default-z-index.js +0 -17
- package/cjs/mantine-styles/esm/theme/utils/get-default-z-index/get-default-z-index.js.map +0 -1
- package/esm/NProgress.js +0 -127
- package/esm/NProgress.js.map +0 -1
- package/esm/mantine-nprogress/src/NavigationProgress.js +0 -118
- package/esm/mantine-nprogress/src/NavigationProgress.js.map +0 -1
- package/esm/mantine-nprogress/src/events.js +0 -12
- package/esm/mantine-nprogress/src/events.js.map +0 -1
- package/esm/mantine-nprogress/src/index.js +0 -3
- package/esm/mantine-nprogress/src/index.js.map +0 -1
- package/esm/mantine-styles/esm/theme/utils/get-default-z-index/get-default-z-index.js +0 -13
- package/esm/mantine-styles/esm/theme/utils/get-default-z-index/get-default-z-index.js.map +0 -1
- package/lib/NProgress.d.ts +0 -32
- package/lib/NProgress.d.ts.map +0 -1
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantine/nprogress",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "5.0.0
|
|
3
|
+
"description": "Navigation progress bar",
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
"directory": "src/mantine-nprogress"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@mantine/core": "5.0.0
|
|
19
|
-
"@mantine/hooks": "5.0.0
|
|
20
|
-
"@mantine/utils": "5.0.0-alpha.7",
|
|
18
|
+
"@mantine/core": "5.0.0",
|
|
19
|
+
"@mantine/hooks": "5.0.0",
|
|
21
20
|
"react": ">=16.8.0",
|
|
22
21
|
"react-dom": ">=16.8.0"
|
|
23
22
|
},
|
|
24
|
-
"dependencies": {
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@mantine/utils": "5.0.0"
|
|
25
|
+
},
|
|
25
26
|
"devDependencies": {}
|
|
26
27
|
}
|
package/cjs/NProgress.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var core = require('@mantine/core');
|
|
6
|
-
var hooks = require('@mantine/hooks');
|
|
7
|
-
var styles = require('@mantine/styles');
|
|
8
|
-
var React = require('react');
|
|
9
|
-
var events = require('./events.js');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
12
|
-
|
|
13
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
-
|
|
15
|
-
function NProgress({
|
|
16
|
-
defaultProgress = 0,
|
|
17
|
-
color = "blue",
|
|
18
|
-
size = 2,
|
|
19
|
-
stepIntervalTime = 500,
|
|
20
|
-
progressTransition = "ease",
|
|
21
|
-
progressTransitionDuration = 600,
|
|
22
|
-
exitTimeout = 700,
|
|
23
|
-
exitTransitionDuration = 600,
|
|
24
|
-
exitTransition = "ease",
|
|
25
|
-
onFinish,
|
|
26
|
-
autoReset = false,
|
|
27
|
-
withinPortal = true,
|
|
28
|
-
zIndex = styles.getDefaultZIndex("max")
|
|
29
|
-
}) {
|
|
30
|
-
const theme = core.useMantineTheme();
|
|
31
|
-
const shouldReduceMotion = hooks.useReducedMotion();
|
|
32
|
-
const reducedMotion = theme.respectReducedMotion ? shouldReduceMotion : false;
|
|
33
|
-
const [_progress, setProgress] = React.useState(defaultProgress);
|
|
34
|
-
const [mounted, setMounted] = React.useState(true);
|
|
35
|
-
const [unmountProgress, setUnmountProgress] = React.useState(false);
|
|
36
|
-
const resetRef = React.useRef();
|
|
37
|
-
const unmountRef = React.useRef();
|
|
38
|
-
const interval = hooks.useInterval(() => {
|
|
39
|
-
setProgress((amount) => {
|
|
40
|
-
let next = 0;
|
|
41
|
-
if (amount >= 0 && amount <= 20) {
|
|
42
|
-
next = 10;
|
|
43
|
-
} else if (amount >= 20 && amount <= 50) {
|
|
44
|
-
next = 4;
|
|
45
|
-
} else if (amount >= 50 && amount <= 80) {
|
|
46
|
-
next = 2;
|
|
47
|
-
} else if (amount >= 80 && amount <= 99) {
|
|
48
|
-
next = 0.5;
|
|
49
|
-
}
|
|
50
|
-
return amount + next;
|
|
51
|
-
});
|
|
52
|
-
}, stepIntervalTime);
|
|
53
|
-
const set = (value) => setProgress(value);
|
|
54
|
-
const add = (value) => setProgress((c) => Math.min(c + value, 100));
|
|
55
|
-
const decrease = (value) => setProgress((c) => Math.max(c - value, 0));
|
|
56
|
-
const start = () => {
|
|
57
|
-
interval.stop();
|
|
58
|
-
interval.start();
|
|
59
|
-
};
|
|
60
|
-
const stop = () => interval.stop();
|
|
61
|
-
const reset = () => {
|
|
62
|
-
setUnmountProgress(true);
|
|
63
|
-
stop();
|
|
64
|
-
setProgress(0);
|
|
65
|
-
window.setTimeout(() => setUnmountProgress(false), 0);
|
|
66
|
-
};
|
|
67
|
-
const ctx = {
|
|
68
|
-
set,
|
|
69
|
-
add,
|
|
70
|
-
decrease,
|
|
71
|
-
start,
|
|
72
|
-
stop,
|
|
73
|
-
reset
|
|
74
|
-
};
|
|
75
|
-
const cancelUnmount = () => {
|
|
76
|
-
if (unmountRef.current) {
|
|
77
|
-
window.clearTimeout(unmountRef.current);
|
|
78
|
-
unmountRef.current = null;
|
|
79
|
-
}
|
|
80
|
-
if (resetRef.current) {
|
|
81
|
-
window.clearTimeout(resetRef.current);
|
|
82
|
-
resetRef.current = null;
|
|
83
|
-
}
|
|
84
|
-
setMounted(true);
|
|
85
|
-
};
|
|
86
|
-
hooks.useDidUpdate(() => {
|
|
87
|
-
if (_progress >= 100) {
|
|
88
|
-
stop();
|
|
89
|
-
onFinish && onFinish();
|
|
90
|
-
unmountRef.current = window.setTimeout(() => {
|
|
91
|
-
unmountRef.current = null;
|
|
92
|
-
setMounted(false);
|
|
93
|
-
if (autoReset) {
|
|
94
|
-
resetRef.current = window.setTimeout(() => {
|
|
95
|
-
resetRef.current = null;
|
|
96
|
-
reset();
|
|
97
|
-
}, reducedMotion ? 0 : exitTransitionDuration);
|
|
98
|
-
}
|
|
99
|
-
}, exitTimeout);
|
|
100
|
-
} else if (!mounted) {
|
|
101
|
-
cancelUnmount();
|
|
102
|
-
}
|
|
103
|
-
}, [_progress]);
|
|
104
|
-
events.useNProgressEvents(ctx);
|
|
105
|
-
return /* @__PURE__ */ React__default.createElement(core.OptionalPortal, {
|
|
106
|
-
withinPortal
|
|
107
|
-
}, !unmountProgress && /* @__PURE__ */ React__default.createElement(core.Progress, {
|
|
108
|
-
radius: 0,
|
|
109
|
-
value: _progress,
|
|
110
|
-
size,
|
|
111
|
-
color,
|
|
112
|
-
styles: {
|
|
113
|
-
root: {
|
|
114
|
-
top: 0,
|
|
115
|
-
left: 0,
|
|
116
|
-
position: "fixed",
|
|
117
|
-
zIndex,
|
|
118
|
-
width: "100vw",
|
|
119
|
-
backgroundColor: "transparent",
|
|
120
|
-
transitionProperty: "opacity",
|
|
121
|
-
transitionTimingFunction: exitTransition,
|
|
122
|
-
transitionDuration: `${reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration}ms`,
|
|
123
|
-
opacity: mounted ? 1 : 0
|
|
124
|
-
},
|
|
125
|
-
bar: {
|
|
126
|
-
transitionProperty: "width",
|
|
127
|
-
transitionTimingFunction: progressTransition,
|
|
128
|
-
transitionDuration: `${reducedMotion || !mounted ? 0 : progressTransitionDuration}ms`
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
exports.NProgress = NProgress;
|
|
135
|
-
//# sourceMappingURL=NProgress.js.map
|
package/cjs/NProgress.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NProgress.js","sources":["../src/NProgress.tsx"],"sourcesContent":["import { OptionalPortal, Progress, useMantineTheme } from '@mantine/core';\nimport { useDidUpdate, useInterval, useReducedMotion } from '@mantine/hooks';\nimport { getDefaultZIndex, MantineColor } from '@mantine/styles';\nimport React, { useRef, useState } from 'react';\nimport { useNProgressEvents } from './events';\n\nexport interface NProgressProps {\n /** The default progress */\n defaultProgress?: number;\n\n /** The color of the progressbar */\n color?: MantineColor;\n\n /** The height of the progressbar */\n size?: number;\n\n /** Called when the progress is 100% */\n onFinish?: () => void;\n\n /** Automatically resets the progress when 100% is reached */\n autoReset?: boolean;\n\n /** Step delay in ms */\n stepIntervalTime?: number;\n\n /** Transition function (transition-timing-function) */\n progressTransition?: string;\n\n /** Transition duration in ms */\n progressTransitionDuration?: number;\n\n /** The time when the component should be unmounted after progress is 100% */\n exitTimeout?: number;\n\n /** Exit transition duration in ms */\n exitTransitionDuration?: number;\n\n /** Exit transition function (transition-timing-function)*/\n exitTransition?: string;\n\n /** Determines whether NProgress should be rendered within Portal, defaults to true */\n withinPortal?: boolean;\n\n /** NProgress container z-index */\n zIndex?: React.CSSProperties['zIndex'];\n}\n\nexport function NProgress({\n defaultProgress = 0,\n color = 'blue',\n size = 2,\n stepIntervalTime = 500,\n progressTransition = 'ease',\n progressTransitionDuration = 600,\n exitTimeout = 700,\n exitTransitionDuration = 600,\n exitTransition = 'ease',\n onFinish,\n autoReset = false,\n withinPortal = true,\n zIndex = getDefaultZIndex('max'),\n}: NProgressProps) {\n const theme = useMantineTheme();\n const shouldReduceMotion = useReducedMotion();\n const reducedMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const [_progress, setProgress] = useState(defaultProgress);\n const [mounted, setMounted] = useState(true);\n const [unmountProgress, setUnmountProgress] = useState(false);\n const resetRef = useRef<number>();\n const unmountRef = useRef<number>();\n\n const interval = useInterval(() => {\n setProgress((amount) => {\n let next = 0;\n if (amount >= 0 && amount <= 20) {\n next = 10;\n } else if (amount >= 20 && amount <= 50) {\n next = 4;\n } else if (amount >= 50 && amount <= 80) {\n next = 2;\n } else if (amount >= 80 && amount <= 99) {\n next = 0.5;\n }\n\n return amount + next;\n });\n }, stepIntervalTime);\n\n const set = (value: React.SetStateAction<number>) => setProgress(value);\n const add = (value: number) => setProgress((c) => Math.min(c + value, 100));\n const decrease = (value: number) => setProgress((c) => Math.max(c - value, 0));\n const start = () => {\n interval.stop();\n interval.start();\n };\n const stop = () => interval.stop();\n const reset = () => {\n setUnmountProgress(true);\n stop();\n setProgress(0);\n window.setTimeout(() => setUnmountProgress(false), 0);\n };\n\n const ctx = {\n set,\n add,\n decrease,\n start,\n stop,\n reset,\n };\n\n const cancelUnmount = () => {\n if (unmountRef.current) {\n window.clearTimeout(unmountRef.current);\n unmountRef.current = null;\n }\n if (resetRef.current) {\n window.clearTimeout(resetRef.current);\n resetRef.current = null;\n }\n\n setMounted(true);\n };\n\n useDidUpdate(() => {\n if (_progress >= 100) {\n stop();\n onFinish && onFinish();\n unmountRef.current = window.setTimeout(() => {\n unmountRef.current = null;\n setMounted(false);\n\n if (autoReset) {\n resetRef.current = window.setTimeout(\n () => {\n resetRef.current = null;\n reset();\n },\n reducedMotion ? 0 : exitTransitionDuration\n );\n }\n }, exitTimeout);\n } else if (!mounted) {\n cancelUnmount();\n }\n }, [_progress]);\n\n useNProgressEvents(ctx);\n\n return (\n <OptionalPortal withinPortal={withinPortal}>\n {!unmountProgress && (\n <Progress\n radius={0}\n value={_progress}\n size={size}\n color={color}\n styles={{\n root: {\n top: 0,\n left: 0,\n position: 'fixed',\n zIndex,\n width: '100vw',\n backgroundColor: 'transparent',\n transitionProperty: 'opacity',\n transitionTimingFunction: exitTransition,\n transitionDuration: `${\n reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration\n }ms`,\n opacity: mounted ? 1 : 0,\n },\n bar: {\n transitionProperty: 'width',\n transitionTimingFunction: progressTransition,\n transitionDuration: `${reducedMotion || !mounted ? 0 : progressTransitionDuration}ms`,\n },\n }}\n />\n )}\n </OptionalPortal>\n );\n}\n"],"names":["getDefaultZIndex","useMantineTheme","useReducedMotion","useState","useRef","useInterval","useDidUpdate","useNProgressEvents","React","OptionalPortal","Progress"],"mappings":";;;;;;;;;;;;;;AAKO,SAAS,SAAS,CAAC;AAC1B,EAAE,eAAe,GAAG,CAAC;AACrB,EAAE,KAAK,GAAG,MAAM;AAChB,EAAE,IAAI,GAAG,CAAC;AACV,EAAE,gBAAgB,GAAG,GAAG;AACxB,EAAE,kBAAkB,GAAG,MAAM;AAC7B,EAAE,0BAA0B,GAAG,GAAG;AAClC,EAAE,WAAW,GAAG,GAAG;AACnB,EAAE,sBAAsB,GAAG,GAAG;AAC9B,EAAE,cAAc,GAAG,MAAM;AACzB,EAAE,QAAQ;AACV,EAAE,SAAS,GAAG,KAAK;AACnB,EAAE,YAAY,GAAG,IAAI;AACrB,EAAE,MAAM,GAAGA,uBAAgB,CAAC,KAAK,CAAC;AAClC,CAAC,EAAE;AACH,EAAE,MAAM,KAAK,GAAGC,oBAAe,EAAE,CAAC;AAClC,EAAE,MAAM,kBAAkB,GAAGC,sBAAgB,EAAE,CAAC;AAChD,EAAE,MAAM,aAAa,GAAG,KAAK,CAAC,oBAAoB,GAAG,kBAAkB,GAAG,KAAK,CAAC;AAChF,EAAE,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,GAAGC,cAAQ,CAAC,eAAe,CAAC,CAAC;AAC7D,E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,wBAAwB,EAAE,cAAc;AAChD,QAAQ,kBAAkB,EAAE,CAAC,EAAE,aAAa,IAAI,SAAS,KAAK,GAAG,GAAG,CAAC,GAAG,sBAAsB,CAAC,EAAE,CAAC;AAClG,QAAQ,OAAO,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC;AAChC,OAAO;AACP,MAAM,GAAG,EAAE;AACX,QAAQ,kBAAkB,EAAE,OAAO;AACnC,QAAQ,wBAAwB,EAAE,kBAAkB;AACpD,QAAQ,kBAAkB,EAAE,CAAC,EAAE,aAAa,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,0BAA0B,CAAC,EAAE,CAAC;AAC7F,OAAO;AACP,KAAK;AACL,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var core = require('@mantine/core');
|
|
6
|
-
var hooks = require('@mantine/hooks');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var events = require('./events.js');
|
|
9
|
-
var getDefaultZIndex = require('../../mantine-styles/esm/theme/utils/get-default-z-index/get-default-z-index.js');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
12
|
-
|
|
13
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
-
|
|
15
|
-
function NavigationProgress({
|
|
16
|
-
initialProgress = 0,
|
|
17
|
-
color,
|
|
18
|
-
size = 3,
|
|
19
|
-
stepInterval = 500,
|
|
20
|
-
transitionDuration = 600,
|
|
21
|
-
exitTimeout = 700,
|
|
22
|
-
exitTransitionDuration = 600,
|
|
23
|
-
onFinish,
|
|
24
|
-
autoReset = false,
|
|
25
|
-
withinPortal = true,
|
|
26
|
-
zIndex = getDefaultZIndex.getDefaultZIndex("max")
|
|
27
|
-
}) {
|
|
28
|
-
const theme = core.useMantineTheme();
|
|
29
|
-
const shouldReduceMotion = hooks.useReducedMotion();
|
|
30
|
-
const reducedMotion = theme.respectReducedMotion ? shouldReduceMotion : false;
|
|
31
|
-
const [_progress, setProgress] = React.useState(initialProgress);
|
|
32
|
-
const [mounted, setMounted] = React.useState(true);
|
|
33
|
-
const [unmountProgress, setUnmountProgress] = React.useState(false);
|
|
34
|
-
const resetRef = React.useRef();
|
|
35
|
-
const unmountRef = React.useRef();
|
|
36
|
-
const interval = hooks.useInterval(() => {
|
|
37
|
-
setProgress((amount) => {
|
|
38
|
-
let next = 0;
|
|
39
|
-
if (amount >= 0 && amount <= 20) {
|
|
40
|
-
next = 10;
|
|
41
|
-
} else if (amount >= 20 && amount <= 50) {
|
|
42
|
-
next = 4;
|
|
43
|
-
} else if (amount >= 50 && amount <= 80) {
|
|
44
|
-
next = 2;
|
|
45
|
-
} else if (amount >= 80 && amount <= 99) {
|
|
46
|
-
next = 0.5;
|
|
47
|
-
}
|
|
48
|
-
return amount + next;
|
|
49
|
-
});
|
|
50
|
-
}, stepInterval);
|
|
51
|
-
const set = (value) => setProgress(value);
|
|
52
|
-
const increment = (value) => setProgress((c) => Math.min(c + value, 100));
|
|
53
|
-
const decrement = (value) => setProgress((c) => Math.max(c - value, 0));
|
|
54
|
-
const start = () => {
|
|
55
|
-
interval.stop();
|
|
56
|
-
interval.start();
|
|
57
|
-
};
|
|
58
|
-
const stop = () => interval.stop();
|
|
59
|
-
const reset = () => {
|
|
60
|
-
setUnmountProgress(true);
|
|
61
|
-
stop();
|
|
62
|
-
setProgress(0);
|
|
63
|
-
window.setTimeout(() => setUnmountProgress(false), 0);
|
|
64
|
-
};
|
|
65
|
-
const cancelUnmount = () => {
|
|
66
|
-
if (unmountRef.current) {
|
|
67
|
-
window.clearTimeout(unmountRef.current);
|
|
68
|
-
unmountRef.current = null;
|
|
69
|
-
}
|
|
70
|
-
if (resetRef.current) {
|
|
71
|
-
window.clearTimeout(resetRef.current);
|
|
72
|
-
resetRef.current = null;
|
|
73
|
-
}
|
|
74
|
-
setMounted(true);
|
|
75
|
-
};
|
|
76
|
-
hooks.useDidUpdate(() => {
|
|
77
|
-
if (_progress >= 100) {
|
|
78
|
-
stop();
|
|
79
|
-
onFinish == null ? void 0 : onFinish();
|
|
80
|
-
unmountRef.current = window.setTimeout(() => {
|
|
81
|
-
unmountRef.current = null;
|
|
82
|
-
setMounted(false);
|
|
83
|
-
if (autoReset) {
|
|
84
|
-
resetRef.current = window.setTimeout(() => {
|
|
85
|
-
resetRef.current = null;
|
|
86
|
-
reset();
|
|
87
|
-
}, reducedMotion ? 0 : exitTransitionDuration);
|
|
88
|
-
}
|
|
89
|
-
}, exitTimeout);
|
|
90
|
-
} else if (!mounted) {
|
|
91
|
-
cancelUnmount();
|
|
92
|
-
}
|
|
93
|
-
}, [_progress]);
|
|
94
|
-
events.useNavigationProgressEvents({ start, stop, set, increment, decrement, reset });
|
|
95
|
-
return /* @__PURE__ */ React__default.createElement(core.OptionalPortal, {
|
|
96
|
-
withinPortal
|
|
97
|
-
}, !unmountProgress && /* @__PURE__ */ React__default.createElement(core.Progress, {
|
|
98
|
-
radius: 0,
|
|
99
|
-
value: _progress,
|
|
100
|
-
size,
|
|
101
|
-
color,
|
|
102
|
-
styles: {
|
|
103
|
-
root: {
|
|
104
|
-
position: "fixed",
|
|
105
|
-
top: 0,
|
|
106
|
-
left: 0,
|
|
107
|
-
right: 0,
|
|
108
|
-
zIndex,
|
|
109
|
-
backgroundColor: "transparent",
|
|
110
|
-
transitionProperty: "opacity",
|
|
111
|
-
transitionTimingFunction: theme.transitionTimingFunction,
|
|
112
|
-
transitionDuration: `${reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration}ms`,
|
|
113
|
-
opacity: mounted ? 1 : 0
|
|
114
|
-
},
|
|
115
|
-
bar: {
|
|
116
|
-
position: "relative",
|
|
117
|
-
transitionProperty: "width",
|
|
118
|
-
transitionTimingFunction: theme.transitionTimingFunction,
|
|
119
|
-
transitionDuration: `${reducedMotion || !mounted ? 0 : transitionDuration}ms`
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
exports.NavigationProgress = NavigationProgress;
|
|
126
|
-
//# sourceMappingURL=NavigationProgress.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationProgress.js","sources":["../../../src/NavigationProgress.tsx"],"sourcesContent":["import { OptionalPortal, Progress, useMantineTheme } from '@mantine/core';\nimport { useDidUpdate, useInterval, useReducedMotion } from '@mantine/hooks';\nimport { getDefaultZIndex, MantineColor } from '@mantine/styles';\nimport React, { useRef, useState } from 'react';\nimport { useNavigationProgressEvents } from './events';\n\nexport interface NavigationProgressProps {\n /** The default progress */\n initialProgress?: number;\n\n /** Key of theme.colors of any other valid CSS color */\n color?: MantineColor;\n\n /** The height of the progressbar in px */\n size?: number;\n\n /** Called when the progressbar reaches 100% */\n onFinish?(): void;\n\n /** Determines whether progress should be automatically reset when 100% is reached */\n autoReset?: boolean;\n\n /** Step interval in ms */\n stepInterval?: number;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Number of ms that should elapse before progressbar is hidden after reaching 100% */\n exitTimeout?: number;\n\n /** Exit transition duration in ms */\n exitTransitionDuration?: number;\n\n /** Determines whether progressbar should be rendered within Portal, defaults to true */\n withinPortal?: boolean;\n\n /** Progressbar z-index */\n zIndex?: React.CSSProperties['zIndex'];\n}\n\nexport function NavigationProgress({\n initialProgress = 0,\n color,\n size = 3,\n stepInterval = 500,\n transitionDuration = 600,\n exitTimeout = 700,\n exitTransitionDuration = 600,\n onFinish,\n autoReset = false,\n withinPortal = true,\n zIndex = getDefaultZIndex('max'),\n}: NavigationProgressProps) {\n const theme = useMantineTheme();\n const shouldReduceMotion = useReducedMotion();\n const reducedMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const [_progress, setProgress] = useState(initialProgress);\n const [mounted, setMounted] = useState(true);\n const [unmountProgress, setUnmountProgress] = useState(false);\n const resetRef = useRef<number>();\n const unmountRef = useRef<number>();\n\n const interval = useInterval(() => {\n setProgress((amount) => {\n let next = 0;\n if (amount >= 0 && amount <= 20) {\n next = 10;\n } else if (amount >= 20 && amount <= 50) {\n next = 4;\n } else if (amount >= 50 && amount <= 80) {\n next = 2;\n } else if (amount >= 80 && amount <= 99) {\n next = 0.5;\n }\n\n return amount + next;\n });\n }, stepInterval);\n\n const set = (value: React.SetStateAction<number>) => setProgress(value);\n const increment = (value: number) => setProgress((c) => Math.min(c + value, 100));\n const decrement = (value: number) => setProgress((c) => Math.max(c - value, 0));\n const start = () => {\n interval.stop();\n interval.start();\n };\n const stop = () => interval.stop();\n const reset = () => {\n setUnmountProgress(true);\n stop();\n setProgress(0);\n window.setTimeout(() => setUnmountProgress(false), 0);\n };\n\n const cancelUnmount = () => {\n if (unmountRef.current) {\n window.clearTimeout(unmountRef.current);\n unmountRef.current = null;\n }\n if (resetRef.current) {\n window.clearTimeout(resetRef.current);\n resetRef.current = null;\n }\n\n setMounted(true);\n };\n\n useDidUpdate(() => {\n if (_progress >= 100) {\n stop();\n onFinish?.();\n\n unmountRef.current = window.setTimeout(() => {\n unmountRef.current = null;\n setMounted(false);\n\n if (autoReset) {\n resetRef.current = window.setTimeout(\n () => {\n resetRef.current = null;\n reset();\n },\n reducedMotion ? 0 : exitTransitionDuration\n );\n }\n }, exitTimeout);\n } else if (!mounted) {\n cancelUnmount();\n }\n }, [_progress]);\n\n useNavigationProgressEvents({ start, stop, set, increment, decrement, reset });\n\n return (\n <OptionalPortal withinPortal={withinPortal}>\n {!unmountProgress && (\n <Progress\n radius={0}\n value={_progress}\n size={size}\n color={color}\n styles={{\n root: {\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n zIndex,\n backgroundColor: 'transparent',\n transitionProperty: 'opacity',\n transitionTimingFunction: theme.transitionTimingFunction,\n transitionDuration: `${\n reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration\n }ms`,\n opacity: mounted ? 1 : 0,\n },\n bar: {\n position: 'relative',\n transitionProperty: 'width',\n transitionTimingFunction: theme.transitionTimingFunction,\n transitionDuration: `${reducedMotion || !mounted ? 0 : transitionDuration}ms`,\n },\n }}\n />\n )}\n </OptionalPortal>\n );\n}\n"],"names":["getDefaultZIndex","useMantineTheme","useReducedMotion","useState","useRef","useInterval","useDidUpdate","useNavigationProgressEvents","React","OptionalPortal","Progress"],"mappings":";;;;;;;;;;;;;;AAKO,SAAS,kBAAkB,CAAC;AACnC,EAAE,eAAe,GAAG,CAAC;AACrB,EAAE,KAAK;AACP,EAAE,IAAI,GAAG,CAAC;AACV,EAAE,YAAY,GAAG,GAAG;AACpB,EAAE,kBAAkB,GAAG,GAAG;AAC1B,EAAE,WAAW,GAAG,GAAG;AACnB,EAAE,sBAAsB,GAAG,GAAG;AAC9B,EAAE,QAAQ;AACV,EAAE,SAAS,GAAG,KAAK;AACnB,EAAE,YAAY,GAAG,IAAI;AACrB,EAAE,MAAM,GAAGA,iCAAgB,CAAC,KAAK,CAAC;AAClC,CAAC,EAAE;AACH,EAAE,MAAM,KAAK,GAAGC,oBAAe,EAAE,CAAC;AAClC,EAAE,MAAM,kBAAkB,GAAGC,sBAAgB,EAAE,CAAC;AAChD,EAAE,MAAM,aAAa,GAAG,KAAK,CAAC,oBAAoB,GAAG,kBAAkB,GAAG,KAAK,CAAC;AAChF,EAAE,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,GAAGC,cAAQ,CAAC,eAAe,CAAC,CAAC;AAC7D,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGA,cAAQ,CAAC,IAAI,CAAC,CAAC;AAC/C,EAAE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC,CAAC;AAChE,EAAE,MAAM,QAAQ,GAAGC,YAAM,EAAE,CAAC;AAC5B,EAAE,MAAM,UAAU,GAAGA,YAAM,EAAE,CAA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,wBAAwB,EAAE,KAAK,CAAC,wBAAwB;AAChE,QAAQ,kBAAkB,EAAE,CAAC,EAAE,aAAa,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,kBAAkB,CAAC,EAAE,CAAC;AACrF,OAAO;AACP,KAAK;AACL,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var utils = require('@mantine/utils');
|
|
6
|
-
|
|
7
|
-
const [useNavigationProgressEvents, createEvent] = utils.createUseExternalEvents("mantine-nprogress");
|
|
8
|
-
const startNavigationProgress = createEvent("start");
|
|
9
|
-
const stopNavigationProgress = createEvent("stop");
|
|
10
|
-
const resetNavigationProgress = createEvent("reset");
|
|
11
|
-
const setNavigationProgress = createEvent("set");
|
|
12
|
-
const incrementNavigationProgress = createEvent("increment");
|
|
13
|
-
const decrementNavigationProgress = createEvent("decrement");
|
|
14
|
-
|
|
15
|
-
exports.createEvent = createEvent;
|
|
16
|
-
exports.decrementNavigationProgress = decrementNavigationProgress;
|
|
17
|
-
exports.incrementNavigationProgress = incrementNavigationProgress;
|
|
18
|
-
exports.resetNavigationProgress = resetNavigationProgress;
|
|
19
|
-
exports.setNavigationProgress = setNavigationProgress;
|
|
20
|
-
exports.startNavigationProgress = startNavigationProgress;
|
|
21
|
-
exports.stopNavigationProgress = stopNavigationProgress;
|
|
22
|
-
exports.useNavigationProgressEvents = useNavigationProgressEvents;
|
|
23
|
-
//# sourceMappingURL=events.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sources":["../../../src/events.ts"],"sourcesContent":["import { createUseExternalEvents } from '@mantine/utils';\n\nexport type NavigationProgressEvents = {\n start(): void;\n stop(): void;\n set(progress: number): void;\n increment(progress: number): void;\n decrement(progress: number): void;\n reset(): void;\n};\n\nexport const [useNavigationProgressEvents, createEvent] =\n createUseExternalEvents<NavigationProgressEvents>('mantine-nprogress');\n\nexport const NPROGRESS_EVENTS = {\n add: 'mantine:add-nprogress',\n decrease: 'mantine:decrease-nprogress',\n set: 'mantine:set-nprogress',\n start: 'mantine:start-nprogress',\n stop: 'mantine:stop-nprogress',\n reset: 'mantine:reset-nprogress',\n} as const;\n\nexport const startNavigationProgress = createEvent('start');\nexport const stopNavigationProgress = createEvent('stop');\nexport const resetNavigationProgress = createEvent('reset');\nexport const setNavigationProgress = createEvent('set');\nexport const incrementNavigationProgress = createEvent('increment');\nexport const decrementNavigationProgress = createEvent('decrement');\n"],"names":["createUseExternalEvents"],"mappings":";;;;;;AACY,MAAC,CAAC,2BAA2B,EAAE,WAAW,CAAC,GAAGA,6BAAuB,CAAC,mBAAmB,EAAE;AAS3F,MAAC,uBAAuB,GAAG,WAAW,CAAC,OAAO,EAAE;AAChD,MAAC,sBAAsB,GAAG,WAAW,CAAC,MAAM,EAAE;AAC9C,MAAC,uBAAuB,GAAG,WAAW,CAAC,OAAO,EAAE;AAChD,MAAC,qBAAqB,GAAG,WAAW,CAAC,KAAK,EAAE;AAC5C,MAAC,2BAA2B,GAAG,WAAW,CAAC,WAAW,EAAE;AACxD,MAAC,2BAA2B,GAAG,WAAW,CAAC,WAAW;;;;;;;;;;;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var NavigationProgress = require('./NavigationProgress.js');
|
|
6
|
-
var events = require('./events.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.NavigationProgress = NavigationProgress.NavigationProgress;
|
|
11
|
-
exports.decrementNavigationProgress = events.decrementNavigationProgress;
|
|
12
|
-
exports.incrementNavigationProgress = events.incrementNavigationProgress;
|
|
13
|
-
exports.resetNavigationProgress = events.resetNavigationProgress;
|
|
14
|
-
exports.setNavigationProgress = events.setNavigationProgress;
|
|
15
|
-
exports.startNavigationProgress = events.startNavigationProgress;
|
|
16
|
-
exports.stopNavigationProgress = events.stopNavigationProgress;
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const elevations = {
|
|
6
|
-
app: 100,
|
|
7
|
-
modal: 200,
|
|
8
|
-
popover: 300,
|
|
9
|
-
overlay: 400,
|
|
10
|
-
max: 9999
|
|
11
|
-
};
|
|
12
|
-
function getDefaultZIndex(level) {
|
|
13
|
-
return elevations[level];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
exports.getDefaultZIndex = getDefaultZIndex;
|
|
17
|
-
//# sourceMappingURL=get-default-z-index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-z-index.js","sources":["../../../../../../../mantine-styles/esm/theme/utils/get-default-z-index/get-default-z-index.js"],"sourcesContent":["const elevations = {\n app: 100,\n modal: 200,\n popover: 300,\n overlay: 400,\n max: 9999\n};\nfunction getDefaultZIndex(level) {\n return elevations[level];\n}\n\nexport { getDefaultZIndex };\n//# sourceMappingURL=get-default-z-index.js.map\n"],"names":[],"mappings":";;;;AAAA,MAAM,UAAU,GAAG;AACnB,EAAE,GAAG,EAAE,GAAG;AACV,EAAE,KAAK,EAAE,GAAG;AACZ,EAAE,OAAO,EAAE,GAAG;AACd,EAAE,OAAO,EAAE,GAAG;AACd,EAAE,GAAG,EAAE,IAAI;AACX,CAAC,CAAC;AACF,SAAS,gBAAgB,CAAC,KAAK,EAAE;AACjC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B;;;;"}
|
package/esm/NProgress.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { useMantineTheme, OptionalPortal, Progress } from '@mantine/core';
|
|
2
|
-
import { useReducedMotion, useInterval, useDidUpdate } from '@mantine/hooks';
|
|
3
|
-
import { getDefaultZIndex } from '@mantine/styles';
|
|
4
|
-
import React, { useState, useRef } from 'react';
|
|
5
|
-
import { useNProgressEvents } from './events.js';
|
|
6
|
-
|
|
7
|
-
function NProgress({
|
|
8
|
-
defaultProgress = 0,
|
|
9
|
-
color = "blue",
|
|
10
|
-
size = 2,
|
|
11
|
-
stepIntervalTime = 500,
|
|
12
|
-
progressTransition = "ease",
|
|
13
|
-
progressTransitionDuration = 600,
|
|
14
|
-
exitTimeout = 700,
|
|
15
|
-
exitTransitionDuration = 600,
|
|
16
|
-
exitTransition = "ease",
|
|
17
|
-
onFinish,
|
|
18
|
-
autoReset = false,
|
|
19
|
-
withinPortal = true,
|
|
20
|
-
zIndex = getDefaultZIndex("max")
|
|
21
|
-
}) {
|
|
22
|
-
const theme = useMantineTheme();
|
|
23
|
-
const shouldReduceMotion = useReducedMotion();
|
|
24
|
-
const reducedMotion = theme.respectReducedMotion ? shouldReduceMotion : false;
|
|
25
|
-
const [_progress, setProgress] = useState(defaultProgress);
|
|
26
|
-
const [mounted, setMounted] = useState(true);
|
|
27
|
-
const [unmountProgress, setUnmountProgress] = useState(false);
|
|
28
|
-
const resetRef = useRef();
|
|
29
|
-
const unmountRef = useRef();
|
|
30
|
-
const interval = useInterval(() => {
|
|
31
|
-
setProgress((amount) => {
|
|
32
|
-
let next = 0;
|
|
33
|
-
if (amount >= 0 && amount <= 20) {
|
|
34
|
-
next = 10;
|
|
35
|
-
} else if (amount >= 20 && amount <= 50) {
|
|
36
|
-
next = 4;
|
|
37
|
-
} else if (amount >= 50 && amount <= 80) {
|
|
38
|
-
next = 2;
|
|
39
|
-
} else if (amount >= 80 && amount <= 99) {
|
|
40
|
-
next = 0.5;
|
|
41
|
-
}
|
|
42
|
-
return amount + next;
|
|
43
|
-
});
|
|
44
|
-
}, stepIntervalTime);
|
|
45
|
-
const set = (value) => setProgress(value);
|
|
46
|
-
const add = (value) => setProgress((c) => Math.min(c + value, 100));
|
|
47
|
-
const decrease = (value) => setProgress((c) => Math.max(c - value, 0));
|
|
48
|
-
const start = () => {
|
|
49
|
-
interval.stop();
|
|
50
|
-
interval.start();
|
|
51
|
-
};
|
|
52
|
-
const stop = () => interval.stop();
|
|
53
|
-
const reset = () => {
|
|
54
|
-
setUnmountProgress(true);
|
|
55
|
-
stop();
|
|
56
|
-
setProgress(0);
|
|
57
|
-
window.setTimeout(() => setUnmountProgress(false), 0);
|
|
58
|
-
};
|
|
59
|
-
const ctx = {
|
|
60
|
-
set,
|
|
61
|
-
add,
|
|
62
|
-
decrease,
|
|
63
|
-
start,
|
|
64
|
-
stop,
|
|
65
|
-
reset
|
|
66
|
-
};
|
|
67
|
-
const cancelUnmount = () => {
|
|
68
|
-
if (unmountRef.current) {
|
|
69
|
-
window.clearTimeout(unmountRef.current);
|
|
70
|
-
unmountRef.current = null;
|
|
71
|
-
}
|
|
72
|
-
if (resetRef.current) {
|
|
73
|
-
window.clearTimeout(resetRef.current);
|
|
74
|
-
resetRef.current = null;
|
|
75
|
-
}
|
|
76
|
-
setMounted(true);
|
|
77
|
-
};
|
|
78
|
-
useDidUpdate(() => {
|
|
79
|
-
if (_progress >= 100) {
|
|
80
|
-
stop();
|
|
81
|
-
onFinish && onFinish();
|
|
82
|
-
unmountRef.current = window.setTimeout(() => {
|
|
83
|
-
unmountRef.current = null;
|
|
84
|
-
setMounted(false);
|
|
85
|
-
if (autoReset) {
|
|
86
|
-
resetRef.current = window.setTimeout(() => {
|
|
87
|
-
resetRef.current = null;
|
|
88
|
-
reset();
|
|
89
|
-
}, reducedMotion ? 0 : exitTransitionDuration);
|
|
90
|
-
}
|
|
91
|
-
}, exitTimeout);
|
|
92
|
-
} else if (!mounted) {
|
|
93
|
-
cancelUnmount();
|
|
94
|
-
}
|
|
95
|
-
}, [_progress]);
|
|
96
|
-
useNProgressEvents(ctx);
|
|
97
|
-
return /* @__PURE__ */ React.createElement(OptionalPortal, {
|
|
98
|
-
withinPortal
|
|
99
|
-
}, !unmountProgress && /* @__PURE__ */ React.createElement(Progress, {
|
|
100
|
-
radius: 0,
|
|
101
|
-
value: _progress,
|
|
102
|
-
size,
|
|
103
|
-
color,
|
|
104
|
-
styles: {
|
|
105
|
-
root: {
|
|
106
|
-
top: 0,
|
|
107
|
-
left: 0,
|
|
108
|
-
position: "fixed",
|
|
109
|
-
zIndex,
|
|
110
|
-
width: "100vw",
|
|
111
|
-
backgroundColor: "transparent",
|
|
112
|
-
transitionProperty: "opacity",
|
|
113
|
-
transitionTimingFunction: exitTransition,
|
|
114
|
-
transitionDuration: `${reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration}ms`,
|
|
115
|
-
opacity: mounted ? 1 : 0
|
|
116
|
-
},
|
|
117
|
-
bar: {
|
|
118
|
-
transitionProperty: "width",
|
|
119
|
-
transitionTimingFunction: progressTransition,
|
|
120
|
-
transitionDuration: `${reducedMotion || !mounted ? 0 : progressTransitionDuration}ms`
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export { NProgress };
|
|
127
|
-
//# sourceMappingURL=NProgress.js.map
|
package/esm/NProgress.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NProgress.js","sources":["../src/NProgress.tsx"],"sourcesContent":["import { OptionalPortal, Progress, useMantineTheme } from '@mantine/core';\nimport { useDidUpdate, useInterval, useReducedMotion } from '@mantine/hooks';\nimport { getDefaultZIndex, MantineColor } from '@mantine/styles';\nimport React, { useRef, useState } from 'react';\nimport { useNProgressEvents } from './events';\n\nexport interface NProgressProps {\n /** The default progress */\n defaultProgress?: number;\n\n /** The color of the progressbar */\n color?: MantineColor;\n\n /** The height of the progressbar */\n size?: number;\n\n /** Called when the progress is 100% */\n onFinish?: () => void;\n\n /** Automatically resets the progress when 100% is reached */\n autoReset?: boolean;\n\n /** Step delay in ms */\n stepIntervalTime?: number;\n\n /** Transition function (transition-timing-function) */\n progressTransition?: string;\n\n /** Transition duration in ms */\n progressTransitionDuration?: number;\n\n /** The time when the component should be unmounted after progress is 100% */\n exitTimeout?: number;\n\n /** Exit transition duration in ms */\n exitTransitionDuration?: number;\n\n /** Exit transition function (transition-timing-function)*/\n exitTransition?: string;\n\n /** Determines whether NProgress should be rendered within Portal, defaults to true */\n withinPortal?: boolean;\n\n /** NProgress container z-index */\n zIndex?: React.CSSProperties['zIndex'];\n}\n\nexport function NProgress({\n defaultProgress = 0,\n color = 'blue',\n size = 2,\n stepIntervalTime = 500,\n progressTransition = 'ease',\n progressTransitionDuration = 600,\n exitTimeout = 700,\n exitTransitionDuration = 600,\n exitTransition = 'ease',\n onFinish,\n autoReset = false,\n withinPortal = true,\n zIndex = getDefaultZIndex('max'),\n}: NProgressProps) {\n const theme = useMantineTheme();\n const shouldReduceMotion = useReducedMotion();\n const reducedMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const [_progress, setProgress] = useState(defaultProgress);\n const [mounted, setMounted] = useState(true);\n const [unmountProgress, setUnmountProgress] = useState(false);\n const resetRef = useRef<number>();\n const unmountRef = useRef<number>();\n\n const interval = useInterval(() => {\n setProgress((amount) => {\n let next = 0;\n if (amount >= 0 && amount <= 20) {\n next = 10;\n } else if (amount >= 20 && amount <= 50) {\n next = 4;\n } else if (amount >= 50 && amount <= 80) {\n next = 2;\n } else if (amount >= 80 && amount <= 99) {\n next = 0.5;\n }\n\n return amount + next;\n });\n }, stepIntervalTime);\n\n const set = (value: React.SetStateAction<number>) => setProgress(value);\n const add = (value: number) => setProgress((c) => Math.min(c + value, 100));\n const decrease = (value: number) => setProgress((c) => Math.max(c - value, 0));\n const start = () => {\n interval.stop();\n interval.start();\n };\n const stop = () => interval.stop();\n const reset = () => {\n setUnmountProgress(true);\n stop();\n setProgress(0);\n window.setTimeout(() => setUnmountProgress(false), 0);\n };\n\n const ctx = {\n set,\n add,\n decrease,\n start,\n stop,\n reset,\n };\n\n const cancelUnmount = () => {\n if (unmountRef.current) {\n window.clearTimeout(unmountRef.current);\n unmountRef.current = null;\n }\n if (resetRef.current) {\n window.clearTimeout(resetRef.current);\n resetRef.current = null;\n }\n\n setMounted(true);\n };\n\n useDidUpdate(() => {\n if (_progress >= 100) {\n stop();\n onFinish && onFinish();\n unmountRef.current = window.setTimeout(() => {\n unmountRef.current = null;\n setMounted(false);\n\n if (autoReset) {\n resetRef.current = window.setTimeout(\n () => {\n resetRef.current = null;\n reset();\n },\n reducedMotion ? 0 : exitTransitionDuration\n );\n }\n }, exitTimeout);\n } else if (!mounted) {\n cancelUnmount();\n }\n }, [_progress]);\n\n useNProgressEvents(ctx);\n\n return (\n <OptionalPortal withinPortal={withinPortal}>\n {!unmountProgress && (\n <Progress\n radius={0}\n value={_progress}\n size={size}\n color={color}\n styles={{\n root: {\n top: 0,\n left: 0,\n position: 'fixed',\n zIndex,\n width: '100vw',\n backgroundColor: 'transparent',\n transitionProperty: 'opacity',\n transitionTimingFunction: exitTransition,\n transitionDuration: `${\n reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration\n }ms`,\n opacity: mounted ? 1 : 0,\n },\n bar: {\n transitionProperty: 'width',\n transitionTimingFunction: progressTransition,\n transitionDuration: `${reducedMotion || !mounted ? 0 : progressTransitionDuration}ms`,\n },\n }}\n />\n )}\n </OptionalPortal>\n );\n}\n"],"names":[],"mappings":";;;;;;AAKO,SAAS,SAAS,CAAC;AAC1B,EAAE,eAAe,GAAG,CAAC;AACrB,EAAE,KAAK,GAAG,MAAM;AAChB,EAAE,IAAI,GAAG,CAAC;AACV,EAAE,gBAAgB,GAAG,GAAG;AACxB,EAAE,kBAAkB,GAAG,MAAM;AAC7B,EAAE,0BAA0B,GAAG,GAAG;AAClC,EAAE,WAAW,GAAG,GAAG;AACnB,EAAE,sBAAsB,GAAG,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IAAI,YAAY;AAChB,GAAG,EAAE,CAAC,eAAe,oBAAoB,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE;AACvE,IAAI,MAAM,EAAE,CAAC;AACb,IAAI,KAAK,EAAE,SAAS;AACpB,IAAI,IAAI;AACR,IAAI,KAAK;AACT,IAAI,MAAM,EAAE;AACZ,MAAM,IAAI,EAAE;AACZ,QAAQ,GAAG,EAAE,CAAC;AACd,QAAQ,IAAI,EAAE,CAAC;AACf,QAAQ,QAAQ,EAAE,OAAO;AACzB,QAAQ,MAAM;AACd,QAAQ,KAAK,EAAE,OAAO;AACtB,QAAQ,eAAe,EAAE,aAAa;AACtC,QAAQ,kBAAkB,EAAE,SAAS;AACrC,QAAQ,wBAAwB,EAAE,cAAc;AAChD,QAAQ,kBAAkB,EAAE,CAAC,EAAE,aAAa,IAAI,SAAS,KAAK,GAAG,GAAG,CAAC,GAAG,sBAAsB,CAAC,EAAE,CAAC;AAClG,QAAQ,OAAO,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC;AAChC,OAAO;AACP,MAAM,GAAG,EAAE;AACX,QAAQ,kBAAkB,EAAE,OAAO;AACnC,QAAQ,wBAAwB,EAAE,kBAAkB;AACpD,QAAQ,kBAAkB,EAAE,CAAC,EAAE,aAAa,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,0BAA0B,CAAC,EAAE,CAAC;AAC7F,OAAO;AACP,KAAK;AACL,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { useMantineTheme, OptionalPortal, Progress } from '@mantine/core';
|
|
2
|
-
import { useReducedMotion, useInterval, useDidUpdate } from '@mantine/hooks';
|
|
3
|
-
import React, { useState, useRef } from 'react';
|
|
4
|
-
import { useNavigationProgressEvents } from './events.js';
|
|
5
|
-
import { getDefaultZIndex } from '../../mantine-styles/esm/theme/utils/get-default-z-index/get-default-z-index.js';
|
|
6
|
-
|
|
7
|
-
function NavigationProgress({
|
|
8
|
-
initialProgress = 0,
|
|
9
|
-
color,
|
|
10
|
-
size = 3,
|
|
11
|
-
stepInterval = 500,
|
|
12
|
-
transitionDuration = 600,
|
|
13
|
-
exitTimeout = 700,
|
|
14
|
-
exitTransitionDuration = 600,
|
|
15
|
-
onFinish,
|
|
16
|
-
autoReset = false,
|
|
17
|
-
withinPortal = true,
|
|
18
|
-
zIndex = getDefaultZIndex("max")
|
|
19
|
-
}) {
|
|
20
|
-
const theme = useMantineTheme();
|
|
21
|
-
const shouldReduceMotion = useReducedMotion();
|
|
22
|
-
const reducedMotion = theme.respectReducedMotion ? shouldReduceMotion : false;
|
|
23
|
-
const [_progress, setProgress] = useState(initialProgress);
|
|
24
|
-
const [mounted, setMounted] = useState(true);
|
|
25
|
-
const [unmountProgress, setUnmountProgress] = useState(false);
|
|
26
|
-
const resetRef = useRef();
|
|
27
|
-
const unmountRef = useRef();
|
|
28
|
-
const interval = useInterval(() => {
|
|
29
|
-
setProgress((amount) => {
|
|
30
|
-
let next = 0;
|
|
31
|
-
if (amount >= 0 && amount <= 20) {
|
|
32
|
-
next = 10;
|
|
33
|
-
} else if (amount >= 20 && amount <= 50) {
|
|
34
|
-
next = 4;
|
|
35
|
-
} else if (amount >= 50 && amount <= 80) {
|
|
36
|
-
next = 2;
|
|
37
|
-
} else if (amount >= 80 && amount <= 99) {
|
|
38
|
-
next = 0.5;
|
|
39
|
-
}
|
|
40
|
-
return amount + next;
|
|
41
|
-
});
|
|
42
|
-
}, stepInterval);
|
|
43
|
-
const set = (value) => setProgress(value);
|
|
44
|
-
const increment = (value) => setProgress((c) => Math.min(c + value, 100));
|
|
45
|
-
const decrement = (value) => setProgress((c) => Math.max(c - value, 0));
|
|
46
|
-
const start = () => {
|
|
47
|
-
interval.stop();
|
|
48
|
-
interval.start();
|
|
49
|
-
};
|
|
50
|
-
const stop = () => interval.stop();
|
|
51
|
-
const reset = () => {
|
|
52
|
-
setUnmountProgress(true);
|
|
53
|
-
stop();
|
|
54
|
-
setProgress(0);
|
|
55
|
-
window.setTimeout(() => setUnmountProgress(false), 0);
|
|
56
|
-
};
|
|
57
|
-
const cancelUnmount = () => {
|
|
58
|
-
if (unmountRef.current) {
|
|
59
|
-
window.clearTimeout(unmountRef.current);
|
|
60
|
-
unmountRef.current = null;
|
|
61
|
-
}
|
|
62
|
-
if (resetRef.current) {
|
|
63
|
-
window.clearTimeout(resetRef.current);
|
|
64
|
-
resetRef.current = null;
|
|
65
|
-
}
|
|
66
|
-
setMounted(true);
|
|
67
|
-
};
|
|
68
|
-
useDidUpdate(() => {
|
|
69
|
-
if (_progress >= 100) {
|
|
70
|
-
stop();
|
|
71
|
-
onFinish == null ? void 0 : onFinish();
|
|
72
|
-
unmountRef.current = window.setTimeout(() => {
|
|
73
|
-
unmountRef.current = null;
|
|
74
|
-
setMounted(false);
|
|
75
|
-
if (autoReset) {
|
|
76
|
-
resetRef.current = window.setTimeout(() => {
|
|
77
|
-
resetRef.current = null;
|
|
78
|
-
reset();
|
|
79
|
-
}, reducedMotion ? 0 : exitTransitionDuration);
|
|
80
|
-
}
|
|
81
|
-
}, exitTimeout);
|
|
82
|
-
} else if (!mounted) {
|
|
83
|
-
cancelUnmount();
|
|
84
|
-
}
|
|
85
|
-
}, [_progress]);
|
|
86
|
-
useNavigationProgressEvents({ start, stop, set, increment, decrement, reset });
|
|
87
|
-
return /* @__PURE__ */ React.createElement(OptionalPortal, {
|
|
88
|
-
withinPortal
|
|
89
|
-
}, !unmountProgress && /* @__PURE__ */ React.createElement(Progress, {
|
|
90
|
-
radius: 0,
|
|
91
|
-
value: _progress,
|
|
92
|
-
size,
|
|
93
|
-
color,
|
|
94
|
-
styles: {
|
|
95
|
-
root: {
|
|
96
|
-
position: "fixed",
|
|
97
|
-
top: 0,
|
|
98
|
-
left: 0,
|
|
99
|
-
right: 0,
|
|
100
|
-
zIndex,
|
|
101
|
-
backgroundColor: "transparent",
|
|
102
|
-
transitionProperty: "opacity",
|
|
103
|
-
transitionTimingFunction: theme.transitionTimingFunction,
|
|
104
|
-
transitionDuration: `${reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration}ms`,
|
|
105
|
-
opacity: mounted ? 1 : 0
|
|
106
|
-
},
|
|
107
|
-
bar: {
|
|
108
|
-
position: "relative",
|
|
109
|
-
transitionProperty: "width",
|
|
110
|
-
transitionTimingFunction: theme.transitionTimingFunction,
|
|
111
|
-
transitionDuration: `${reducedMotion || !mounted ? 0 : transitionDuration}ms`
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export { NavigationProgress };
|
|
118
|
-
//# sourceMappingURL=NavigationProgress.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationProgress.js","sources":["../../../src/NavigationProgress.tsx"],"sourcesContent":["import { OptionalPortal, Progress, useMantineTheme } from '@mantine/core';\nimport { useDidUpdate, useInterval, useReducedMotion } from '@mantine/hooks';\nimport { getDefaultZIndex, MantineColor } from '@mantine/styles';\nimport React, { useRef, useState } from 'react';\nimport { useNavigationProgressEvents } from './events';\n\nexport interface NavigationProgressProps {\n /** The default progress */\n initialProgress?: number;\n\n /** Key of theme.colors of any other valid CSS color */\n color?: MantineColor;\n\n /** The height of the progressbar in px */\n size?: number;\n\n /** Called when the progressbar reaches 100% */\n onFinish?(): void;\n\n /** Determines whether progress should be automatically reset when 100% is reached */\n autoReset?: boolean;\n\n /** Step interval in ms */\n stepInterval?: number;\n\n /** Transition duration in ms */\n transitionDuration?: number;\n\n /** Number of ms that should elapse before progressbar is hidden after reaching 100% */\n exitTimeout?: number;\n\n /** Exit transition duration in ms */\n exitTransitionDuration?: number;\n\n /** Determines whether progressbar should be rendered within Portal, defaults to true */\n withinPortal?: boolean;\n\n /** Progressbar z-index */\n zIndex?: React.CSSProperties['zIndex'];\n}\n\nexport function NavigationProgress({\n initialProgress = 0,\n color,\n size = 3,\n stepInterval = 500,\n transitionDuration = 600,\n exitTimeout = 700,\n exitTransitionDuration = 600,\n onFinish,\n autoReset = false,\n withinPortal = true,\n zIndex = getDefaultZIndex('max'),\n}: NavigationProgressProps) {\n const theme = useMantineTheme();\n const shouldReduceMotion = useReducedMotion();\n const reducedMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const [_progress, setProgress] = useState(initialProgress);\n const [mounted, setMounted] = useState(true);\n const [unmountProgress, setUnmountProgress] = useState(false);\n const resetRef = useRef<number>();\n const unmountRef = useRef<number>();\n\n const interval = useInterval(() => {\n setProgress((amount) => {\n let next = 0;\n if (amount >= 0 && amount <= 20) {\n next = 10;\n } else if (amount >= 20 && amount <= 50) {\n next = 4;\n } else if (amount >= 50 && amount <= 80) {\n next = 2;\n } else if (amount >= 80 && amount <= 99) {\n next = 0.5;\n }\n\n return amount + next;\n });\n }, stepInterval);\n\n const set = (value: React.SetStateAction<number>) => setProgress(value);\n const increment = (value: number) => setProgress((c) => Math.min(c + value, 100));\n const decrement = (value: number) => setProgress((c) => Math.max(c - value, 0));\n const start = () => {\n interval.stop();\n interval.start();\n };\n const stop = () => interval.stop();\n const reset = () => {\n setUnmountProgress(true);\n stop();\n setProgress(0);\n window.setTimeout(() => setUnmountProgress(false), 0);\n };\n\n const cancelUnmount = () => {\n if (unmountRef.current) {\n window.clearTimeout(unmountRef.current);\n unmountRef.current = null;\n }\n if (resetRef.current) {\n window.clearTimeout(resetRef.current);\n resetRef.current = null;\n }\n\n setMounted(true);\n };\n\n useDidUpdate(() => {\n if (_progress >= 100) {\n stop();\n onFinish?.();\n\n unmountRef.current = window.setTimeout(() => {\n unmountRef.current = null;\n setMounted(false);\n\n if (autoReset) {\n resetRef.current = window.setTimeout(\n () => {\n resetRef.current = null;\n reset();\n },\n reducedMotion ? 0 : exitTransitionDuration\n );\n }\n }, exitTimeout);\n } else if (!mounted) {\n cancelUnmount();\n }\n }, [_progress]);\n\n useNavigationProgressEvents({ start, stop, set, increment, decrement, reset });\n\n return (\n <OptionalPortal withinPortal={withinPortal}>\n {!unmountProgress && (\n <Progress\n radius={0}\n value={_progress}\n size={size}\n color={color}\n styles={{\n root: {\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n zIndex,\n backgroundColor: 'transparent',\n transitionProperty: 'opacity',\n transitionTimingFunction: theme.transitionTimingFunction,\n transitionDuration: `${\n reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration\n }ms`,\n opacity: mounted ? 1 : 0,\n },\n bar: {\n position: 'relative',\n transitionProperty: 'width',\n transitionTimingFunction: theme.transitionTimingFunction,\n transitionDuration: `${reducedMotion || !mounted ? 0 : transitionDuration}ms`,\n },\n }}\n />\n )}\n </OptionalPortal>\n );\n}\n"],"names":[],"mappings":";;;;;;AAKO,SAAS,kBAAkB,CAAC;AACnC,EAAE,eAAe,GAAG,CAAC;AACrB,EAAE,KAAK;AACP,EAAE,IAAI,GAAG,CAAC;AACV,EAAE,YAAY,GAAG,GAAG;AACpB,EAAE,kBAAkB,GAAG,GAAG;AAC1B,EAAE,WAAW,GAAG,GAAG;AACnB,EAAE,sBAAsB,GAAG,GAAG;AAC9B,EAAE,QAAQ;AACV,EAAE,SAAS,GAAG,KAAK;AACnB,EAAE,YAAY,GAAG,IAAI;AACrB,EAAE,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC;AAClC,CAAC,EAAE;AACH,EAAE,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;AAClC,EAAE,MAAM,kBAAkB,GAAG,gBAAgB,EAAE,CAAC;AAChD,EAAE,MAAM,aAAa,GAAG,KAAK,CAAC,oBAAoB,GAAG,kBAAkB,GAAG,KAAK,CAAC;AAChF,EAAE,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAC7D,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC/C,EAAE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,C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ChC,OAAO;AACP,MAAM,GAAG,EAAE;AACX,QAAQ,QAAQ,EAAE,UAAU;AAC5B,QAAQ,kBAAkB,EAAE,OAAO;AACnC,QAAQ,wBAAwB,EAAE,KAAK,CAAC,wBAAwB;AAChE,QAAQ,kBAAkB,EAAE,CAAC,EAAE,aAAa,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,kBAAkB,CAAC,EAAE,CAAC;AACrF,OAAO;AACP,KAAK;AACL,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createUseExternalEvents } from '@mantine/utils';
|
|
2
|
-
|
|
3
|
-
const [useNavigationProgressEvents, createEvent] = createUseExternalEvents("mantine-nprogress");
|
|
4
|
-
const startNavigationProgress = createEvent("start");
|
|
5
|
-
const stopNavigationProgress = createEvent("stop");
|
|
6
|
-
const resetNavigationProgress = createEvent("reset");
|
|
7
|
-
const setNavigationProgress = createEvent("set");
|
|
8
|
-
const incrementNavigationProgress = createEvent("increment");
|
|
9
|
-
const decrementNavigationProgress = createEvent("decrement");
|
|
10
|
-
|
|
11
|
-
export { createEvent, decrementNavigationProgress, incrementNavigationProgress, resetNavigationProgress, setNavigationProgress, startNavigationProgress, stopNavigationProgress, useNavigationProgressEvents };
|
|
12
|
-
//# sourceMappingURL=events.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sources":["../../../src/events.ts"],"sourcesContent":["import { createUseExternalEvents } from '@mantine/utils';\n\nexport type NavigationProgressEvents = {\n start(): void;\n stop(): void;\n set(progress: number): void;\n increment(progress: number): void;\n decrement(progress: number): void;\n reset(): void;\n};\n\nexport const [useNavigationProgressEvents, createEvent] =\n createUseExternalEvents<NavigationProgressEvents>('mantine-nprogress');\n\nexport const NPROGRESS_EVENTS = {\n add: 'mantine:add-nprogress',\n decrease: 'mantine:decrease-nprogress',\n set: 'mantine:set-nprogress',\n start: 'mantine:start-nprogress',\n stop: 'mantine:stop-nprogress',\n reset: 'mantine:reset-nprogress',\n} as const;\n\nexport const startNavigationProgress = createEvent('start');\nexport const stopNavigationProgress = createEvent('stop');\nexport const resetNavigationProgress = createEvent('reset');\nexport const setNavigationProgress = createEvent('set');\nexport const incrementNavigationProgress = createEvent('increment');\nexport const decrementNavigationProgress = createEvent('decrement');\n"],"names":[],"mappings":";;AACY,MAAC,CAAC,2BAA2B,EAAE,WAAW,CAAC,GAAG,uBAAuB,CAAC,mBAAmB,EAAE;AAS3F,MAAC,uBAAuB,GAAG,WAAW,CAAC,OAAO,EAAE;AAChD,MAAC,sBAAsB,GAAG,WAAW,CAAC,MAAM,EAAE;AAC9C,MAAC,uBAAuB,GAAG,WAAW,CAAC,OAAO,EAAE;AAChD,MAAC,qBAAqB,GAAG,WAAW,CAAC,KAAK,EAAE;AAC5C,MAAC,2BAA2B,GAAG,WAAW,CAAC,WAAW,EAAE;AACxD,MAAC,2BAA2B,GAAG,WAAW,CAAC,WAAW;;;;"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { NavigationProgress } from './NavigationProgress.js';
|
|
2
|
-
export { decrementNavigationProgress, incrementNavigationProgress, resetNavigationProgress, setNavigationProgress, startNavigationProgress, stopNavigationProgress } from './events.js';
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-z-index.js","sources":["../../../../../../../mantine-styles/esm/theme/utils/get-default-z-index/get-default-z-index.js"],"sourcesContent":["const elevations = {\n app: 100,\n modal: 200,\n popover: 300,\n overlay: 400,\n max: 9999\n};\nfunction getDefaultZIndex(level) {\n return elevations[level];\n}\n\nexport { getDefaultZIndex };\n//# sourceMappingURL=get-default-z-index.js.map\n"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG;AACnB,EAAE,GAAG,EAAE,GAAG;AACV,EAAE,KAAK,EAAE,GAAG;AACZ,EAAE,OAAO,EAAE,GAAG;AACd,EAAE,OAAO,EAAE,GAAG;AACd,EAAE,GAAG,EAAE,IAAI;AACX,CAAC,CAAC;AACF,SAAS,gBAAgB,CAAC,KAAK,EAAE;AACjC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B;;;;"}
|
package/lib/NProgress.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { MantineColor } from '@mantine/styles';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export interface NProgressProps {
|
|
4
|
-
/** The default progress */
|
|
5
|
-
defaultProgress?: number;
|
|
6
|
-
/** The color of the progressbar */
|
|
7
|
-
color?: MantineColor;
|
|
8
|
-
/** The height of the progressbar */
|
|
9
|
-
size?: number;
|
|
10
|
-
/** Called when the progress is 100% */
|
|
11
|
-
onFinish?: () => void;
|
|
12
|
-
/** Automatically resets the progress when 100% is reached */
|
|
13
|
-
autoReset?: boolean;
|
|
14
|
-
/** Step delay in ms */
|
|
15
|
-
stepIntervalTime?: number;
|
|
16
|
-
/** Transition function (transition-timing-function) */
|
|
17
|
-
progressTransition?: string;
|
|
18
|
-
/** Transition duration in ms */
|
|
19
|
-
progressTransitionDuration?: number;
|
|
20
|
-
/** The time when the component should be unmounted after progress is 100% */
|
|
21
|
-
exitTimeout?: number;
|
|
22
|
-
/** Exit transition duration in ms */
|
|
23
|
-
exitTransitionDuration?: number;
|
|
24
|
-
/** Exit transition function (transition-timing-function)*/
|
|
25
|
-
exitTransition?: string;
|
|
26
|
-
/** Determines whether NProgress should be rendered within Portal, defaults to true */
|
|
27
|
-
withinPortal?: boolean;
|
|
28
|
-
/** NProgress container z-index */
|
|
29
|
-
zIndex?: React.CSSProperties['zIndex'];
|
|
30
|
-
}
|
|
31
|
-
export declare function NProgress({ defaultProgress, color, size, stepIntervalTime, progressTransition, progressTransitionDuration, exitTimeout, exitTransitionDuration, exitTransition, onFinish, autoReset, withinPortal, zIndex, }: NProgressProps): JSX.Element;
|
|
32
|
-
//# sourceMappingURL=NProgress.d.ts.map
|
package/lib/NProgress.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NProgress.d.ts","sourceRoot":"","sources":["../src/NProgress.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAA2B,MAAM,OAAO,CAAC;AAGhD,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,mCAAmC;IACnC,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAEtB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,uBAAuB;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,uDAAuD;IACvD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,gCAAgC;IAChC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAEpC,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,qCAAqC;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC,2DAA2D;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,sFAAsF;IACtF,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,kCAAkC;IAClC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;CACxC;AAED,wBAAgB,SAAS,CAAC,EACxB,eAAmB,EACnB,KAAc,EACd,IAAQ,EACR,gBAAsB,EACtB,kBAA2B,EAC3B,0BAAgC,EAChC,WAAiB,EACjB,sBAA4B,EAC5B,cAAuB,EACvB,QAAQ,EACR,SAAiB,EACjB,YAAmB,EACnB,MAAgC,GACjC,EAAE,cAAc,eA0HhB"}
|