@pallasoft/ps-core-components 2.2.0 → 2.3.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/dist/components/ps-navigation-progress.d.ts +4 -3
- package/dist/components/ps-navigation-progress.js +29 -5
- package/dist/constants/ps-navigation-progress-config.d.ts +7 -0
- package/dist/constants/ps-navigation-progress-config.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -3
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export interface PsNavigationProgressProps {
|
|
2
|
-
|
|
2
|
+
className?: string;
|
|
3
|
+
color?: string;
|
|
3
4
|
height?: number;
|
|
4
|
-
|
|
5
|
+
label?: string;
|
|
5
6
|
progress: number;
|
|
6
7
|
shadow?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare const PsNavigationProgress: ({ color, height,
|
|
9
|
+
export declare const PsNavigationProgress: ({ className, color, height, label, progress, shadow, }: PsNavigationProgressProps) => import("react").JSX.Element;
|
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.PsNavigationProgress = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
7
|
+
const ps_navigation_progress_config_1 = require("../constants/ps-navigation-progress-config");
|
|
8
|
+
const PsNavigationProgress = ({ className, color = ps_navigation_progress_config_1.PsNavigationProgressConfig.defaultColor, height = ps_navigation_progress_config_1.PsNavigationProgressConfig.defaultHeight, label = ps_navigation_progress_config_1.PsNavigationProgressConfig.defaultLabel, progress, shadow = true, }) => {
|
|
9
|
+
const [isVisible, setIsVisible] = (0, react_1.useState)(false);
|
|
10
|
+
const hideTimer = (0, react_1.useRef)(null);
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
12
|
+
if (typeof window === 'undefined')
|
|
13
|
+
return;
|
|
14
|
+
if (hideTimer.current !== null)
|
|
15
|
+
window.clearTimeout(hideTimer.current);
|
|
16
|
+
if (progress > 0 && progress < 100) {
|
|
17
|
+
setIsVisible(true);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
hideTimer.current = window.setTimeout(() => setIsVisible(false), ps_navigation_progress_config_1.PsNavigationProgressConfig.fadeMs);
|
|
21
|
+
return () => {
|
|
22
|
+
if (hideTimer.current !== null)
|
|
23
|
+
window.clearTimeout(hideTimer.current);
|
|
24
|
+
};
|
|
25
|
+
}, [progress]);
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("div", { "aria-hidden": isVisible ? undefined : 'true', "aria-label": label, "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": Math.round(progress), className: ps_design_system_1.PallasoftClassNameService.merge('pointer-events-none fixed inset-x-0 top-0', className), role: 'progressbar', style: { height, zIndex: ps_design_system_1.PallasoftZIndex.Toast }, children: (0, jsx_runtime_1.jsx)("div", { className: 'h-full origin-left transition-[width,opacity] ease-out', style: {
|
|
27
|
+
backgroundColor: color,
|
|
28
|
+
boxShadow: shadow ? `0 0 10px ${color}, 0 0 5px ${color}` : undefined,
|
|
29
|
+
opacity: isVisible ? 1 : 0,
|
|
30
|
+
transitionDuration: `${ps_navigation_progress_config_1.PsNavigationProgressConfig.transitionMs}ms`,
|
|
31
|
+
width: `${Math.min(Math.max(progress, 0), 100)}%`,
|
|
32
|
+
} }) }));
|
|
33
|
+
};
|
|
10
34
|
exports.PsNavigationProgress = PsNavigationProgress;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsNavigationProgressConfig = void 0;
|
|
4
|
+
exports.PsNavigationProgressConfig = {
|
|
5
|
+
defaultColor: 'rgb(var(--ps-color-primary-rgb))',
|
|
6
|
+
defaultHeight: 3,
|
|
7
|
+
defaultLabel: 'Page loading',
|
|
8
|
+
fadeMs: 320,
|
|
9
|
+
transitionMs: 240,
|
|
10
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -47,3 +47,4 @@ __exportStar(require("./hooks/use-ps-route-loader-data"), exports);
|
|
|
47
47
|
__exportStar(require("./hooks/use-ps-viewport"), exports);
|
|
48
48
|
__exportStar(require("./interfaces/ps-component-props"), exports);
|
|
49
49
|
__exportStar(require("./models/ps-voice-orb"), exports);
|
|
50
|
+
__exportStar(require("./constants/ps-navigation-progress-config"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pallasoft/ps-core-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
"@portabletext/react": "^3.2.4",
|
|
34
34
|
"@portabletext/types": "^2.0.13",
|
|
35
35
|
"@radix-ui/react-accordion": "^1.2.12",
|
|
36
|
-
"react-infinite-scroll-component": "^6.1.1"
|
|
37
|
-
"react-top-loading-bar": "^3.0.2"
|
|
36
|
+
"react-infinite-scroll-component": "^6.1.1"
|
|
38
37
|
},
|
|
39
38
|
"peerDependencies": {
|
|
40
39
|
"react": "^18 || ^19"
|