@mantine/nprogress 5.0.0-alpha.1
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 +19 -0
- package/cjs/NProgress.js +134 -0
- package/cjs/NProgress.js.map +1 -0
- package/cjs/events.js +66 -0
- package/cjs/events.js.map +1 -0
- package/cjs/index.js +17 -0
- package/cjs/index.js.map +1 -0
- package/esm/NProgress.js +126 -0
- package/esm/NProgress.js.map +1 -0
- package/esm/events.js +54 -0
- package/esm/events.js.map +1 -0
- package/esm/index.js +3 -0
- package/esm/index.js.map +1 -0
- package/lib/NProgress.d.ts +32 -0
- package/lib/NProgress.d.ts.map +1 -0
- package/lib/events.d.ts +28 -0
- package/lib/events.d.ts.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/package.json +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Mantine NProgress
|
|
2
|
+
|
|
3
|
+
A navigation progress bar
|
|
4
|
+
|
|
5
|
+
[Documentation](https://mantine.dev/)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
# With yarn
|
|
11
|
+
yarn add @mantine/nprogress @mantine/core @mantine/hooks
|
|
12
|
+
|
|
13
|
+
# With npm
|
|
14
|
+
npm install @mantine/nprogress @mantine/core @mantine/hooks
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## License
|
|
18
|
+
|
|
19
|
+
MIT
|
package/cjs/NProgress.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
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("nprogress")
|
|
29
|
+
}) {
|
|
30
|
+
const reducedMotion = hooks.useReducedMotion();
|
|
31
|
+
const [_progress, setProgress] = React.useState(defaultProgress);
|
|
32
|
+
const [mounted, setMounted] = React.useState(true);
|
|
33
|
+
const resetRef = React.useRef();
|
|
34
|
+
const unmountRef = React.useRef();
|
|
35
|
+
const unmountProgressRef = React.useRef(false);
|
|
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
|
+
}, stepIntervalTime);
|
|
51
|
+
const cancelUnmount = () => {
|
|
52
|
+
if (unmountRef.current) {
|
|
53
|
+
window.clearTimeout(unmountRef.current);
|
|
54
|
+
unmountRef.current = null;
|
|
55
|
+
}
|
|
56
|
+
if (resetRef.current) {
|
|
57
|
+
window.clearTimeout(resetRef.current);
|
|
58
|
+
resetRef.current = null;
|
|
59
|
+
}
|
|
60
|
+
setMounted(true);
|
|
61
|
+
};
|
|
62
|
+
const set = (value) => setProgress(value);
|
|
63
|
+
const add = (value) => setProgress((c) => Math.min(c + value, 100));
|
|
64
|
+
const decrease = (value) => setProgress((c) => Math.max(c - value, 0));
|
|
65
|
+
const start = () => {
|
|
66
|
+
interval.stop();
|
|
67
|
+
interval.start();
|
|
68
|
+
};
|
|
69
|
+
const stop = () => interval.stop();
|
|
70
|
+
const reset = () => {
|
|
71
|
+
unmountProgressRef.current = true;
|
|
72
|
+
stop();
|
|
73
|
+
setProgress(0);
|
|
74
|
+
unmountProgressRef.current = false;
|
|
75
|
+
};
|
|
76
|
+
const ctx = {
|
|
77
|
+
set,
|
|
78
|
+
add,
|
|
79
|
+
decrease,
|
|
80
|
+
start,
|
|
81
|
+
stop,
|
|
82
|
+
reset
|
|
83
|
+
};
|
|
84
|
+
const unmountProgress = () => {
|
|
85
|
+
unmountRef.current = null;
|
|
86
|
+
setMounted(false);
|
|
87
|
+
if (autoReset) {
|
|
88
|
+
resetRef.current = window.setTimeout(() => {
|
|
89
|
+
resetRef.current = null;
|
|
90
|
+
reset();
|
|
91
|
+
}, exitTransitionDuration);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
hooks.useDidUpdate(() => {
|
|
95
|
+
if (_progress >= 100) {
|
|
96
|
+
stop();
|
|
97
|
+
onFinish && onFinish();
|
|
98
|
+
unmountRef.current = window.setTimeout(unmountProgress, exitTimeout);
|
|
99
|
+
} else if (!mounted) {
|
|
100
|
+
cancelUnmount();
|
|
101
|
+
}
|
|
102
|
+
}, [_progress]);
|
|
103
|
+
events.useNProgressEvents(ctx);
|
|
104
|
+
return /* @__PURE__ */ React__default.createElement(core.OptionalPortal, {
|
|
105
|
+
withinPortal,
|
|
106
|
+
zIndex
|
|
107
|
+
}, !unmountProgressRef.current && /* @__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
|
+
width: "100vw",
|
|
118
|
+
backgroundColor: "transparent",
|
|
119
|
+
transitionProperty: "opacity",
|
|
120
|
+
transitionTimingFunction: exitTransition,
|
|
121
|
+
transitionDuration: `${reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration}ms`,
|
|
122
|
+
opacity: mounted ? 1 : 0
|
|
123
|
+
},
|
|
124
|
+
bar: {
|
|
125
|
+
transitionProperty: "width",
|
|
126
|
+
transitionTimingFunction: progressTransition,
|
|
127
|
+
transitionDuration: `${reducedMotion || !mounted ? 0 : progressTransitionDuration}ms`
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
exports.NProgress = NProgress;
|
|
134
|
+
//# sourceMappingURL=NProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NProgress.js","sources":["../src/NProgress.tsx"],"sourcesContent":["import { OptionalPortal, Progress } 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?: number;\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('nprogress'),\n}: NProgressProps) {\n const reducedMotion = useReducedMotion();\n const [_progress, setProgress] = useState(defaultProgress);\n const [mounted, setMounted] = useState(true);\n const resetRef = useRef<number>();\n const unmountRef = useRef<number>();\n const unmountProgressRef = useRef(false);\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 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 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 unmountProgressRef.current = true;\n stop();\n setProgress(0);\n unmountProgressRef.current = false;\n };\n\n const ctx = {\n set,\n add,\n decrease,\n start,\n stop,\n reset,\n };\n\n const unmountProgress = () => {\n unmountRef.current = null;\n setMounted(false);\n\n if (autoReset) {\n resetRef.current = window.setTimeout(() => {\n resetRef.current = null;\n reset();\n }, exitTransitionDuration);\n }\n };\n\n useDidUpdate(() => {\n if (_progress >= 100) {\n stop();\n onFinish && onFinish();\n unmountRef.current = window.setTimeout(unmountProgress, exitTimeout);\n } else if (!mounted) {\n cancelUnmount();\n }\n }, [_progress]);\n\n useNProgressEvents(ctx);\n\n return (\n <OptionalPortal withinPortal={withinPortal} zIndex={zIndex}>\n {!unmountProgressRef.current && (\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 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","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,WAAW,CAAC;AACxC,CAAC,EAAE;AACH,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AO;AACzB,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;;;;"}
|
package/cjs/events.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
const NPROGRESS_EVENTS = {
|
|
8
|
+
add: "mantine:add-nprogress",
|
|
9
|
+
decrease: "mantine:decrease-nprogress",
|
|
10
|
+
set: "mantine:set-nprogress",
|
|
11
|
+
start: "mantine:start-nprogress",
|
|
12
|
+
stop: "mantine:stop-nprogress",
|
|
13
|
+
reset: "mantine:reset-nprogress"
|
|
14
|
+
};
|
|
15
|
+
function createEvent(type, detail) {
|
|
16
|
+
return new CustomEvent(type, { detail });
|
|
17
|
+
}
|
|
18
|
+
function addNProgress(progress) {
|
|
19
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.add, progress));
|
|
20
|
+
}
|
|
21
|
+
function decreaseNProgress(progress) {
|
|
22
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.decrease, progress));
|
|
23
|
+
}
|
|
24
|
+
function setNProgress(progress) {
|
|
25
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.set, progress));
|
|
26
|
+
}
|
|
27
|
+
function startNProgress() {
|
|
28
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.start));
|
|
29
|
+
}
|
|
30
|
+
function stopNProgress() {
|
|
31
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.stop));
|
|
32
|
+
}
|
|
33
|
+
function resetNProgress() {
|
|
34
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.reset));
|
|
35
|
+
}
|
|
36
|
+
function useNProgressEvents(ctx) {
|
|
37
|
+
const events = {
|
|
38
|
+
add: (event) => ctx.add(event.detail),
|
|
39
|
+
decrease: (event) => ctx.decrease(event.detail),
|
|
40
|
+
set: (event) => ctx.set(event.detail),
|
|
41
|
+
start: ctx.start,
|
|
42
|
+
stop: ctx.stop,
|
|
43
|
+
reset: ctx.reset
|
|
44
|
+
};
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
Object.keys(events).forEach((event) => {
|
|
47
|
+
window.addEventListener(NPROGRESS_EVENTS[event], events[event]);
|
|
48
|
+
});
|
|
49
|
+
return () => {
|
|
50
|
+
Object.keys(events).forEach((event) => {
|
|
51
|
+
window.removeEventListener(NPROGRESS_EVENTS[event], events[event]);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
exports.NPROGRESS_EVENTS = NPROGRESS_EVENTS;
|
|
58
|
+
exports.addNProgress = addNProgress;
|
|
59
|
+
exports.createEvent = createEvent;
|
|
60
|
+
exports.decreaseNProgress = decreaseNProgress;
|
|
61
|
+
exports.resetNProgress = resetNProgress;
|
|
62
|
+
exports.setNProgress = setNProgress;
|
|
63
|
+
exports.startNProgress = startNProgress;
|
|
64
|
+
exports.stopNProgress = stopNProgress;
|
|
65
|
+
exports.useNProgressEvents = useNProgressEvents;
|
|
66
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\n\ntype ValueOf<T> = T[keyof T];\n\ninterface NProgressProps {\n start: () => void;\n stop: () => void;\n set: (progress: number) => void;\n add: (progress: number) => void;\n decrease: (progress: number) => void;\n reset: () => void;\n}\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 function createEvent(type: ValueOf<typeof NPROGRESS_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function addNProgress(progress: number) {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.add, progress));\n}\n\nexport function decreaseNProgress(progress: number) {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.decrease, progress));\n}\n\nexport function setNProgress(progress: React.SetStateAction<number>) {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.set, progress));\n}\n\nexport function startNProgress() {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.start));\n}\n\nexport function stopNProgress() {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.stop));\n}\n\nexport function resetNProgress() {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.reset));\n}\n\nexport function useNProgressEvents(ctx: NProgressProps) {\n const events = {\n add: (event: any) => ctx.add(event.detail),\n decrease: (event: any) => ctx.decrease(event.detail),\n set: (event: any) => ctx.set(event.detail),\n start: ctx.start,\n stop: ctx.stop,\n reset: ctx.reset,\n };\n\n useEffect(() => {\n Object.keys(events).forEach((event) => {\n window.addEventListener(NPROGRESS_EVENTS[event], events[event]);\n });\n\n return () => {\n Object.keys(events).forEach((event) => {\n window.removeEventListener(NPROGRESS_EVENTS[event], events[event]);\n });\n };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;AACM,SAAS,kBAAkB,CAAC,GAAG,EAAE;AACxC,EAAE,MAAM,MAAM,GAAG;AACjB,IAAI,GAAG,EAAE,CAAC,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;AACzC,IAAI,QAAQ,EAAE,CAAC,KAAK,KAAK,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;AACnD,IAAI,GAAG,EAAE,CAAC,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;AACzC,IAAI,KAAK,EAAE,GAAG,CAAC,KAAK;AACpB,IAAI,IAAI,EAAE,GAAG,CAAC,IAAI;AAClB,IAAI,KAAK,EAAE,GAAG,CAAC,KAAK;AACpB,GAAG,CAAC;AACJ,EAAEA,eAAS,CAAC,MAAM;AAClB,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK;AAC3C,MAAM,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACtE,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,MAAM;AACjB,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK;AAC7C,QAAQ,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3E,OAAO,CAAC,CAAC;AACT,KAAK,CAAC;AACN,GAAG,EAAE,EAAE,CAAC,CAAC;AACT;;;;;;;;;;;;"}
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var NProgress = require('./NProgress.js');
|
|
6
|
+
var events = require('./events.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.NProgress = NProgress.NProgress;
|
|
11
|
+
exports.addNProgress = events.addNProgress;
|
|
12
|
+
exports.decreaseNProgress = events.decreaseNProgress;
|
|
13
|
+
exports.resetNProgress = events.resetNProgress;
|
|
14
|
+
exports.setNProgress = events.setNProgress;
|
|
15
|
+
exports.startNProgress = events.startNProgress;
|
|
16
|
+
exports.stopNProgress = events.stopNProgress;
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
package/esm/NProgress.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { 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("nprogress")
|
|
21
|
+
}) {
|
|
22
|
+
const reducedMotion = useReducedMotion();
|
|
23
|
+
const [_progress, setProgress] = useState(defaultProgress);
|
|
24
|
+
const [mounted, setMounted] = useState(true);
|
|
25
|
+
const resetRef = useRef();
|
|
26
|
+
const unmountRef = useRef();
|
|
27
|
+
const unmountProgressRef = useRef(false);
|
|
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
|
+
}, stepIntervalTime);
|
|
43
|
+
const cancelUnmount = () => {
|
|
44
|
+
if (unmountRef.current) {
|
|
45
|
+
window.clearTimeout(unmountRef.current);
|
|
46
|
+
unmountRef.current = null;
|
|
47
|
+
}
|
|
48
|
+
if (resetRef.current) {
|
|
49
|
+
window.clearTimeout(resetRef.current);
|
|
50
|
+
resetRef.current = null;
|
|
51
|
+
}
|
|
52
|
+
setMounted(true);
|
|
53
|
+
};
|
|
54
|
+
const set = (value) => setProgress(value);
|
|
55
|
+
const add = (value) => setProgress((c) => Math.min(c + value, 100));
|
|
56
|
+
const decrease = (value) => setProgress((c) => Math.max(c - value, 0));
|
|
57
|
+
const start = () => {
|
|
58
|
+
interval.stop();
|
|
59
|
+
interval.start();
|
|
60
|
+
};
|
|
61
|
+
const stop = () => interval.stop();
|
|
62
|
+
const reset = () => {
|
|
63
|
+
unmountProgressRef.current = true;
|
|
64
|
+
stop();
|
|
65
|
+
setProgress(0);
|
|
66
|
+
unmountProgressRef.current = false;
|
|
67
|
+
};
|
|
68
|
+
const ctx = {
|
|
69
|
+
set,
|
|
70
|
+
add,
|
|
71
|
+
decrease,
|
|
72
|
+
start,
|
|
73
|
+
stop,
|
|
74
|
+
reset
|
|
75
|
+
};
|
|
76
|
+
const unmountProgress = () => {
|
|
77
|
+
unmountRef.current = null;
|
|
78
|
+
setMounted(false);
|
|
79
|
+
if (autoReset) {
|
|
80
|
+
resetRef.current = window.setTimeout(() => {
|
|
81
|
+
resetRef.current = null;
|
|
82
|
+
reset();
|
|
83
|
+
}, exitTransitionDuration);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
useDidUpdate(() => {
|
|
87
|
+
if (_progress >= 100) {
|
|
88
|
+
stop();
|
|
89
|
+
onFinish && onFinish();
|
|
90
|
+
unmountRef.current = window.setTimeout(unmountProgress, exitTimeout);
|
|
91
|
+
} else if (!mounted) {
|
|
92
|
+
cancelUnmount();
|
|
93
|
+
}
|
|
94
|
+
}, [_progress]);
|
|
95
|
+
useNProgressEvents(ctx);
|
|
96
|
+
return /* @__PURE__ */ React.createElement(OptionalPortal, {
|
|
97
|
+
withinPortal,
|
|
98
|
+
zIndex
|
|
99
|
+
}, !unmountProgressRef.current && /* @__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
|
+
width: "100vw",
|
|
110
|
+
backgroundColor: "transparent",
|
|
111
|
+
transitionProperty: "opacity",
|
|
112
|
+
transitionTimingFunction: exitTransition,
|
|
113
|
+
transitionDuration: `${reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration}ms`,
|
|
114
|
+
opacity: mounted ? 1 : 0
|
|
115
|
+
},
|
|
116
|
+
bar: {
|
|
117
|
+
transitionProperty: "width",
|
|
118
|
+
transitionTimingFunction: progressTransition,
|
|
119
|
+
transitionDuration: `${reducedMotion || !mounted ? 0 : progressTransitionDuration}ms`
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { NProgress };
|
|
126
|
+
//# sourceMappingURL=NProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NProgress.js","sources":["../src/NProgress.tsx"],"sourcesContent":["import { OptionalPortal, Progress } 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?: number;\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('nprogress'),\n}: NProgressProps) {\n const reducedMotion = useReducedMotion();\n const [_progress, setProgress] = useState(defaultProgress);\n const [mounted, setMounted] = useState(true);\n const resetRef = useRef<number>();\n const unmountRef = useRef<number>();\n const unmountProgressRef = useRef(false);\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 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 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 unmountProgressRef.current = true;\n stop();\n setProgress(0);\n unmountProgressRef.current = false;\n };\n\n const ctx = {\n set,\n add,\n decrease,\n start,\n stop,\n reset,\n };\n\n const unmountProgress = () => {\n unmountRef.current = null;\n setMounted(false);\n\n if (autoReset) {\n resetRef.current = window.setTimeout(() => {\n resetRef.current = null;\n reset();\n }, exitTransitionDuration);\n }\n };\n\n useDidUpdate(() => {\n if (_progress >= 100) {\n stop();\n onFinish && onFinish();\n unmountRef.current = window.setTimeout(unmountProgress, exitTimeout);\n } else if (!mounted) {\n cancelUnmount();\n }\n }, [_progress]);\n\n useNProgressEvents(ctx);\n\n return (\n <OptionalPortal withinPortal={withinPortal} zIndex={zIndex}>\n {!unmountProgressRef.current && (\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 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,CAA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CAAC;AAC1B,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE;AAC7D,IAAI,YAAY;AAChB,IAAI,MAAM;AACV,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,oBAAoB,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE;AAClF,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,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;;;;"}
|
package/esm/events.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const NPROGRESS_EVENTS = {
|
|
4
|
+
add: "mantine:add-nprogress",
|
|
5
|
+
decrease: "mantine:decrease-nprogress",
|
|
6
|
+
set: "mantine:set-nprogress",
|
|
7
|
+
start: "mantine:start-nprogress",
|
|
8
|
+
stop: "mantine:stop-nprogress",
|
|
9
|
+
reset: "mantine:reset-nprogress"
|
|
10
|
+
};
|
|
11
|
+
function createEvent(type, detail) {
|
|
12
|
+
return new CustomEvent(type, { detail });
|
|
13
|
+
}
|
|
14
|
+
function addNProgress(progress) {
|
|
15
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.add, progress));
|
|
16
|
+
}
|
|
17
|
+
function decreaseNProgress(progress) {
|
|
18
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.decrease, progress));
|
|
19
|
+
}
|
|
20
|
+
function setNProgress(progress) {
|
|
21
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.set, progress));
|
|
22
|
+
}
|
|
23
|
+
function startNProgress() {
|
|
24
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.start));
|
|
25
|
+
}
|
|
26
|
+
function stopNProgress() {
|
|
27
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.stop));
|
|
28
|
+
}
|
|
29
|
+
function resetNProgress() {
|
|
30
|
+
window.dispatchEvent(createEvent(NPROGRESS_EVENTS.reset));
|
|
31
|
+
}
|
|
32
|
+
function useNProgressEvents(ctx) {
|
|
33
|
+
const events = {
|
|
34
|
+
add: (event) => ctx.add(event.detail),
|
|
35
|
+
decrease: (event) => ctx.decrease(event.detail),
|
|
36
|
+
set: (event) => ctx.set(event.detail),
|
|
37
|
+
start: ctx.start,
|
|
38
|
+
stop: ctx.stop,
|
|
39
|
+
reset: ctx.reset
|
|
40
|
+
};
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
Object.keys(events).forEach((event) => {
|
|
43
|
+
window.addEventListener(NPROGRESS_EVENTS[event], events[event]);
|
|
44
|
+
});
|
|
45
|
+
return () => {
|
|
46
|
+
Object.keys(events).forEach((event) => {
|
|
47
|
+
window.removeEventListener(NPROGRESS_EVENTS[event], events[event]);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { NPROGRESS_EVENTS, addNProgress, createEvent, decreaseNProgress, resetNProgress, setNProgress, startNProgress, stopNProgress, useNProgressEvents };
|
|
54
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\n\ntype ValueOf<T> = T[keyof T];\n\ninterface NProgressProps {\n start: () => void;\n stop: () => void;\n set: (progress: number) => void;\n add: (progress: number) => void;\n decrease: (progress: number) => void;\n reset: () => void;\n}\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 function createEvent(type: ValueOf<typeof NPROGRESS_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function addNProgress(progress: number) {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.add, progress));\n}\n\nexport function decreaseNProgress(progress: number) {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.decrease, progress));\n}\n\nexport function setNProgress(progress: React.SetStateAction<number>) {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.set, progress));\n}\n\nexport function startNProgress() {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.start));\n}\n\nexport function stopNProgress() {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.stop));\n}\n\nexport function resetNProgress() {\n window.dispatchEvent(createEvent(NPROGRESS_EVENTS.reset));\n}\n\nexport function useNProgressEvents(ctx: NProgressProps) {\n const events = {\n add: (event: any) => ctx.add(event.detail),\n decrease: (event: any) => ctx.decrease(event.detail),\n set: (event: any) => ctx.set(event.detail),\n start: ctx.start,\n stop: ctx.stop,\n reset: ctx.reset,\n };\n\n useEffect(() => {\n Object.keys(events).forEach((event) => {\n window.addEventListener(NPROGRESS_EVENTS[event], events[event]);\n });\n\n return () => {\n Object.keys(events).forEach((event) => {\n window.removeEventListener(NPROGRESS_EVENTS[event], events[event]);\n });\n };\n }, []);\n}\n"],"names":[],"mappings":";;AACY,MAAC,gBAAgB,GAAG;AAChC,EAAE,GAAG,EAAE,uBAAuB;AAC9B,EAAE,QAAQ,EAAE,4BAA4B;AACxC,EAAE,GAAG,EAAE,uBAAuB;AAC9B,EAAE,KAAK,EAAE,yBAAyB;AAClC,EAAE,IAAI,EAAE,wBAAwB;AAChC,EAAE,KAAK,EAAE,yBAAyB;AAClC,EAAE;AACK,SAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE;AAC1C,EAAE,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC3C,CAAC;AACM,SAAS,YAAY,CAAC,QAAQ,EAAE;AACvC,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpE,CAAC;AACM,SAAS,iBAAiB,CAAC,QAAQ,EAAE;AAC5C,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC;AACM,SAAS,YAAY,CAAC,QAAQ,EAAE;AACvC,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpE,CAAC;AACM,SAAS,cAAc,GAAG;AACjC,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5D,CAAC;AACM,SAAS,aAAa,GAAG;AAChC,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC;AACM,SAAS,cA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.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MantineColor } from '@mantine/styles';
|
|
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?: number;
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NProgress.d.ts","sourceRoot":"","sources":["../src/NProgress.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAoB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIjE,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,MAAM,CAAC;CACjB;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,MAAsC,GACvC,EAAE,cAAc,eAsHhB"}
|
package/lib/events.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type ValueOf<T> = T[keyof T];
|
|
3
|
+
interface NProgressProps {
|
|
4
|
+
start: () => void;
|
|
5
|
+
stop: () => void;
|
|
6
|
+
set: (progress: number) => void;
|
|
7
|
+
add: (progress: number) => void;
|
|
8
|
+
decrease: (progress: number) => void;
|
|
9
|
+
reset: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const NPROGRESS_EVENTS: {
|
|
12
|
+
readonly add: "mantine:add-nprogress";
|
|
13
|
+
readonly decrease: "mantine:decrease-nprogress";
|
|
14
|
+
readonly set: "mantine:set-nprogress";
|
|
15
|
+
readonly start: "mantine:start-nprogress";
|
|
16
|
+
readonly stop: "mantine:stop-nprogress";
|
|
17
|
+
readonly reset: "mantine:reset-nprogress";
|
|
18
|
+
};
|
|
19
|
+
export declare function createEvent(type: ValueOf<typeof NPROGRESS_EVENTS>, detail?: any): CustomEvent<any>;
|
|
20
|
+
export declare function addNProgress(progress: number): void;
|
|
21
|
+
export declare function decreaseNProgress(progress: number): void;
|
|
22
|
+
export declare function setNProgress(progress: React.SetStateAction<number>): void;
|
|
23
|
+
export declare function startNProgress(): void;
|
|
24
|
+
export declare function stopNProgress(): void;
|
|
25
|
+
export declare function resetNProgress(): void;
|
|
26
|
+
export declare function useNProgressEvents(ctx: NProgressProps): void;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";AAEA,aAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7B,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,gBAAgB;;;;;;;CAOnB,CAAC;AAEX,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,gBAAgB,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,oBAE/E;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,QAE5C;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,QAEjD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,QAElE;AAED,wBAAgB,cAAc,SAE7B;AAED,wBAAgB,aAAa,SAE5B;AAED,wBAAgB,cAAc,SAE7B;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,cAAc,QAqBrD"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,UAAU,CAAC;AAElB,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mantine/nprogress",
|
|
3
|
+
"description": "A navigation progress bar",
|
|
4
|
+
"version": "5.0.0-alpha.1",
|
|
5
|
+
"main": "cjs/index.js",
|
|
6
|
+
"module": "esm/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"author": "Vitaly Rtishchev <rtivital@gmail.com>",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"homepage": "https://mantine.dev/others/nprogress/",
|
|
12
|
+
"repository": {
|
|
13
|
+
"url": "https://github.com/mantinedev/mantine.git",
|
|
14
|
+
"type": "git",
|
|
15
|
+
"directory": "src/mantine-nprogress"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@mantine/core": "5.0.0-alpha.1",
|
|
19
|
+
"@mantine/hooks": "5.0.0-alpha.1",
|
|
20
|
+
"@mantine/styles": "5.0.0-alpha.1",
|
|
21
|
+
"react": ">=16.8.0",
|
|
22
|
+
"react-dom": ">=16.8.0"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {},
|
|
25
|
+
"devDependencies": {}
|
|
26
|
+
}
|