@pallasoft/ps-core-components 2.35.2 → 2.36.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-page-skeleton.d.ts +2 -1
- package/dist/components/ps-page-skeleton.js +1 -1
- package/dist/esm/components/ps-page-skeleton.js +1 -1
- package/dist/esm/hooks/use-ps-tab-channel.js +21 -0
- package/dist/esm/index.js +1 -0
- package/dist/hooks/use-ps-tab-channel.d.ts +1 -0
- package/dist/hooks/use-ps-tab-channel.js +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
export interface PsPageSkeletonProps {
|
|
3
|
+
actions?: ReactNode;
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
hasActions?: boolean;
|
|
5
6
|
isNarrow?: boolean;
|
|
6
7
|
loadingLabel: string;
|
|
7
8
|
title?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare const PsPageSkeleton: ({ children, hasActions, isNarrow, loadingLabel, title, }: PsPageSkeletonProps) => import("react").JSX.Element;
|
|
10
|
+
export declare const PsPageSkeleton: ({ actions, children, hasActions, isNarrow, loadingLabel, title, }: PsPageSkeletonProps) => import("react").JSX.Element;
|
|
@@ -8,5 +8,5 @@ const ps_page_layout_1 = require("./ps-page-layout");
|
|
|
8
8
|
const ps_page_stack_1 = require("./ps-page-stack");
|
|
9
9
|
const ps_section_header_1 = require("./ps-section-header");
|
|
10
10
|
const ps_skeleton_1 = require("./ps-skeleton");
|
|
11
|
-
const PsPageSkeleton = ({ children, hasActions = false, isNarrow = false, loadingLabel, title, }) => ((0, jsx_runtime_1.jsx)(ps_page_layout_1.PsPageLayout, { isNarrow: isNarrow, children: (0, jsx_runtime_1.jsxs)(ps_page_stack_1.PsPageStack, { children: [title === undefined ? ((0, jsx_runtime_1.jsx)(ps_section_header_1.PsSectionHeader, { isLoading: true, title: loadingLabel, trailing: hasActions })) : ((0, jsx_runtime_1.jsx)(ps_page_header_1.PsPageHeader, { actions: hasActions ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { shape: ps_skeleton_shape_1.PsSkeletonShape.Button }) : undefined, title: title })), children] }) }));
|
|
11
|
+
const PsPageSkeleton = ({ actions, children, hasActions = false, isNarrow = false, loadingLabel, title, }) => ((0, jsx_runtime_1.jsx)(ps_page_layout_1.PsPageLayout, { isNarrow: isNarrow, children: (0, jsx_runtime_1.jsxs)(ps_page_stack_1.PsPageStack, { children: [title === undefined ? ((0, jsx_runtime_1.jsx)(ps_section_header_1.PsSectionHeader, { isLoading: true, title: loadingLabel, trailing: hasActions })) : ((0, jsx_runtime_1.jsx)(ps_page_header_1.PsPageHeader, { actions: actions !== undefined ? (actions) : hasActions ? ((0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { shape: ps_skeleton_shape_1.PsSkeletonShape.Button })) : undefined, title: title })), children] }) }));
|
|
12
12
|
exports.PsPageSkeleton = PsPageSkeleton;
|
|
@@ -5,4 +5,4 @@ import { PsPageLayout } from './ps-page-layout.js';
|
|
|
5
5
|
import { PsPageStack } from './ps-page-stack.js';
|
|
6
6
|
import { PsSectionHeader } from './ps-section-header.js';
|
|
7
7
|
import { PsSkeleton } from './ps-skeleton.js';
|
|
8
|
-
export const PsPageSkeleton = ({ children, hasActions = false, isNarrow = false, loadingLabel, title, }) => (_jsx(PsPageLayout, { isNarrow: isNarrow, children: _jsxs(PsPageStack, { children: [title === undefined ? (_jsx(PsSectionHeader, { isLoading: true, title: loadingLabel, trailing: hasActions })) : (_jsx(PsPageHeader, { actions: hasActions ? _jsx(PsSkeleton, { shape: PsSkeletonShape.Button }) : undefined, title: title })), children] }) }));
|
|
8
|
+
export const PsPageSkeleton = ({ actions, children, hasActions = false, isNarrow = false, loadingLabel, title, }) => (_jsx(PsPageLayout, { isNarrow: isNarrow, children: _jsxs(PsPageStack, { children: [title === undefined ? (_jsx(PsSectionHeader, { isLoading: true, title: loadingLabel, trailing: hasActions })) : (_jsx(PsPageHeader, { actions: actions !== undefined ? (actions) : hasActions ? (_jsx(PsSkeleton, { shape: PsSkeletonShape.Button })) : undefined, title: title })), children] }) }));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
export const usePsTabChannel = (name, onMessage) => {
|
|
3
|
+
const channel = useRef(null);
|
|
4
|
+
const latest = useRef(onMessage);
|
|
5
|
+
latest.current = onMessage;
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (typeof BroadcastChannel === 'undefined')
|
|
8
|
+
return;
|
|
9
|
+
const opened = new BroadcastChannel(name);
|
|
10
|
+
opened.onmessage = (event) => latest.current(event.data);
|
|
11
|
+
channel.current = opened;
|
|
12
|
+
return () => {
|
|
13
|
+
channel.current = null;
|
|
14
|
+
opened.close();
|
|
15
|
+
};
|
|
16
|
+
}, [name]);
|
|
17
|
+
return useCallback((message) => {
|
|
18
|
+
if (channel.current !== null)
|
|
19
|
+
channel.current.postMessage(message);
|
|
20
|
+
}, []);
|
|
21
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -58,6 +58,7 @@ export * from './hooks/use-ps-audio-spectrum.js';
|
|
|
58
58
|
export * from './hooks/use-ps-exit-snapshot.js';
|
|
59
59
|
export * from './hooks/use-ps-exit-transition.js';
|
|
60
60
|
export * from './hooks/use-ps-restore-focus.js';
|
|
61
|
+
export * from './hooks/use-ps-tab-channel.js';
|
|
61
62
|
export * from './hooks/use-ps-scroll-lock.js';
|
|
62
63
|
export * from './hooks/use-ps-hide-on-scroll.js';
|
|
63
64
|
export * from './hooks/use-ps-invisible-recaptcha.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePsTabChannel: <Message>(name: string, onMessage: (message: Message) => void) => ((message: Message) => void);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePsTabChannel = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const usePsTabChannel = (name, onMessage) => {
|
|
6
|
+
const channel = (0, react_1.useRef)(null);
|
|
7
|
+
const latest = (0, react_1.useRef)(onMessage);
|
|
8
|
+
latest.current = onMessage;
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
if (typeof BroadcastChannel === 'undefined')
|
|
11
|
+
return;
|
|
12
|
+
const opened = new BroadcastChannel(name);
|
|
13
|
+
opened.onmessage = (event) => latest.current(event.data);
|
|
14
|
+
channel.current = opened;
|
|
15
|
+
return () => {
|
|
16
|
+
channel.current = null;
|
|
17
|
+
opened.close();
|
|
18
|
+
};
|
|
19
|
+
}, [name]);
|
|
20
|
+
return (0, react_1.useCallback)((message) => {
|
|
21
|
+
if (channel.current !== null)
|
|
22
|
+
channel.current.postMessage(message);
|
|
23
|
+
}, []);
|
|
24
|
+
};
|
|
25
|
+
exports.usePsTabChannel = usePsTabChannel;
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export * from './hooks/use-ps-audio-spectrum';
|
|
|
58
58
|
export * from './hooks/use-ps-exit-snapshot';
|
|
59
59
|
export * from './hooks/use-ps-exit-transition';
|
|
60
60
|
export * from './hooks/use-ps-restore-focus';
|
|
61
|
+
export * from './hooks/use-ps-tab-channel';
|
|
61
62
|
export * from './hooks/use-ps-scroll-lock';
|
|
62
63
|
export * from './hooks/use-ps-hide-on-scroll';
|
|
63
64
|
export * from './hooks/use-ps-invisible-recaptcha';
|
package/dist/index.js
CHANGED
|
@@ -74,6 +74,7 @@ __exportStar(require("./hooks/use-ps-audio-spectrum"), exports);
|
|
|
74
74
|
__exportStar(require("./hooks/use-ps-exit-snapshot"), exports);
|
|
75
75
|
__exportStar(require("./hooks/use-ps-exit-transition"), exports);
|
|
76
76
|
__exportStar(require("./hooks/use-ps-restore-focus"), exports);
|
|
77
|
+
__exportStar(require("./hooks/use-ps-tab-channel"), exports);
|
|
77
78
|
__exportStar(require("./hooks/use-ps-scroll-lock"), exports);
|
|
78
79
|
__exportStar(require("./hooks/use-ps-hide-on-scroll"), exports);
|
|
79
80
|
__exportStar(require("./hooks/use-ps-invisible-recaptcha"), exports);
|