import React from 'react'; import type { Ref } from 'react'; import { NestedNavigation as CoreNestedNavigation } from '@shoptet/ui-core-web'; import type { NestedNavigationOwnProps as CoreNestedNavigationOwnProps } from '@shoptet/ui-core-web'; import type { Exact, SafeOmit } from '@shoptet/utils'; import { NestedNavigationContent } from './NestedNavigationContent'; import { NestedNavigationHeader } from './NestedNavigationHeader'; import { NestedNavigationItem } from './NestedNavigationItem'; import { NestedNavigationList } from './NestedNavigationList'; export interface NestedNavigationOwnProps extends CoreNestedNavigationOwnProps { ref?: Ref; /** * Whether to render the standard header above the levels. Disable to compose * `NestedNavigation.Header` inside each `Level` instead. * @default true */ renderHeader?: boolean; } export interface NestedNavigationInheritedDivProps extends SafeOmit< React.HTMLAttributes, 'children' | 'className' | 'title' > {} export interface NestedNavigationProps extends NestedNavigationOwnProps, NestedNavigationInheritedDivProps {} export const NestedNavigation = Object.assign( function NestedNavigation({ stack, defaultStack, onStackChange, onClose, children, ref, renderHeader = true, ...rest }: NestedNavigationProps) { rest satisfies Exact; return ( {renderHeader && } {children} ); }, { Content: NestedNavigationContent, Header: NestedNavigationHeader, Item: NestedNavigationItem, Level: CoreNestedNavigation.Level, List: NestedNavigationList, } );