@pallasoft/ps-core-components 2.1.1 → 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-layer.d.ts +6 -0
- package/dist/components/ps-layer.js +7 -0
- package/dist/components/ps-navigation-progress.d.ts +4 -3
- package/dist/components/ps-navigation-progress.js +29 -5
- package/dist/components/ps-spinner.d.ts +0 -1
- package/dist/constants/ps-navigation-progress-config.d.ts +7 -0
- package/dist/constants/ps-navigation-progress-config.js +10 -0
- package/dist/contexts/ps-layer-context.d.ts +1 -0
- package/dist/contexts/ps-layer-context.js +5 -0
- package/dist/hooks/use-ps-layer-z-index.d.ts +2 -0
- package/dist/hooks/use-ps-layer-z-index.js +8 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +3 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsLayer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ps_layer_context_1 = require("../contexts/ps-layer-context");
|
|
6
|
+
const PsLayer = ({ children, zIndex }) => ((0, jsx_runtime_1.jsx)(ps_layer_context_1.PsLayerContext.Provider, { value: zIndex, children: children }));
|
|
7
|
+
exports.PsLayer = PsLayer;
|
|
@@ -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;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
2
|
export interface PsSpinnerProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
/** `current` follows the surrounding text colour, for spinners inside buttons. */
|
|
4
3
|
color?: 'current' | 'primary';
|
|
5
4
|
label?: string;
|
|
6
5
|
size?: 'default' | 'large' | 'small';
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PsLayerContext: import("react").Context<number | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePsLayerZIndex = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
6
|
+
const ps_layer_context_1 = require("../contexts/ps-layer-context");
|
|
7
|
+
const usePsLayerZIndex = (layer) => ps_design_system_1.PallasoftZIndexService.above((0, react_1.useContext)(ps_layer_context_1.PsLayerContext), layer);
|
|
8
|
+
exports.usePsLayerZIndex = usePsLayerZIndex;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './components/ps-layer';
|
|
1
2
|
export * from './components/ps-accordion';
|
|
2
3
|
export * from './components/ps-action-tile';
|
|
3
4
|
export * from './components/ps-audio-spectrum';
|
|
@@ -24,7 +25,10 @@ export * from './hooks/use-ps-audio-spectrum';
|
|
|
24
25
|
export * from './hooks/use-ps-exit-transition';
|
|
25
26
|
export * from './hooks/use-ps-hide-on-scroll';
|
|
26
27
|
export * from './hooks/use-ps-invisible-recaptcha';
|
|
28
|
+
export * from './contexts/ps-layer-context';
|
|
29
|
+
export * from './hooks/use-ps-layer-z-index';
|
|
27
30
|
export * from './hooks/use-ps-route-loader-data';
|
|
28
31
|
export * from './hooks/use-ps-viewport';
|
|
29
32
|
export * from './interfaces/ps-component-props';
|
|
30
33
|
export * from './models/ps-voice-orb';
|
|
34
|
+
export * from './constants/ps-navigation-progress-config';
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components/ps-layer"), exports);
|
|
17
18
|
__exportStar(require("./components/ps-accordion"), exports);
|
|
18
19
|
__exportStar(require("./components/ps-action-tile"), exports);
|
|
19
20
|
__exportStar(require("./components/ps-audio-spectrum"), exports);
|
|
@@ -40,7 +41,10 @@ __exportStar(require("./hooks/use-ps-audio-spectrum"), exports);
|
|
|
40
41
|
__exportStar(require("./hooks/use-ps-exit-transition"), exports);
|
|
41
42
|
__exportStar(require("./hooks/use-ps-hide-on-scroll"), exports);
|
|
42
43
|
__exportStar(require("./hooks/use-ps-invisible-recaptcha"), exports);
|
|
44
|
+
__exportStar(require("./contexts/ps-layer-context"), exports);
|
|
45
|
+
__exportStar(require("./hooks/use-ps-layer-z-index"), exports);
|
|
43
46
|
__exportStar(require("./hooks/use-ps-route-loader-data"), exports);
|
|
44
47
|
__exportStar(require("./hooks/use-ps-viewport"), exports);
|
|
45
48
|
__exportStar(require("./interfaces/ps-component-props"), exports);
|
|
46
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",
|
|
@@ -28,13 +28,12 @@
|
|
|
28
28
|
"release": "semantic-release"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@pallasoft/ps-design-system": "^1.
|
|
31
|
+
"@pallasoft/ps-design-system": "^1.3.0",
|
|
32
32
|
"@pallasoft/ps-icons": "^1.1.0",
|
|
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"
|