@pallasoft/ps-core-components 1.0.0 → 1.1.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.
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ElementType, ReactNode } from 'react';
|
|
2
|
+
export interface PsSiteHeaderProps {
|
|
3
|
+
centerContent?: ReactNode;
|
|
4
|
+
homeHref: string;
|
|
5
|
+
label: string;
|
|
6
|
+
LinkComponent?: ElementType;
|
|
7
|
+
logoAlt?: string;
|
|
8
|
+
logoClassName?: string;
|
|
9
|
+
logoSrc: string;
|
|
10
|
+
onBack?: () => void;
|
|
11
|
+
showLabel?: boolean;
|
|
12
|
+
trailing?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const PsSiteHeader: ({ centerContent, homeHref, label, LinkComponent, logoAlt, logoClassName, logoSrc, onBack, showLabel, trailing, }: PsSiteHeaderProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsSiteHeader = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
6
|
+
const ps_icons_1 = require("@pallasoft/ps-icons");
|
|
7
|
+
const logoLinkClassName = 'flex shrink-0 items-center gap-2.5';
|
|
8
|
+
const PsSiteHeader = ({ centerContent, homeHref, label, LinkComponent, logoAlt, logoClassName, logoSrc, onBack, showLabel = false, trailing, }) => {
|
|
9
|
+
const logoLabel = `${label} home`;
|
|
10
|
+
const logoContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { alt: logoAlt ?? label, className: ps_design_system_1.PallasoftClassNameService.merge('h-8 w-auto', logoClassName), src: logoSrc }), showLabel ? (0, jsx_runtime_1.jsx)("span", { className: 'text-base font-bold text-ink', children: label }) : null] }));
|
|
11
|
+
const logoLink = LinkComponent ? ((0, jsx_runtime_1.jsx)(LinkComponent, { "aria-label": logoLabel, className: logoLinkClassName, to: homeHref, children: logoContent })) : ((0, jsx_runtime_1.jsx)("a", { "aria-label": logoLabel, className: logoLinkClassName, href: homeHref, children: logoContent }));
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("header", { className: 'fixed inset-x-0 top-0 z-header px-6 pt-4', children: (0, jsx_runtime_1.jsxs)("nav", { className: 'ps-glass mx-auto flex max-w-6xl items-center gap-3 rounded-ps-card px-5 py-3', children: [onBack ? ((0, jsx_runtime_1.jsx)("button", { "aria-label": 'Back', className: 'ps-focus-ring flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-ink md:hidden', onClick: onBack, type: 'button', children: (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { iconKey: ps_icons_1.PsIconKey.ChevronRight, width: 20, height: 20, className: 'rotate-180' }) })) : null, (0, jsx_runtime_1.jsx)("div", { className: onBack ? 'hidden md:flex' : 'contents', children: logoLink }), (0, jsx_runtime_1.jsx)("div", { className: 'flex min-w-0 flex-1 items-center justify-center gap-3', children: centerContent }), trailing ? (0, jsx_runtime_1.jsx)("div", { className: 'flex shrink-0 items-center gap-2.5', children: trailing }) : null] }) }));
|
|
13
|
+
};
|
|
14
|
+
exports.PsSiteHeader = PsSiteHeader;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './components/ps-metric-card';
|
|
|
13
13
|
export * from './components/ps-pill';
|
|
14
14
|
export * from './components/ps-reflective-app-shell';
|
|
15
15
|
export * from './components/ps-section-header';
|
|
16
|
+
export * from './components/ps-site-header';
|
|
16
17
|
export * from './components/ps-skeleton';
|
|
17
18
|
export * from './components/ps-spinner';
|
|
18
19
|
export * from './components/ps-theme-toggle';
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ __exportStar(require("./components/ps-metric-card"), exports);
|
|
|
29
29
|
__exportStar(require("./components/ps-pill"), exports);
|
|
30
30
|
__exportStar(require("./components/ps-reflective-app-shell"), exports);
|
|
31
31
|
__exportStar(require("./components/ps-section-header"), exports);
|
|
32
|
+
__exportStar(require("./components/ps-site-header"), exports);
|
|
32
33
|
__exportStar(require("./components/ps-skeleton"), exports);
|
|
33
34
|
__exportStar(require("./components/ps-spinner"), exports);
|
|
34
35
|
__exportStar(require("./components/ps-theme-toggle"), exports);
|