UNPKG

@mantine/nprogress

Version:
47 lines (44 loc) 1.31 kB
'use client'; import { jsx } from 'react/jsx-runtime'; import { useEffect } from 'react'; import { OptionalPortal, Progress, getDefaultZIndex } from '@mantine/core'; import { nprogressStore, useNprogress, resetNavigationProgressAction } from './nprogress.store.mjs'; import classes from './NavigationProgress.module.css.mjs'; function NavigationProgress({ initialProgress = 0, color, size = 3, stepInterval = 500, withinPortal = true, portalProps, zIndex = getDefaultZIndex("max"), store = nprogressStore, ...others }) { store.initialize({ mounted: false, progress: initialProgress, interval: -1, step: 1, stepInterval, timeouts: [] }); const state = useNprogress(store); useEffect(() => () => resetNavigationProgressAction(store), [store]); return /* @__PURE__ */ jsx(OptionalPortal, { ...portalProps, withinPortal, children: /* @__PURE__ */ jsx( Progress, { radius: 0, value: state.progress, size, color, classNames: classes, "data-mounted": state.mounted || void 0, __vars: { "--nprogress-z-index": zIndex?.toString() }, ...others } ) }); } NavigationProgress.displayName = "@mantine/nprogress/NavigationProgress"; export { NavigationProgress }; //# sourceMappingURL=NavigationProgress.mjs.map