import { StudioLayouts } from '.'; import type { StudioLayoutButtonConfig } from './StudioButtonSchema'; export interface StudioButtonMenuOptionConfig { /** * Unique identifier for the option. */ id: string; /** * Label text for the option. */ label?: string; /** * Icon for the option. */ icon?: string; } export interface StudioLayoutButtonMenuConfig extends Omit { /** * Type of the layout component. */ type: `${StudioLayouts.buttonMenu}`; /** * Label for the button. Can be a string or a function that receives state and returns label config. * @examples * // Simple string * "Button" * // Function returning a layout component * (props) => ({ type: 'text', content: `Value: ${props.value}` }) */ label?: '__fn__'; /** * Current value stored in the button menu state. */ value?: string; /** * Icon to display for the dropdown menu trigger. * @default 'chevronDown' */ iconMenu?: string; /** * Optional predefined options for the menu. When provided, spawns a popover with menu items. */ options?: StudioButtonMenuOptionConfig[]; /** * Children layout to render inside the popover menu. * This is a function that receives state and returns a layout configuration. */ children?: '__fn__'; /** * Callback function triggered when the menu icon is clicked. * If provided, the default behavior will be skipped. */ onClickMenu?: '__fn__'; /** * Callback function triggered when an option is selected (when using options). */ onOptionChange?: '__fn__'; }