@pallasoft/ps-core-components 2.2.0 → 2.3.1
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-button.js +5 -5
- 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
|
@@ -10,11 +10,11 @@ const sizeClassNames = {
|
|
|
10
10
|
large: 'min-h-11 px-5 py-3 text-sm',
|
|
11
11
|
};
|
|
12
12
|
const variantClassNames = {
|
|
13
|
-
danger: 'border-danger bg-danger text-white hover:opacity-90',
|
|
14
|
-
ghost: 'border-transparent bg-transparent text-ink/60 hover:text-ink',
|
|
15
|
-
primary: 'border-primary bg-primary text-[color:var(--ps-color-primary-contrast)] hover:border-primary-dark hover:bg-primary-dark',
|
|
16
|
-
secondary: 'ps-liquid ps-liquid-control bg-white/72 text-ink hover:border-primary/30 hover:text-primary dark:border-white/16 dark:bg-white/12 dark:hover:text-white',
|
|
17
|
-
surface: 'ps-liquid ps-liquid-control bg-white/72 text-ink hover:border-primary/30 dark:border-white/16 dark:bg-white/12',
|
|
13
|
+
danger: 'border-danger bg-danger text-white enabled:hover:opacity-90',
|
|
14
|
+
ghost: 'border-transparent bg-transparent text-ink/60 enabled:hover:text-ink',
|
|
15
|
+
primary: 'border-primary bg-primary text-[color:var(--ps-color-primary-contrast)] enabled:hover:border-primary-dark enabled:hover:bg-primary-dark',
|
|
16
|
+
secondary: 'ps-liquid ps-liquid-control bg-white/72 text-ink enabled:hover:border-primary/30 enabled:hover:text-primary dark:border-white/16 dark:bg-white/12 dark:enabled:hover:text-white',
|
|
17
|
+
surface: 'ps-liquid ps-liquid-control bg-white/72 text-ink enabled:hover:border-primary/30 dark:border-white/16 dark:bg-white/12',
|
|
18
18
|
};
|
|
19
19
|
const PsButton = ({ children, className, disabled, isLoading = false, leadingIcon, loadingLabel, size = 'default', trailingIcon, type = 'button', variant = 'secondary', ...props }) => ((0, jsx_runtime_1.jsxs)("button", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring relative inline-flex max-w-full items-center justify-center gap-2 rounded-full border text-center font-semibold disabled:cursor-not-allowed disabled:opacity-50', sizeClassNames[size], variantClassNames[variant], className), "aria-busy": isLoading || undefined, disabled: disabled || isLoading, type: type, ...props, children: [isLoading ? ((0, jsx_runtime_1.jsx)(ps_spinner_1.PsSpinner, { className: 'absolute inset-0 m-auto', color: 'current', label: loadingLabel !== null && loadingLabel !== undefined ? loadingLabel : 'Loading', size: 'small' })) : null, (0, jsx_runtime_1.jsxs)("span", { "aria-hidden": isLoading || undefined, className: ps_design_system_1.PallasoftClassNameService.merge('inline-flex min-w-0 items-center gap-2', isLoading ? 'invisible' : ''), children: [leadingIcon ? (0, jsx_runtime_1.jsx)("span", { className: 'shrink-0', children: leadingIcon }) : null, (0, jsx_runtime_1.jsx)("span", { className: 'truncate', children: children }), trailingIcon ? (0, jsx_runtime_1.jsx)("span", { className: 'shrink-0', children: trailingIcon }) : null] })] }));
|
|
20
20
|
exports.PsButton = PsButton;
|
|
@@ -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.1",
|
|
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"
|