@sudobility/building_blocks 0.0.145 → 0.0.147
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/layout/app-page-layout.d.ts +15 -15
- package/dist/components/layout/index.d.ts +1 -1
- package/dist/index.js +25 -18
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +12 -3
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
-
import { type VariantProps } from 'class-variance-authority';
|
|
3
2
|
import { type AppBreadcrumbsProps } from '../breadcrumbs/app-breadcrumbs';
|
|
4
3
|
import { type AppTopBarProps } from '../topbar/app-topbar';
|
|
5
4
|
import { type AppTopBarWithFirebaseAuthProps } from '../topbar/app-topbar-with-firebase-auth';
|
|
@@ -7,9 +6,6 @@ import { type AppTopBarWithWalletProps } from '../topbar/app-topbar-with-wallet'
|
|
|
7
6
|
import { type AppFooterProps } from '../footer/app-footer';
|
|
8
7
|
import { type AppFooterForHomePageProps } from '../footer/app-footer-for-home-page';
|
|
9
8
|
import type { MaxWidth, ContentPadding, BackgroundVariant } from '../../types';
|
|
10
|
-
declare const layoutVariants: (props?: ({
|
|
11
|
-
background?: "default" | "white" | "gradient" | null | undefined;
|
|
12
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
9
|
/** Discriminated union for selecting which TopBar component to render. */
|
|
14
10
|
export type TopBarConfig = ({
|
|
15
11
|
variant: 'base';
|
|
@@ -27,15 +23,8 @@ export type FooterConfig = ({
|
|
|
27
23
|
} & AppFooterProps) | ({
|
|
28
24
|
variant: 'full';
|
|
29
25
|
} & AppFooterForHomePageProps);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
children: ReactNode;
|
|
33
|
-
/** TopBar configuration - selects which TopBar component to render */
|
|
34
|
-
topBar: TopBarConfig;
|
|
35
|
-
/** Breadcrumbs configuration (optional) */
|
|
36
|
-
breadcrumbs?: AppBreadcrumbsProps;
|
|
37
|
-
/** Footer configuration - selects which Footer component to render */
|
|
38
|
-
footer?: FooterConfig;
|
|
26
|
+
/** Page-level layout and styling options. */
|
|
27
|
+
export interface AppPageProps {
|
|
39
28
|
/** Max width for content area (default: '7xl') */
|
|
40
29
|
maxWidth?: MaxWidth;
|
|
41
30
|
/** Content padding (default: 'md') */
|
|
@@ -53,6 +42,18 @@ export interface AppPageLayoutProps extends VariantProps<typeof layoutVariants>
|
|
|
53
42
|
/** Optional aspect ratio (width / height) for content area. When set, children are placed inside a container with fixed aspect ratio using AspectFit behavior. */
|
|
54
43
|
aspectRatio?: number;
|
|
55
44
|
}
|
|
45
|
+
export interface AppPageLayoutProps {
|
|
46
|
+
/** Page content */
|
|
47
|
+
children: ReactNode;
|
|
48
|
+
/** TopBar configuration - selects which TopBar component to render */
|
|
49
|
+
topBar: TopBarConfig;
|
|
50
|
+
/** Breadcrumbs configuration (optional) */
|
|
51
|
+
breadcrumbs?: AppBreadcrumbsProps;
|
|
52
|
+
/** Footer configuration - selects which Footer component to render */
|
|
53
|
+
footer?: FooterConfig;
|
|
54
|
+
/** Page-level layout and styling options */
|
|
55
|
+
page?: AppPageProps;
|
|
56
|
+
}
|
|
56
57
|
/**
|
|
57
58
|
* AppPageLayout - Layout wrapper combining TopBar, Breadcrumbs, Content, and Footer.
|
|
58
59
|
*
|
|
@@ -84,8 +85,7 @@ export interface AppPageLayoutProps extends VariantProps<typeof layoutVariants>
|
|
|
84
85
|
* companyName: 'My Company',
|
|
85
86
|
* links: [{ label: 'Privacy', href: '/privacy' }],
|
|
86
87
|
* }}
|
|
87
|
-
* maxWidth
|
|
88
|
-
* background="default"
|
|
88
|
+
* page={{ maxWidth: '7xl', background: 'default' }}
|
|
89
89
|
* >
|
|
90
90
|
* <h1>Page Content</h1>
|
|
91
91
|
* </AppPageLayout>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AppPageLayout, type AppPageLayoutProps, type TopBarConfig, type FooterConfig, } from './app-page-layout';
|
|
1
|
+
export { AppPageLayout, type AppPageLayoutProps, type AppPageProps, type TopBarConfig, type FooterConfig, } from './app-page-layout';
|
package/dist/index.js
CHANGED
|
@@ -252,16 +252,20 @@ const AppTopBar = ({
|
|
|
252
252
|
() => menuItems.filter((item) => item.show !== false),
|
|
253
253
|
[menuItems]
|
|
254
254
|
);
|
|
255
|
-
const navItems = useMemo(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
255
|
+
const navItems = useMemo(() => {
|
|
256
|
+
const mapItem = (item) => {
|
|
257
|
+
var _a;
|
|
258
|
+
return {
|
|
259
|
+
id: item.id,
|
|
260
|
+
label: item.label,
|
|
261
|
+
icon: item.icon,
|
|
262
|
+
href: item.href,
|
|
263
|
+
className: item.className,
|
|
264
|
+
children: (_a = item.children) == null ? void 0 : _a.filter((child) => child.show !== false).map(mapItem)
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
return visibleMenuItems.map(mapItem);
|
|
268
|
+
}, [visibleMenuItems]);
|
|
265
269
|
const LinkWrapper = useMemo(
|
|
266
270
|
() => ({ href, className: className2, children }) => /* @__PURE__ */ jsx(LinkComponent, { href, className: className2, children }),
|
|
267
271
|
[LinkComponent]
|
|
@@ -1108,15 +1112,18 @@ const AppPageLayout = ({
|
|
|
1108
1112
|
topBar,
|
|
1109
1113
|
breadcrumbs,
|
|
1110
1114
|
footer,
|
|
1111
|
-
|
|
1112
|
-
contentPadding = "md",
|
|
1113
|
-
background = "default",
|
|
1114
|
-
layoutMode = "standard",
|
|
1115
|
-
className,
|
|
1116
|
-
contentClassName,
|
|
1117
|
-
mainClassName,
|
|
1118
|
-
aspectRatio
|
|
1115
|
+
page
|
|
1119
1116
|
}) => {
|
|
1117
|
+
const {
|
|
1118
|
+
maxWidth = "7xl",
|
|
1119
|
+
contentPadding = "md",
|
|
1120
|
+
background = "default",
|
|
1121
|
+
layoutMode = "standard",
|
|
1122
|
+
className,
|
|
1123
|
+
contentClassName,
|
|
1124
|
+
mainClassName,
|
|
1125
|
+
aspectRatio
|
|
1126
|
+
} = page ?? {};
|
|
1120
1127
|
const isCompactFooter = (footer == null ? void 0 : footer.variant) === "compact";
|
|
1121
1128
|
const content = aspectRatio ? /* @__PURE__ */ jsx(AspectFitView, { aspectRatio, children }) : children;
|
|
1122
1129
|
return /* @__PURE__ */ jsx(LayoutProvider, { mode: layoutMode, children: /* @__PURE__ */ jsxs("div", { className: cn(layoutVariants({ background }), className), children: [
|