@matteoaliano/forest-ui 1.0.0 → 1.1.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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Theme } from '@mui/material/styles';
2
+ import { Theme, SxProps } from '@mui/material/styles';
3
3
  export { useColorScheme } from '@mui/material/styles';
4
4
  import * as _mui_material from '@mui/material';
5
5
  import { BoxProps } from '@mui/material';
@@ -369,6 +369,78 @@ interface SidebarItemProps extends ListItemButtonProps {
369
369
  }
370
370
  declare function SidebarItem({ icon, label, endAdornment, sx, ...rest }: SidebarItemProps): react_jsx_runtime.JSX.Element;
371
371
 
372
+ interface AppShellNavItem {
373
+ label: string;
374
+ icon: React__default.ReactNode;
375
+ active?: boolean;
376
+ href?: string;
377
+ onClick?: () => void;
378
+ /** Router escape — e.g. Next.js Link or React Router Link. */
379
+ component?: React__default.ElementType;
380
+ /** Rendered after the label when expanded (e.g. a count Chip). */
381
+ endAdornment?: React__default.ReactNode;
382
+ }
383
+ interface AppShellProps {
384
+ /** Data-driven sidebar nav. */
385
+ navItems?: AppShellNavItem[];
386
+ /** Escape hatch: full control over sidebar content. Overrides navItems. */
387
+ nav?: React__default.ReactNode;
388
+ /** Product brand passed to <Logo>. Default "studio". */
389
+ product?: LogoProduct;
390
+ /** Logomark (default) or the full wordmark logo. */
391
+ logoVariant?: "logomark" | "full";
392
+ /** Escape hatch: fully custom brand node (overrides product/logoVariant). */
393
+ brand?: React__default.ReactNode;
394
+ /** Center search: true → default <Search>; node → custom; omit → none. */
395
+ search?: React__default.ReactNode | boolean;
396
+ /** Right-side AppBar actions. The mandatory color-mode toggle is rendered
397
+ * by AppShell itself, before these. */
398
+ actions?: React__default.ReactNode;
399
+ sidebarBehavior?: "permanent" | "hover";
400
+ defaultSidebarOpen?: boolean;
401
+ /** The page content — expected to be a <Page>. */
402
+ children: React__default.ReactNode;
403
+ }
404
+ /**
405
+ * The mandatory top-level layout for authenticated Forest UI surfaces: a
406
+ * sticky AppBar (brand / search / actions + the color-mode toggle) over a
407
+ * SidebarNav and a main content area. Render a <Page> as children.
408
+ *
409
+ * Below the "sm" breakpoint the sidebar becomes a temporary overlay drawer
410
+ * opened by a hamburger button in the AppBar.
411
+ */
412
+ declare function AppShell({ navItems, nav, product, logoVariant, brand, search, actions, sidebarBehavior, defaultSidebarOpen, children, }: AppShellProps): react_jsx_runtime.JSX.Element;
413
+
414
+ interface PageBreadcrumb {
415
+ label: string;
416
+ href?: string;
417
+ onClick?: () => void;
418
+ /** Router escape — e.g. Next.js Link or React Router Link. */
419
+ component?: React__default.ElementType;
420
+ }
421
+ interface PageProps {
422
+ /** Page title. Rendered as Typography variant="h5". */
423
+ title: string;
424
+ /** Breadcrumb trail rendered above the title. Omit for pages without one. */
425
+ breadcrumbs?: PageBreadcrumb[];
426
+ /** Right-aligned header actions (e.g. a primary Button). */
427
+ actions?: React__default.ReactNode;
428
+ /** Drop the default 24px gutters for full-bleed pages. */
429
+ disableGutters?: boolean;
430
+ /** Constrain and center the content column. Default: full width. */
431
+ maxWidth?: number | string;
432
+ sx?: SxProps<Theme>;
433
+ children?: React__default.ReactNode;
434
+ }
435
+ /**
436
+ * The mandatory page-content scaffold rendered inside the App Shell's main
437
+ * slot. Owns the flat `background.paper` surface and the standard gutters, and
438
+ * renders the page header (breadcrumbs → title + actions). Everything below
439
+ * the header goes in `children` — widgets, charts, and tables belong inside
440
+ * `<Card>`s there.
441
+ */
442
+ declare function Page({ title, breadcrumbs, actions, disableGutters, maxWidth, sx, children, }: PageProps): react_jsx_runtime.JSX.Element;
443
+
372
444
  declare const Box: _mui_types.OverridableComponent<_mui_system.BoxTypeMap<{}, "div", _mui_material.Theme>>;
373
445
 
374
446
  declare const Stack: _mui_material_OverridableComponent.OverridableComponent<_mui_material.StackTypeMap<{}, "div">>;
@@ -408,4 +480,4 @@ declare function ScatterChart({ series, colors, ...props }: ScatterChartProps):
408
480
  type GaugeProps = GaugeProps$1;
409
481
  declare function Gauge(props: GaugeProps): react_jsx_runtime.JSX.Element;
410
482
 
411
- export { AppBarNavItem, type AppBarNavItemProps, BarChart, type BarChartProps, Box, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Chip, Container, DatePicker, type DatePickerProps, Drawer, Fab, type ForestCardColor, type ForestChipColor, type ForestChipProps, ForestProvider, type ForestProviderProps, Gauge, Grid, IconButton, type IconButtonProps, type IconButtonVariant, LineChart, type LineChartProps, Logo, type LogoProps, MultiSelect, type MultiSelectOption, type MultiSelectProps, Paper, PieChart, type PieChartProps, Popover, Portal, ScatterChart, Search, type SearchProps, Select, SidebarItem, type SidebarItemProps, SidebarNav, type SidebarNavProps, Stack, Switch, Tooltip, useChartColors, useSidebar };
483
+ export { AppBarNavItem, type AppBarNavItemProps, AppShell, type AppShellNavItem, type AppShellProps, BarChart, type BarChartProps, Box, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Chip, Container, DatePicker, type DatePickerProps, Drawer, Fab, type ForestCardColor, type ForestChipColor, type ForestChipProps, ForestProvider, type ForestProviderProps, Gauge, Grid, IconButton, type IconButtonProps, type IconButtonVariant, LineChart, type LineChartProps, Logo, type LogoProps, MultiSelect, type MultiSelectOption, type MultiSelectProps, Page, type PageBreadcrumb, type PageProps, Paper, PieChart, type PieChartProps, Popover, Portal, ScatterChart, Search, type SearchProps, Select, SidebarItem, type SidebarItemProps, SidebarNav, type SidebarNavProps, Stack, Switch, Tooltip, useChartColors, useSidebar };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Theme } from '@mui/material/styles';
2
+ import { Theme, SxProps } from '@mui/material/styles';
3
3
  export { useColorScheme } from '@mui/material/styles';
4
4
  import * as _mui_material from '@mui/material';
5
5
  import { BoxProps } from '@mui/material';
@@ -369,6 +369,78 @@ interface SidebarItemProps extends ListItemButtonProps {
369
369
  }
370
370
  declare function SidebarItem({ icon, label, endAdornment, sx, ...rest }: SidebarItemProps): react_jsx_runtime.JSX.Element;
371
371
 
372
+ interface AppShellNavItem {
373
+ label: string;
374
+ icon: React__default.ReactNode;
375
+ active?: boolean;
376
+ href?: string;
377
+ onClick?: () => void;
378
+ /** Router escape — e.g. Next.js Link or React Router Link. */
379
+ component?: React__default.ElementType;
380
+ /** Rendered after the label when expanded (e.g. a count Chip). */
381
+ endAdornment?: React__default.ReactNode;
382
+ }
383
+ interface AppShellProps {
384
+ /** Data-driven sidebar nav. */
385
+ navItems?: AppShellNavItem[];
386
+ /** Escape hatch: full control over sidebar content. Overrides navItems. */
387
+ nav?: React__default.ReactNode;
388
+ /** Product brand passed to <Logo>. Default "studio". */
389
+ product?: LogoProduct;
390
+ /** Logomark (default) or the full wordmark logo. */
391
+ logoVariant?: "logomark" | "full";
392
+ /** Escape hatch: fully custom brand node (overrides product/logoVariant). */
393
+ brand?: React__default.ReactNode;
394
+ /** Center search: true → default <Search>; node → custom; omit → none. */
395
+ search?: React__default.ReactNode | boolean;
396
+ /** Right-side AppBar actions. The mandatory color-mode toggle is rendered
397
+ * by AppShell itself, before these. */
398
+ actions?: React__default.ReactNode;
399
+ sidebarBehavior?: "permanent" | "hover";
400
+ defaultSidebarOpen?: boolean;
401
+ /** The page content — expected to be a <Page>. */
402
+ children: React__default.ReactNode;
403
+ }
404
+ /**
405
+ * The mandatory top-level layout for authenticated Forest UI surfaces: a
406
+ * sticky AppBar (brand / search / actions + the color-mode toggle) over a
407
+ * SidebarNav and a main content area. Render a <Page> as children.
408
+ *
409
+ * Below the "sm" breakpoint the sidebar becomes a temporary overlay drawer
410
+ * opened by a hamburger button in the AppBar.
411
+ */
412
+ declare function AppShell({ navItems, nav, product, logoVariant, brand, search, actions, sidebarBehavior, defaultSidebarOpen, children, }: AppShellProps): react_jsx_runtime.JSX.Element;
413
+
414
+ interface PageBreadcrumb {
415
+ label: string;
416
+ href?: string;
417
+ onClick?: () => void;
418
+ /** Router escape — e.g. Next.js Link or React Router Link. */
419
+ component?: React__default.ElementType;
420
+ }
421
+ interface PageProps {
422
+ /** Page title. Rendered as Typography variant="h5". */
423
+ title: string;
424
+ /** Breadcrumb trail rendered above the title. Omit for pages without one. */
425
+ breadcrumbs?: PageBreadcrumb[];
426
+ /** Right-aligned header actions (e.g. a primary Button). */
427
+ actions?: React__default.ReactNode;
428
+ /** Drop the default 24px gutters for full-bleed pages. */
429
+ disableGutters?: boolean;
430
+ /** Constrain and center the content column. Default: full width. */
431
+ maxWidth?: number | string;
432
+ sx?: SxProps<Theme>;
433
+ children?: React__default.ReactNode;
434
+ }
435
+ /**
436
+ * The mandatory page-content scaffold rendered inside the App Shell's main
437
+ * slot. Owns the flat `background.paper` surface and the standard gutters, and
438
+ * renders the page header (breadcrumbs → title + actions). Everything below
439
+ * the header goes in `children` — widgets, charts, and tables belong inside
440
+ * `<Card>`s there.
441
+ */
442
+ declare function Page({ title, breadcrumbs, actions, disableGutters, maxWidth, sx, children, }: PageProps): react_jsx_runtime.JSX.Element;
443
+
372
444
  declare const Box: _mui_types.OverridableComponent<_mui_system.BoxTypeMap<{}, "div", _mui_material.Theme>>;
373
445
 
374
446
  declare const Stack: _mui_material_OverridableComponent.OverridableComponent<_mui_material.StackTypeMap<{}, "div">>;
@@ -408,4 +480,4 @@ declare function ScatterChart({ series, colors, ...props }: ScatterChartProps):
408
480
  type GaugeProps = GaugeProps$1;
409
481
  declare function Gauge(props: GaugeProps): react_jsx_runtime.JSX.Element;
410
482
 
411
- export { AppBarNavItem, type AppBarNavItemProps, BarChart, type BarChartProps, Box, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Chip, Container, DatePicker, type DatePickerProps, Drawer, Fab, type ForestCardColor, type ForestChipColor, type ForestChipProps, ForestProvider, type ForestProviderProps, Gauge, Grid, IconButton, type IconButtonProps, type IconButtonVariant, LineChart, type LineChartProps, Logo, type LogoProps, MultiSelect, type MultiSelectOption, type MultiSelectProps, Paper, PieChart, type PieChartProps, Popover, Portal, ScatterChart, Search, type SearchProps, Select, SidebarItem, type SidebarItemProps, SidebarNav, type SidebarNavProps, Stack, Switch, Tooltip, useChartColors, useSidebar };
483
+ export { AppBarNavItem, type AppBarNavItemProps, AppShell, type AppShellNavItem, type AppShellProps, BarChart, type BarChartProps, Box, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Chip, Container, DatePicker, type DatePickerProps, Drawer, Fab, type ForestCardColor, type ForestChipColor, type ForestChipProps, ForestProvider, type ForestProviderProps, Gauge, Grid, IconButton, type IconButtonProps, type IconButtonVariant, LineChart, type LineChartProps, Logo, type LogoProps, MultiSelect, type MultiSelectOption, type MultiSelectProps, Page, type PageBreadcrumb, type PageProps, Paper, PieChart, type PieChartProps, Popover, Portal, ScatterChart, Search, type SearchProps, Select, SidebarItem, type SidebarItemProps, SidebarNav, type SidebarNavProps, Stack, Switch, Tooltip, useChartColors, useSidebar };