import { IButtonProps } from "../Button/types"; import { IHtmlDetailsProps } from "../../html/Details"; import { IHtmlDivProps } from "../../html/types"; import { IClassName, IReactNullableElement } from "../../types"; export interface INavItemProps extends IButtonProps { /*** * if true, the menu item will be rendered as a section, if false, it will be rendered as an item */ section?: boolean; /*** * Props for the sub items. In case of existance of sub items. If provided, the menu item will be expandable. */ items?: INavItemProps[]; /** * Props for the expandable component that will be used to expand the menu item. In case of existance of sub items. */ expandableProps?: Omit; /*** * level of the menu item in the hierarchy. * this is used to determine the indentation of the menu item. * this value is auto calculated by the menu items component. */ level?: number; /*** * if true, the menu will be closed when the button is pressed. */ closeOnPress?: boolean; dividerClassName?: IClassName; } export interface INavContext { /** * additioonal parameters that allows extending the context * for menu items. This enables customization of the properties passed to the menu item * render function, allowing for additional context-specific data to be included. * */ context?: Context; } export interface INavItemsProps extends IHtmlDivProps, INavContext { items?: (INavItemProps | undefined | null)[]; /**** * The class name to apply to each nav item. */ itemClassName?: IClassName; /** * The function used to render a * standard menu item. This function receives the item properties and is responsible for generating * the corresponding JSX. */ renderItem: INavRenderItemFunc; /** * The function used to * render expandable menu items. Similar to the render function, this handles the rendering of * items that can expand to show additional content. */ renderExpandableItem: INavRenderItemFunc; } export interface INavRenderItemOptions extends Omit, "items"> { /** * The menu item to render. This includes * all relevant data required to display the item, such as its label, icon, and any action handlers. */ item: INavItemProps; /** * The index of the item in the list. This can be useful for applying * specific styles or behaviors based on the item's position within the menu. */ index: number; /** * An optional property indicating the current level of the menu item * in the hierarchy. This value can be used to determine the indentation of the menu item. */ level?: number; /** * The child nodes of the current item, rendered * using the renderNavItem method applied to each child item. */ itemsNodes?: IReactNullableElement[]; } export type INavRenderItemFunc = (props: INavItemProps, index: number) => IReactNullableElement;