import { type ComponentType, type PropsWithChildren, type Ref } from 'react'; import { type StrictXCSSProp } from '@atlaskit/css'; import type { SpacingMode } from './internal/components/menu-context'; export interface RenderFunction { (Component: ComponentType | string, props: TProps): React.ReactNode; } export type Dimension = string | number; export interface MenuGroupSizing { /** * Use this to constrain the menu group's minimum height to a specific value. */ minHeight?: Dimension; /** * Use this to constrain the menu group's height to a specific value. * This must be set if you want to have scrollable sections. */ maxHeight?: Dimension; /** * Use this to constrain the menu group's minimum width to a specific value. */ minWidth?: Dimension; /** * Use this to constrain the menu group's maximum width to a specific value. */ maxWidth?: Dimension; } export interface MenuGroupProps extends MenuGroupSizing { /** * Children of the menu group. * This should generally be `Section` components. */ children: React.ReactNode; /** * Used this to tell assistive technologies that the menu group is loading. */ isLoading?: boolean; /** * Configure the density of the menu group content. */ spacing?: SpacingMode; /** * Use this to override the accessibility role for the element. */ role?: string; /** * A `testId` prop is provided for specified elements, * which is a unique string that appears as a data attribute `data-testid` in the rendered code, * serving as a hook for automated tests. */ testId?: string; /** * Handler called when clicking on this element, * or any children elements. * Useful when needing to stop propagation of child events. */ onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void; } export interface SectionProps { /** * Unique identifier for the element. */ id?: string; /** * Enables scrolling within the section. * This won't work unless `maxHeight` is set on the parent `MenuGroup` component. */ isScrollable?: boolean; /** * Use this to render a border at the top of the section. */ hasSeparator?: boolean; /** * Children of the section. * This should generally be `Item` or `Heading` components, * but can also be [`EmptyState`](https://atlaskit.atlassian.com/packages/design-system/empty-state)s if you want to render errors. */ children: React.ReactNode; /** * A `testId` prop is provided for specified elements, * which is a unique string that appears as a data attribute `data-testid` in the rendered code, * serving as a hook for automated tests. */ testId?: string; /** * The text passed into the internal `HeadingItem`. If a title isn't provided, * the `HeadingItem` won't be rendered, and this component will act as a regular `Section`. */ title?: string; /** * ID referenced by the menu group wrapper's `aria-labelledby` attribute. This ID should be assigned to the group title element. * Usage of either this, or the `label` attribute is strongly recommended. */ titleId?: string; /** * If your menu contains a list, use this to add `