import type { IconColorNames, IconNames } from "@jobber/design"; import type React from "react"; import type { CSSProperties, ReactElement, ReactNode } from "react"; import type { BaseProps, ComposableMenuProps } from "./menuComposableTypes"; export interface MenuLegacyProps extends MenuBaseProps { /** * Custom menu activator. If this is not provided a default [… More] will be used. */ readonly activator?: ReactElement<{ fullWidth?: boolean; onClick?: (event?: React.MouseEvent) => void; [key: string]: unknown; }>; /** * Collection of action items. */ readonly items: SectionProps[]; } interface MenuBaseProps { /** * **Use at your own risk:** Custom class names for specific elements. This should only be used as a * **last resort**. Using this may result in unexpected side effects. * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components). */ readonly UNSAFE_className?: { menu?: string; header?: string; action?: string; }; /** * **Use at your own risk:** Custom style for specific elements. This should only be used as a * **last resort**. Using this may result in unexpected side effects. * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components). */ readonly UNSAFE_style?: { menu?: CSSProperties; header?: CSSProperties; action?: CSSProperties; }; } /** * Public Menu props now cover both the legacy items-based API and the new * composable Base UI-backed API. */ export type MenuProps = MenuLegacyProps | ComposableMenuProps; export interface SectionProps { /** * Defines the section header to further explain the group of actions. */ header?: string; /** * List of actions. */ actions: ActionProps[]; } export interface SectionHeaderProps { readonly text: string; readonly UNSAFE_style?: CSSProperties; readonly UNSAFE_className?: string; } export interface ActionProps { /** * Action label */ readonly label: string; /** * Parent Section Label */ readonly sectionLabel?: string; /** * Visual cue for the action label */ readonly icon?: IconNames; /** * Color for the icon. Defaults to "icon". */ readonly iconColor?: IconColorNames; /** * Visual style for the action button */ readonly destructive?: boolean; /** * Inline style overrides for the action button */ readonly UNSAFE_style?: CSSProperties; /** * Style class overrides for the action button */ readonly UNSAFE_className?: string; /** * Callback when an action gets clicked */ onClick?(event: React.MouseEvent): void; } export interface MenuSectionComposableProps extends BaseProps { readonly children: ReactNode; readonly ariaLabel?: string; } export interface MenuHeaderComposableProps extends BaseProps { readonly children: ReactNode; } export interface MenuHeaderLabelComposableProps { readonly children: ReactNode; } export {};