@mantine/nprogress 6.0.17 → 7.0.0-alpha.21

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.
@@ -1,7 +1,7 @@
1
- import { getDefaultZIndex, 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';
1
+ import React, { useEffect } from 'react';
2
+ import { getDefaultZIndex, OptionalPortal, Progress } from '@mantine/core';
3
+ import { nprogressStore, useNprogress, resetNavigationProgressAction } from './nprogress.store.js';
4
+ import classes from './NavigationProgress.module.css.js';
5
5
 
6
6
  var __defProp = Object.defineProperty;
7
7
  var __defProps = Object.defineProperties;
@@ -22,119 +22,62 @@ var __spreadValues = (a, b) => {
22
22
  return a;
23
23
  };
24
24
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- function NavigationProgress({
26
- initialProgress = 0,
27
- color,
28
- size = 3,
29
- stepInterval = 500,
30
- transitionDuration = 300,
31
- exitTimeout = 500,
32
- exitTransitionDuration = 400,
33
- onFinish,
34
- autoReset = false,
35
- withinPortal = true,
36
- portalProps,
37
- zIndex = getDefaultZIndex("max"),
38
- progressLabel
39
- }) {
40
- const theme = useMantineTheme();
41
- const shouldReduceMotion = useReducedMotion();
42
- const reducedMotion = theme.respectReducedMotion ? shouldReduceMotion : false;
43
- const [_progress, setProgress] = useState(initialProgress);
44
- const [mounted, setMounted] = useState(true);
45
- const [unmountProgress, setUnmountProgress] = useState(false);
46
- const resetRef = useRef();
47
- const unmountRef = useRef();
48
- const interval = useInterval(() => {
49
- setProgress((amount) => {
50
- let next = 0;
51
- if (amount >= 0 && amount <= 20) {
52
- next = 10;
53
- } else if (amount >= 20 && amount <= 50) {
54
- next = 4;
55
- } else if (amount >= 50 && amount <= 80) {
56
- next = 2;
57
- } else if (amount >= 80 && amount <= 99) {
58
- next = 0.5;
59
- }
60
- return amount + next;
61
- });
62
- }, stepInterval);
63
- const set = (value) => setProgress(value);
64
- const increment = (value) => setProgress((c) => Math.min(c + value, 100));
65
- const decrement = (value) => setProgress((c) => Math.max(c - value, 0));
66
- const start = () => {
67
- interval.stop();
68
- interval.start();
69
- };
70
- const stop = () => interval.stop();
71
- const reset = () => {
72
- setUnmountProgress(true);
73
- stop();
74
- setProgress(0);
75
- window.setTimeout(() => setUnmountProgress(false), 0);
76
- };
77
- const complete = () => setProgress(100);
78
- const cancelUnmount = () => {
79
- if (unmountRef.current) {
80
- window.clearTimeout(unmountRef.current);
81
- unmountRef.current = null;
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
82
34
  }
83
- if (resetRef.current) {
84
- window.clearTimeout(resetRef.current);
85
- resetRef.current = null;
86
- }
87
- setMounted(true);
88
- };
89
- useDidUpdate(() => {
90
- if (_progress >= 100) {
91
- stop();
92
- onFinish == null ? void 0 : onFinish();
93
- unmountRef.current = window.setTimeout(() => {
94
- unmountRef.current = null;
95
- setMounted(false);
96
- if (autoReset) {
97
- resetRef.current = window.setTimeout(() => {
98
- resetRef.current = null;
99
- reset();
100
- }, reducedMotion ? 0 : exitTransitionDuration);
101
- }
102
- }, exitTimeout);
103
- } else if (!mounted) {
104
- cancelUnmount();
105
- }
106
- }, [_progress]);
107
- useNavigationProgressEvents({ start, stop, set, increment, decrement, reset, complete });
108
- return /* @__PURE__ */ React.createElement(OptionalPortal, __spreadProps(__spreadValues({}, portalProps), {
109
- withinPortal
110
- }), !unmountProgress && /* @__PURE__ */ React.createElement(Progress, {
111
- radius: 0,
112
- value: _progress,
113
- size,
35
+ return target;
36
+ };
37
+ function NavigationProgress(_a) {
38
+ var _b = _a, {
39
+ initialProgress = 0,
114
40
  color,
115
- styles: {
116
- root: {
117
- position: "fixed",
118
- top: 0,
119
- left: 0,
120
- right: 0,
121
- zIndex,
122
- backgroundColor: "transparent",
123
- transitionProperty: "opacity",
124
- transitionTimingFunction: theme.transitionTimingFunction,
125
- transitionDuration: `${reducedMotion || _progress !== 100 ? 0 : exitTransitionDuration}ms`,
126
- opacity: mounted ? 1 : 0
127
- },
128
- bar: {
129
- position: "relative",
130
- transitionProperty: "width",
131
- transitionTimingFunction: theme.transitionTimingFunction,
132
- transitionDuration: `${reducedMotion || !mounted ? 0 : transitionDuration}ms`
133
- }
134
- },
135
- "aria-label": progressLabel
136
- }));
41
+ size = 3,
42
+ stepInterval = 500,
43
+ withinPortal = true,
44
+ portalProps,
45
+ zIndex = getDefaultZIndex("max"),
46
+ store = nprogressStore
47
+ } = _b, others = __objRest(_b, [
48
+ "initialProgress",
49
+ "color",
50
+ "size",
51
+ "stepInterval",
52
+ "withinPortal",
53
+ "portalProps",
54
+ "zIndex",
55
+ "store"
56
+ ]);
57
+ store.initialize({
58
+ mounted: false,
59
+ progress: initialProgress,
60
+ interval: -1,
61
+ step: 1,
62
+ stepInterval,
63
+ timeouts: []
64
+ });
65
+ const state = useNprogress(store);
66
+ useEffect(() => () => resetNavigationProgressAction(store), [store]);
67
+ return /* @__PURE__ */ React.createElement(OptionalPortal, __spreadProps(__spreadValues({}, portalProps), { withinPortal }), /* @__PURE__ */ React.createElement(
68
+ Progress,
69
+ __spreadValues({
70
+ radius: 0,
71
+ value: state.progress,
72
+ size,
73
+ color,
74
+ classNames: classes,
75
+ "data-mounted": state.mounted || void 0,
76
+ __vars: { "--nprogress-z-index": zIndex == null ? void 0 : zIndex.toString() }
77
+ }, others)
78
+ ));
137
79
  }
80
+ NavigationProgress.displayName = "@mantine/nprogress/NavigationProgress";
138
81
 
139
82
  export { NavigationProgress };
140
83
  //# sourceMappingURL=NavigationProgress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationProgress.js","sources":["../src/NavigationProgress.tsx"],"sourcesContent":["import {\n OptionalPortal,\n Progress,\n useMantineTheme,\n getDefaultZIndex,\n MantineColor,\n PortalProps,\n} from '@mantine/core';\nimport { useDidUpdate, useInterval, useReducedMotion } from '@mantine/hooks';\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 /** Height of the progressbar */\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 /** Props to pass down to the portal when withinPortal is true */\n portalProps?: Omit<PortalProps, 'children' | 'withinPortal'>;\n\n /** Progressbar z-index */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** aria-label for `Progress`*/\n progressLabel?: string;\n}\n\nexport function NavigationProgress({\n initialProgress = 0,\n color,\n size = 3,\n stepInterval = 500,\n transitionDuration = 300,\n exitTimeout = 500,\n exitTransitionDuration = 400,\n onFinish,\n autoReset = false,\n withinPortal = true,\n portalProps,\n zIndex = getDefaultZIndex('max'),\n progressLabel,\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 const complete = () => setProgress(100);\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, complete });\n\n return (\n <OptionalPortal {...portalProps} 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 aria-label={progressLabel}\n />\n )}\n </OptionalPortal>\n );\n}\n"],"names":[],"mappings":";;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AACpC,QAAQ,e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ACP,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,IAAI,YAAY,EAAE,aAAa;AAC/B,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"NavigationProgress.js","sources":["../src/NavigationProgress.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport {\n OptionalPortal,\n Progress,\n getDefaultZIndex,\n MantineColor,\n PortalProps,\n ElementProps,\n} from '@mantine/core';\nimport {\n NprogressStore,\n nprogressStore,\n resetNavigationProgressAction,\n useNprogress,\n} from './nprogress.store';\nimport classes from './NavigationProgress.module.css';\n\nexport interface NavigationProgressProps extends ElementProps<'div'> {\n /** Component store, controls state */\n store?: NprogressStore;\n\n /** Initial progress value, `0` by default */\n initialProgress?: number;\n\n /** Key of `theme.colors` of any other valid CSS color, `theme.primaryColor` by default */\n color?: MantineColor;\n\n /** Controls height of the progress bar */\n size?: number;\n\n /** Step interval in ms, `500` by default */\n stepInterval?: number;\n\n /** Determines whether the progress bar should be rendered within `Portal`, `true` by default */\n withinPortal?: boolean;\n\n /** Props to pass down to the `Portal` when `withinPortal` is `true` */\n portalProps?: Omit<PortalProps, 'children' | 'withinPortal'>;\n\n /** Progressbar z-index, `9999` by default */\n zIndex?: React.CSSProperties['zIndex'];\n}\n\nexport function NavigationProgress({\n initialProgress = 0,\n color,\n size = 3,\n stepInterval = 500,\n withinPortal = true,\n portalProps,\n zIndex = getDefaultZIndex('max'),\n store = nprogressStore,\n ...others\n}: NavigationProgressProps) {\n store.initialize({\n mounted: false,\n progress: initialProgress,\n interval: -1,\n step: 1,\n stepInterval,\n timeouts: [],\n });\n\n const state = useNprogress(store);\n\n useEffect(() => () => resetNavigationProgressAction(store), [store]);\n\n return (\n <OptionalPortal {...portalProps} withinPortal={withinPortal}>\n <Progress\n radius={0}\n value={state.progress}\n size={size}\n color={color}\n classNames={classes}\n data-mounted={state.mounted || undefined}\n __vars={{ '--nprogress-z-index': zIndex?.toString() }}\n {...others}\n />\n </OptionalPortal>\n );\n}\n\nNavigationProgress.displayName = '@mantine/nprogress/NavigationProgress';\n"],"names":[],"mappings":";;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IA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,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE;AACpF,KAAK,EAAE,MAAM,CAAC;AACd,GAAG,CAAC,CAAC;AACL,CAAC;AACD,kBAAkB,CAAC,WAAW,GAAG,uCAAuC;;;;"}
@@ -0,0 +1,4 @@
1
+ var classes = {"root":"m-8f2832ae","section":"m-7a0fe999"};
2
+
3
+ export default classes;
4
+ //# sourceMappingURL=NavigationProgress.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationProgress.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/esm/index.css ADDED
@@ -0,0 +1,35 @@
1
+ .m-8f2832ae {
2
+ position: fixed;
3
+ top: 0;
4
+ right: 0;
5
+ left: 0;
6
+ z-index: var(--nprogress-z-index);
7
+ background-color: transparent;
8
+ transition: opacity 150ms ease;
9
+ transition-delay: 50ms;
10
+ opacity: var(--_nprogress-opacity, 0);
11
+ overflow: visible;
12
+ }
13
+
14
+ .m-8f2832ae[data-mounted] {
15
+ --_nprogress-opacity: 1;
16
+ }
17
+
18
+ .m-7a0fe999 {
19
+ position: relative;
20
+ transition: width 150ms ease;
21
+ overflow: visible;
22
+ }
23
+
24
+ .m-7a0fe999::before {
25
+ content: '';
26
+ position: absolute;
27
+ width: calc(6.25rem * var(--mantine-scale));
28
+ height: var(--progress-size);
29
+ top: 0;
30
+ right: 1px;
31
+ transform: rotate(4deg) translateY(-4px);
32
+ box-shadow:
33
+ 0 0 10px var(--progress-section-color),
34
+ 0 0 5px var(--progress-section-color);
35
+ }
package/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  export { NavigationProgress } from './NavigationProgress.js';
2
- export { completeNavigationProgress, decrementNavigationProgress, incrementNavigationProgress, nprogress, resetNavigationProgress, setNavigationProgress, startNavigationProgress, stopNavigationProgress } from './events.js';
3
+ export { cleanupNavigationProgress, cleanupNavigationProgressAction, completeNavigationProgress, completeNavigationProgressAction, createNprogress, createNprogressStore, decrementNavigationProgress, decrementNavigationProgressAction, incrementNavigationProgress, incrementNavigationProgressAction, nprogress, nprogressStore, resetNavigationProgress, resetNavigationProgressAction, setNavigationProgress, setNavigationProgressAction, startNavigationProgress, startNavigationProgressAction, stopNavigationProgress, stopNavigationProgressAction, updateNavigationProgressStateAction, useNprogress } from './nprogress.store.js';
3
4
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,154 @@
1
+ import { clamp } from '@mantine/hooks';
2
+ import { createStore, useStore } from '@mantine/store';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ function getIntervalProgressValue(currentProgress) {
21
+ let next = 0.5;
22
+ if (currentProgress >= 0 && currentProgress <= 20) {
23
+ next = 10;
24
+ } else if (currentProgress >= 20 && currentProgress <= 50) {
25
+ next = 4;
26
+ } else if (currentProgress >= 50 && currentProgress <= 80) {
27
+ next = 2;
28
+ } else if (currentProgress >= 80 && currentProgress <= 99) {
29
+ next = 1;
30
+ } else if (currentProgress >= 99 && currentProgress <= 100) {
31
+ next = 0;
32
+ }
33
+ return currentProgress + next;
34
+ }
35
+ const createNprogressStore = () => createStore({
36
+ mounted: false,
37
+ progress: 0,
38
+ interval: 0,
39
+ step: 1,
40
+ stepInterval: 100,
41
+ timeouts: []
42
+ });
43
+ const useNprogress = (store) => useStore(store);
44
+ function updateNavigationProgressStateAction(update, store) {
45
+ const state = store.getState();
46
+ store.setState(__spreadValues(__spreadValues({}, state), update(store.getState())));
47
+ }
48
+ function decrementNavigationProgressAction(store) {
49
+ updateNavigationProgressStateAction(
50
+ (state) => ({ progress: Math.max(state.progress - state.step, 0) }),
51
+ store
52
+ );
53
+ }
54
+ function setNavigationProgressAction(value, store) {
55
+ updateNavigationProgressStateAction(
56
+ () => ({ progress: clamp(value, 0, 100), mounted: true }),
57
+ store
58
+ );
59
+ }
60
+ function cleanupNavigationProgressAction(store) {
61
+ updateNavigationProgressStateAction((state) => {
62
+ window.clearInterval(state.interval);
63
+ state.timeouts.forEach((timeout) => window.clearTimeout(timeout));
64
+ return { timeouts: [] };
65
+ }, store);
66
+ }
67
+ function completeNavigationProgressAction(store) {
68
+ cleanupNavigationProgressAction(store);
69
+ updateNavigationProgressStateAction((state) => {
70
+ const mountedTimeout = window.setTimeout(() => {
71
+ updateNavigationProgressStateAction(() => ({ mounted: false }), store);
72
+ }, 50);
73
+ const resetTimeout = window.setTimeout(() => {
74
+ updateNavigationProgressStateAction(() => ({ progress: 0 }), store);
75
+ }, state.stepInterval + 50);
76
+ return { progress: 100, timeouts: [mountedTimeout, resetTimeout] };
77
+ }, store);
78
+ }
79
+ function startNavigationProgressAction(store) {
80
+ updateNavigationProgressStateAction(
81
+ (s) => ({ progress: getIntervalProgressValue(s.progress), mounted: true }),
82
+ store
83
+ );
84
+ updateNavigationProgressStateAction((state) => {
85
+ window.clearInterval(state.interval);
86
+ const interval = window.setInterval(() => {
87
+ updateNavigationProgressStateAction(
88
+ (s) => ({ progress: getIntervalProgressValue(s.progress), mounted: true }),
89
+ store
90
+ );
91
+ }, state.stepInterval);
92
+ return { interval, mounted: true };
93
+ }, store);
94
+ }
95
+ function stopNavigationProgressAction(store) {
96
+ updateNavigationProgressStateAction((state) => {
97
+ window.clearInterval(state.interval);
98
+ return { interval: -1 };
99
+ }, store);
100
+ }
101
+ function resetNavigationProgressAction(store) {
102
+ cleanupNavigationProgressAction(store);
103
+ stopNavigationProgressAction(store);
104
+ updateNavigationProgressStateAction(() => ({ progress: 0, mounted: false }), store);
105
+ }
106
+ function incrementNavigationProgressAction(store) {
107
+ updateNavigationProgressStateAction((state) => {
108
+ const nextValue = Math.min(state.progress + state.step, 100);
109
+ const nextMounted = nextValue !== 100 && nextValue !== 0;
110
+ if (!nextMounted) {
111
+ const timeout = window.setTimeout(
112
+ () => resetNavigationProgressAction(store),
113
+ state.stepInterval + 50
114
+ );
115
+ return {
116
+ progress: nextValue,
117
+ mounted: nextMounted,
118
+ timeouts: [...state.timeouts, timeout]
119
+ };
120
+ }
121
+ return {
122
+ progress: nextValue,
123
+ mounted: nextMounted
124
+ };
125
+ }, store);
126
+ }
127
+ function createNprogress() {
128
+ const store = createNprogressStore();
129
+ const actions = {
130
+ start: () => startNavigationProgressAction(store),
131
+ stop: () => stopNavigationProgressAction(store),
132
+ reset: () => resetNavigationProgressAction(store),
133
+ set: (value) => setNavigationProgressAction(value, store),
134
+ increment: () => incrementNavigationProgressAction(store),
135
+ decrement: () => decrementNavigationProgressAction(store),
136
+ complete: () => completeNavigationProgressAction(store),
137
+ cleanup: () => cleanupNavigationProgressAction(store)
138
+ };
139
+ return [store, actions];
140
+ }
141
+ const [nprogressStore, nprogress] = createNprogress();
142
+ const {
143
+ start: startNavigationProgress,
144
+ stop: stopNavigationProgress,
145
+ reset: resetNavigationProgress,
146
+ set: setNavigationProgress,
147
+ increment: incrementNavigationProgress,
148
+ decrement: decrementNavigationProgress,
149
+ complete: completeNavigationProgress,
150
+ cleanup: cleanupNavigationProgress
151
+ } = nprogress;
152
+
153
+ export { cleanupNavigationProgress, cleanupNavigationProgressAction, completeNavigationProgress, completeNavigationProgressAction, createNprogress, createNprogressStore, decrementNavigationProgress, decrementNavigationProgressAction, incrementNavigationProgress, incrementNavigationProgressAction, nprogress, nprogressStore, resetNavigationProgress, resetNavigationProgressAction, setNavigationProgress, setNavigationProgressAction, startNavigationProgress, startNavigationProgressAction, stopNavigationProgress, stopNavigationProgressAction, updateNavigationProgressStateAction, useNprogress };
154
+ //# sourceMappingURL=nprogress.store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nprogress.store.js","sources":["../src/nprogress.store.ts"],"sourcesContent":["import { clamp } from '@mantine/hooks';\nimport { createStore, useStore, MantineStore } from '@mantine/store';\n\nfunction getIntervalProgressValue(currentProgress: number) {\n let next = 0.5;\n\n if (currentProgress >= 0 && currentProgress <= 20) {\n next = 10;\n } else if (currentProgress >= 20 && currentProgress <= 50) {\n next = 4;\n } else if (currentProgress >= 50 && currentProgress <= 80) {\n next = 2;\n } else if (currentProgress >= 80 && currentProgress <= 99) {\n next = 1;\n } else if (currentProgress >= 99 && currentProgress <= 100) {\n next = 0;\n }\n\n return currentProgress + next;\n}\n\nexport interface NprogressState {\n mounted: boolean;\n progress: number;\n interval: number;\n step: number;\n stepInterval: number;\n timeouts: number[];\n}\n\nexport type NprogressStore = MantineStore<NprogressState>;\n\nexport const createNprogressStore = () =>\n createStore<NprogressState>({\n mounted: false,\n progress: 0,\n interval: 0,\n step: 1,\n stepInterval: 100,\n timeouts: [],\n });\n\nexport const useNprogress = (store: NprogressStore) => useStore(store);\n\nexport function updateNavigationProgressStateAction(\n update: (state: NprogressState) => Partial<NprogressState>,\n store: NprogressStore\n) {\n const state = store.getState();\n store.setState({ ...state, ...update(store.getState()) });\n}\n\nexport function decrementNavigationProgressAction(store: NprogressStore) {\n updateNavigationProgressStateAction(\n (state) => ({ progress: Math.max(state.progress - state.step, 0) }),\n store\n );\n}\n\nexport function setNavigationProgressAction(value: number, store: NprogressStore) {\n updateNavigationProgressStateAction(\n () => ({ progress: clamp(value, 0, 100), mounted: true }),\n store\n );\n}\n\nexport function cleanupNavigationProgressAction(store: NprogressStore) {\n updateNavigationProgressStateAction((state) => {\n window.clearInterval(state.interval);\n state.timeouts.forEach((timeout) => window.clearTimeout(timeout));\n return { timeouts: [] };\n }, store);\n}\n\nexport function completeNavigationProgressAction(store: NprogressStore) {\n cleanupNavigationProgressAction(store);\n\n updateNavigationProgressStateAction((state) => {\n const mountedTimeout = window.setTimeout(() => {\n updateNavigationProgressStateAction(() => ({ mounted: false }), store);\n }, 50);\n\n const resetTimeout = window.setTimeout(() => {\n updateNavigationProgressStateAction(() => ({ progress: 0 }), store);\n }, state.stepInterval + 50);\n\n return { progress: 100, timeouts: [mountedTimeout, resetTimeout] };\n }, store);\n}\n\nexport function startNavigationProgressAction(store: NprogressStore) {\n updateNavigationProgressStateAction(\n (s) => ({ progress: getIntervalProgressValue(s.progress), mounted: true }),\n store\n );\n\n updateNavigationProgressStateAction((state) => {\n window.clearInterval(state.interval);\n\n const interval = window.setInterval(() => {\n updateNavigationProgressStateAction(\n (s) => ({ progress: getIntervalProgressValue(s.progress), mounted: true }),\n store\n );\n }, state.stepInterval);\n\n return { interval, mounted: true };\n }, store);\n}\n\nexport function stopNavigationProgressAction(store: NprogressStore) {\n updateNavigationProgressStateAction((state) => {\n window.clearInterval(state.interval);\n return { interval: -1 };\n }, store);\n}\n\nexport function resetNavigationProgressAction(store: NprogressStore) {\n cleanupNavigationProgressAction(store);\n stopNavigationProgressAction(store);\n updateNavigationProgressStateAction(() => ({ progress: 0, mounted: false }), store);\n}\n\nexport function incrementNavigationProgressAction(store: NprogressStore) {\n updateNavigationProgressStateAction((state) => {\n const nextValue = Math.min(state.progress + state.step, 100);\n const nextMounted = nextValue !== 100 && nextValue !== 0;\n\n if (!nextMounted) {\n const timeout = window.setTimeout(\n () => resetNavigationProgressAction(store),\n state.stepInterval + 50\n );\n\n return {\n progress: nextValue,\n mounted: nextMounted,\n timeouts: [...state.timeouts, timeout],\n };\n }\n\n return {\n progress: nextValue,\n mounted: nextMounted,\n };\n }, store);\n}\n\nexport function createNprogress() {\n const store = createNprogressStore();\n const actions = {\n start: () => startNavigationProgressAction(store),\n stop: () => stopNavigationProgressAction(store),\n reset: () => resetNavigationProgressAction(store),\n set: (value: number) => setNavigationProgressAction(value, store),\n increment: () => incrementNavigationProgressAction(store),\n decrement: () => decrementNavigationProgressAction(store),\n complete: () => completeNavigationProgressAction(store),\n cleanup: () => cleanupNavigationProgressAction(store),\n };\n\n return [store, actions] as const;\n}\n\nexport const [nprogressStore, nprogress] = createNprogress();\nexport const {\n start: startNavigationProgress,\n stop: stopNavigationProgress,\n reset: resetNavigationProgress,\n set: setNavigationProgress,\n increment: incrementNavigationProgress,\n decrement: decrementNavigationProgress,\n complete: completeNavigationProgress,\n cleanup: cleanupNavigationProgress,\n} = nprogress;\n"],"names":[],"mappings":";;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAA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,2BAA2B;AACxC,EAAE,SAAS,EAAE,2BAA2B;AACxC,EAAE,QAAQ,EAAE,0BAA0B;AACtC,EAAE,OAAO,EAAE,yBAAyB;AACpC,CAAC,GAAG;;;;"}
@@ -1,32 +1,26 @@
1
- import { MantineColor, PortalProps } from '@mantine/core';
2
1
  import React from 'react';
3
- export interface NavigationProgressProps {
4
- /** The default progress */
2
+ import { MantineColor, PortalProps, ElementProps } from '@mantine/core';
3
+ import { NprogressStore } from './nprogress.store';
4
+ export interface NavigationProgressProps extends ElementProps<'div'> {
5
+ /** Component store, controls state */
6
+ store?: NprogressStore;
7
+ /** Initial progress value, `0` by default */
5
8
  initialProgress?: number;
6
- /** Key of theme.colors of any other valid CSS color */
9
+ /** Key of `theme.colors` of any other valid CSS color, `theme.primaryColor` by default */
7
10
  color?: MantineColor;
8
- /** Height of the progressbar */
11
+ /** Controls height of the progress bar */
9
12
  size?: number;
10
- /** Called when the progressbar reaches 100% */
11
- onFinish?(): void;
12
- /** Determines whether progress should be automatically reset when 100% is reached */
13
- autoReset?: boolean;
14
- /** Step interval in ms */
13
+ /** Step interval in ms, `500` by default */
15
14
  stepInterval?: number;
16
- /** Transition duration in ms */
17
- transitionDuration?: number;
18
- /** Number of ms that should elapse before progressbar is hidden after reaching 100% */
19
- exitTimeout?: number;
20
- /** Exit transition duration in ms */
21
- exitTransitionDuration?: number;
22
- /** Determines whether progressbar should be rendered within Portal, defaults to true */
15
+ /** Determines whether the progress bar should be rendered within `Portal`, `true` by default */
23
16
  withinPortal?: boolean;
24
- /** Props to pass down to the portal when withinPortal is true */
17
+ /** Props to pass down to the `Portal` when `withinPortal` is `true` */
25
18
  portalProps?: Omit<PortalProps, 'children' | 'withinPortal'>;
26
- /** Progressbar z-index */
19
+ /** Progressbar z-index, `9999` by default */
27
20
  zIndex?: React.CSSProperties['zIndex'];
28
- /** aria-label for `Progress`*/
29
- progressLabel?: string;
30
21
  }
31
- export declare function NavigationProgress({ initialProgress, color, size, stepInterval, transitionDuration, exitTimeout, exitTransitionDuration, onFinish, autoReset, withinPortal, portalProps, zIndex, progressLabel, }: NavigationProgressProps): JSX.Element;
22
+ export declare function NavigationProgress({ initialProgress, color, size, stepInterval, withinPortal, portalProps, zIndex, store, ...others }: NavigationProgressProps): React.JSX.Element;
23
+ export declare namespace NavigationProgress {
24
+ var displayName: string;
25
+ }
32
26
  //# sourceMappingURL=NavigationProgress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationProgress.d.ts","sourceRoot":"","sources":["../src/NavigationProgress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EACZ,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,KAA2B,MAAM,OAAO,CAAC;AAGhD,MAAM,WAAW,uBAAuB;IACtC,2BAA2B;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,uDAAuD;IACvD,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,IAAI,CAAC;IAElB,qFAAqF;IACrF,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,0BAA0B;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,gCAAgC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,qCAAqC;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC,wFAAwF;IACxF,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,iEAAiE;IACjE,WAAW,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,cAAc,CAAC,CAAC;IAE7D,0BAA0B;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAEvC,+BAA+B;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,eAAmB,EACnB,KAAK,EACL,IAAQ,EACR,YAAkB,EAClB,kBAAwB,EACxB,WAAiB,EACjB,sBAA4B,EAC5B,QAAQ,EACR,SAAiB,EACjB,YAAmB,EACnB,WAAW,EACX,MAAgC,EAChC,aAAa,GACd,EAAE,uBAAuB,eAqHzB"}
1
+ {"version":3,"file":"NavigationProgress.d.ts","sourceRoot":"","sources":["../src/NavigationProgress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAIL,YAAY,EACZ,WAAW,EACX,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,cAAc,EAIf,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,uBAAwB,SAAQ,YAAY,CAAC,KAAK,CAAC;IAClE,sCAAsC;IACtC,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB,6CAA6C;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,gGAAgG;IAChG,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,uEAAuE;IACvE,WAAW,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,cAAc,CAAC,CAAC;IAE7D,6CAA6C;IAC7C,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;CACxC;AAED,wBAAgB,kBAAkB,CAAC,EACjC,eAAmB,EACnB,KAAK,EACL,IAAQ,EACR,YAAkB,EAClB,YAAmB,EACnB,WAAW,EACX,MAAgC,EAChC,KAAsB,EACtB,GAAG,MAAM,EACV,EAAE,uBAAuB,qBA4BzB;yBAtCe,kBAAkB"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { NavigationProgress } from './NavigationProgress';
2
- export { startNavigationProgress, stopNavigationProgress, resetNavigationProgress, setNavigationProgress, incrementNavigationProgress, decrementNavigationProgress, completeNavigationProgress, nprogress, } from './events';
2
+ export * from './nprogress.store';
3
3
  export type { NavigationProgressProps } from './NavigationProgress';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,SAAS,GACV,MAAM,UAAU,CAAC;AAElB,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,cAAc,mBAAmB,CAAC;AAElC,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { MantineStore } from '@mantine/store';
2
+ export interface NprogressState {
3
+ mounted: boolean;
4
+ progress: number;
5
+ interval: number;
6
+ step: number;
7
+ stepInterval: number;
8
+ timeouts: number[];
9
+ }
10
+ export type NprogressStore = MantineStore<NprogressState>;
11
+ export declare const createNprogressStore: () => MantineStore<NprogressState>;
12
+ export declare const useNprogress: (store: NprogressStore) => NprogressState;
13
+ export declare function updateNavigationProgressStateAction(update: (state: NprogressState) => Partial<NprogressState>, store: NprogressStore): void;
14
+ export declare function decrementNavigationProgressAction(store: NprogressStore): void;
15
+ export declare function setNavigationProgressAction(value: number, store: NprogressStore): void;
16
+ export declare function cleanupNavigationProgressAction(store: NprogressStore): void;
17
+ export declare function completeNavigationProgressAction(store: NprogressStore): void;
18
+ export declare function startNavigationProgressAction(store: NprogressStore): void;
19
+ export declare function stopNavigationProgressAction(store: NprogressStore): void;
20
+ export declare function resetNavigationProgressAction(store: NprogressStore): void;
21
+ export declare function incrementNavigationProgressAction(store: NprogressStore): void;
22
+ export declare function createNprogress(): readonly [MantineStore<NprogressState>, {
23
+ start: () => void;
24
+ stop: () => void;
25
+ reset: () => void;
26
+ set: (value: number) => void;
27
+ increment: () => void;
28
+ decrement: () => void;
29
+ complete: () => void;
30
+ cleanup: () => void;
31
+ }];
32
+ export declare const nprogressStore: MantineStore<NprogressState>, nprogress: {
33
+ start: () => void;
34
+ stop: () => void;
35
+ reset: () => void;
36
+ set: (value: number) => void;
37
+ increment: () => void;
38
+ decrement: () => void;
39
+ complete: () => void;
40
+ cleanup: () => void;
41
+ };
42
+ export declare const startNavigationProgress: () => void, stopNavigationProgress: () => void, resetNavigationProgress: () => void, setNavigationProgress: (value: number) => void, incrementNavigationProgress: () => void, decrementNavigationProgress: () => void, completeNavigationProgress: () => void, cleanupNavigationProgress: () => void;
43
+ //# sourceMappingURL=nprogress.store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nprogress.store.d.ts","sourceRoot":"","sources":["../src/nprogress.store.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAoBrE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAE1D,eAAO,MAAM,oBAAoB,oCAQ7B,CAAC;AAEL,eAAO,MAAM,YAAY,2CAA6C,CAAC;AAEvE,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,cAAc,CAAC,EAC1D,KAAK,EAAE,cAAc,QAItB;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,cAAc,QAKtE;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,QAK/E;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,cAAc,QAMpE;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,cAAc,QAcrE;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,cAAc,QAkBlE;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,cAAc,QAKjE;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,cAAc,QAIlE;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,cAAc,QAuBtE;AAED,wBAAgB,eAAe;;;;iBAMd,MAAM;;;;;GAQtB;AAED,eAAO,MAAO,cAAc,gCAAE,SAAS;;;;iBAVtB,MAAM;;;;;CAUqC,CAAC;AAC7D,eAAO,MACE,uBAAuB,cACxB,sBAAsB,cACrB,uBAAuB,cACzB,qBAAqB,UAfX,MAAM,WAgBV,2BAA2B,cAC3B,2BAA2B,cAC5B,0BAA0B,cAC3B,yBAAyB,YACvB,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,21 @@
1
1
  {
2
2
  "name": "@mantine/nprogress",
3
3
  "description": "Navigation progress bar",
4
- "version": "6.0.17",
5
- "main": "cjs/index.js",
6
- "module": "esm/index.js",
7
- "types": "lib/index.d.ts",
4
+ "version": "7.0.0-alpha.21",
5
+ "types": "./lib/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./esm/index.js",
9
+ "require": "./cjs/index.js",
10
+ "types": "./lib/index.d.ts"
11
+ },
12
+ "./styles.css": "./esm/index.css"
13
+ },
8
14
  "license": "MIT",
9
15
  "author": "Vitaly Rtishchev <rtivital@gmail.com>",
10
- "sideEffects": false,
16
+ "sideEffects": [
17
+ "*.css"
18
+ ],
11
19
  "homepage": "https://mantine.dev/others/nprogress/",
12
20
  "repository": {
13
21
  "url": "https://github.com/mantinedev/mantine.git",
@@ -15,13 +23,13 @@
15
23
  "directory": "src/mantine-nprogress"
16
24
  },
17
25
  "peerDependencies": {
18
- "@mantine/core": "6.0.17",
19
- "@mantine/hooks": "6.0.17",
20
- "react": ">=16.8.0",
21
- "react-dom": ">=16.8.0"
26
+ "@mantine/core": "7.0.0-alpha.21",
27
+ "@mantine/hooks": "7.0.0-alpha.21",
28
+ "react": "^18.2.0",
29
+ "react-dom": "^18.2.0"
22
30
  },
23
31
  "dependencies": {
24
- "@mantine/utils": "6.0.17"
32
+ "@mantine/store": "7.0.0-alpha.21"
25
33
  },
26
34
  "devDependencies": {}
27
35
  }