@mantine/nprogress
Version:
Navigation progress bar
49 lines (45 loc) • 1.39 kB
JavaScript
'use client';
;
var jsxRuntime = require('react/jsx-runtime');
var react = require('react');
var core = require('@mantine/core');
var nprogress_store = require('./nprogress.store.cjs');
var NavigationProgress_module = require('./NavigationProgress.module.css.cjs');
function NavigationProgress({
initialProgress = 0,
color,
size = 3,
stepInterval = 500,
withinPortal = true,
portalProps,
zIndex = core.getDefaultZIndex("max"),
store = nprogress_store.nprogressStore,
...others
}) {
store.initialize({
mounted: false,
progress: initialProgress,
interval: -1,
step: 1,
stepInterval,
timeouts: []
});
const state = nprogress_store.useNprogress(store);
react.useEffect(() => () => nprogress_store.resetNavigationProgressAction(store), [store]);
return /* @__PURE__ */ jsxRuntime.jsx(core.OptionalPortal, { ...portalProps, withinPortal, children: /* @__PURE__ */ jsxRuntime.jsx(
core.Progress,
{
radius: 0,
value: state.progress,
size,
color,
classNames: NavigationProgress_module,
"data-mounted": state.mounted || void 0,
__vars: { "--nprogress-z-index": zIndex?.toString() },
...others
}
) });
}
NavigationProgress.displayName = "@mantine/nprogress/NavigationProgress";
exports.NavigationProgress = NavigationProgress;
//# sourceMappingURL=NavigationProgress.cjs.map