import * as _floating_ui_dom from '@floating-ui/dom'; import * as forty_cdk_core_overlay from 'forty-cdk/core-overlay'; import { MenuOverlayHost, ForMenuContext, FloatingFallbackAxisSideDirection, AnchoredPositioningOverride, MenuOpenerPositioning, AnchoredPositioningSeedDefaults, FloatingSide, FloatingAlign } from 'forty-cdk/core-overlay'; import * as _angular_core from '@angular/core'; import { Signal, Provider } from '@angular/core'; import * as forty_cdk_dropdown_menu from 'forty-cdk/dropdown-menu'; import { WritingDirection, VetoableNativeEvent, VetoableEvent } from 'forty-cdk/core'; /** * Headless implementation of the [WAI-ARIA Menu Button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/). * Apply on a wrapper that contains the trigger and the `@if`-mounted * `[forMenuContent]`. The directive owns open state, ids, and the registries * that wire trigger / content / items together. * * Mount/unmount of the visible menu is the consumer's responsibility — wrap * `[forMenuContent]` with `@if (open())` so `animate.enter` / `animate.leave` * fire on the natural mount cycle: * * ```html *
* * @if (open()) { *
* } *
* ``` * * Selecting a `[forMenuItem]` closes the menu (call `event.preventDefault()` * on the item's `(activate)` event to keep it open). Escape, pointer-down * outside, and focus-outside also close — each emits a vetoable event. * * Most of the directive's body (id generation, item collection, typeahead, * navigate / focus helpers, escape / outside-click veto plumbing) is owned * by the shared `_internal/menu-overlay` helper. The directive contributes * the inputs / outputs / model that make up the public surface, the * trigger-anchored `anchor` and `dismissibleExemptions`, and the * `aria-haspopup="menu"` / return-focus semantics specific to the * Menu Button pattern. */ declare class ForDropdownMenu extends MenuOverlayHost implements ForMenuContext { protected readonly positioningDefaults: forty_cdk_dropdown_menu.ForDropdownMenuDefaults; /** * Two-way bindable. Whether the menu is currently shown. The `model()` * change emitter (`(openChange)`) fires only on internal transitions * (trigger toggle, Escape, outside dismissal, item selection), never on * consumer writes via `[(open)]`. */ readonly open: _angular_core.ModelSignal; /** * Direction `flip` falls back to on the perpendicular axis when both sides of * the preferred axis overflow. `'none'` (default) keeps only the opposite * same-axis placement; `'start'` / `'end'` let the menu drop to a * perpendicular side on a narrow viewport. Only consulted when * `avoidCollisions` is on. The default is read from * `provideForDropdownMenuDefaults` for the surrounding scope, since dropping * to a perpendicular side is a design-system-wide viewport-degradation policy * rather than a per-menu one. */ readonly fallbackAxisSideDirection: _angular_core.InputSignal; /** * When `true` (default), arrow-key navigation wraps from the last enabled * item back to the first (and vice versa). When `false`, navigation stops * at the ends. */ readonly loop: _angular_core.InputSignalWithTransform; /** * Writing direction. Drives ArrowLeft / ArrowRight semantics on submenu * triggers and items underneath this menu (in RTL, ArrowLeft opens a submenu * and ArrowRight closes it back). When unset (default `null`), the inherited * ambient direction is resolved from the nearest ancestor carrying a `dir` * attribute (or ``), defaulting to `'ltr'`. An explicit `[dir]` * always wins, the resolved value is reflected to the host `dir` attribute, * and it is inherited by descendant submenus. */ readonly _dirInput: _angular_core.InputSignal; readonly dir: _angular_core.Signal; /** * When true, trigger interaction is ignored and any open menu stays open * until the consumer flips `open` themselves. The trigger reflects * `data-disabled`; the items keep their per-item disabled semantics. */ readonly disabled: _angular_core.InputSignalWithTransform; /** When true (default), Escape, pointer-down outside, and focus outside close the menu. */ readonly dismissible: _angular_core.InputSignalWithTransform; /** When true (default), focus returns to the trigger on close. */ readonly returnFocus: _angular_core.InputSignalWithTransform; /** Manual `aria-label` on `[forMenuContent]`. Use when the trigger isn't a meaningful name. */ readonly ariaLabel: _angular_core.InputSignal; /** * Fires when Escape is pressed while the menu is open, just before it * closes. Call `preventDefault()` on the emitted veto to keep the menu * open and suppress the Escape-driven close. */ readonly escapeKeyDown: _angular_core.OutputEmitterRef>; /** * Fires on a pointer-down outside the menu (and outside the exempt * trigger), just before it closes. Call `preventDefault()` on the veto to * keep the menu open. */ readonly pointerDownOutside: _angular_core.OutputEmitterRef>; /** * Fires when focus moves outside the menu, just before it closes. Call * `preventDefault()` on the veto to keep the menu open. */ readonly focusOutside: _angular_core.OutputEmitterRef>; /** * Composite outside-interaction channel: fires for either a * pointer-down-outside or a focus-outside, just before the menu closes. * Call `preventDefault()` on the veto to keep the menu open regardless of * which interaction triggered it. */ readonly interactOutside: _angular_core.OutputEmitterRef>; /** * Fires just before the menu sends focus to its first / last enabled * item on mount. Call `preventDefault()` on the emitted veto to skip * the imperative focus move — useful when opening a menu from an * input you want to keep focused. */ readonly autoFocusOnOpen: _angular_core.OutputEmitterRef; /** * Fires just before focus returns to the trigger on unmount. Call * `preventDefault()` on the veto to suppress the return-focus. */ readonly autoFocusOnClose: _angular_core.OutputEmitterRef; protected readonly _overlay: forty_cdk_core_overlay.MenuOverlay; /** Trigger-anchored: the single registered opener's element. */ readonly anchor: _angular_core.Signal<_floating_ui_dom.ReferenceElement | null>; /** * The trigger's own `[menuPositioning]` override, resolved by the base ahead * of this root's `[side]` / `[align]` / `[sideOffset]` / `[alignOffset]`. It * runs through the opener registry so a trigger carries the same override * here as it does under a shared `[forMenu]` root; with no override the four * values are this root's inputs verbatim. */ protected positioningOverride(): AnchoredPositioningOverride | null; /** * The trigger button is exempt — its own click handler toggles, so without the * exemption the same pointer-down would also fire pointer-down-outside and * double-close. */ readonly dismissibleExemptions: _angular_core.Signal; /** Top-level: no parent menu. */ readonly parentMenu: null; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Button that toggles the dropdown menu when clicked, opens via Enter / Space * / ArrowDown (focus first item) or ArrowUp (focus last item). * * Apply on a ` * ``` * * It resolves identically under a `[forDropdownMenu]` root, where it is * simply a per-trigger spelling of the root's own inputs. A root with no * opener registry (`[forMenubar]`'s multiplexed context, which multiplexes * positioning off its own triggers) ignores it. */ readonly menuPositioning: _angular_core.InputSignal; /** Whether the trigger is disabled — its own `disabled` input OR the root's. */ readonly effectiveDisabled: Signal; constructor(); protected onPointerDown(): void; protected onClick(): void; protected onKeyDown(event: KeyboardEvent): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Defaults inherited by descendant dropdown menus in the surrounding * injector scope. Configure with `provideForDropdownMenuDefaults` either * at the application root or in any component's `providers` array; partial * overrides merge with the parent scope. */ interface ForDropdownMenuDefaults extends AnchoredPositioningSeedDefaults { /** * Side the menu is anchored to for dropdowns that don't override `side` * locally. Library fallback `'bottom'`. */ side: FloatingSide; /** * Alignment along the chosen `side` for dropdowns that don't override * `align` locally. Library fallback `'start'`. */ align: FloatingAlign; /** * Distance (px) between the dropdown trigger and the floating content * along the resolved `side` axis. */ sideOffset: number; /** * Padding (px) added to the viewport edges for collision-aware * positioning. Higher values keep the floating content further from * the edge when `flip` / `shift` runs. */ collisionPadding: number; /** * Direction `flip` falls back to on the perpendicular axis when both sides * of the preferred axis overflow. `'none'` (default) keeps only the opposite * same-axis placement; `'start'` / `'end'` let a menu clipped on a narrow * viewport drop to a perpendicular side. Only consulted when * `avoidCollisions` is on. */ fallbackAxisSideDirection: FloatingFallbackAxisSideDirection; } /** Token holding the resolved dropdown-menu defaults for the current scope. */ declare const FOR_DROPDOWN_MENU_DEFAULTS: _angular_core.InjectionToken; /** * Configures forty-cdk dropdown-menu defaults for this injector scope. * Partial overrides inherit unspecified keys from the parent scope (or * library defaults at the root). */ declare function provideForDropdownMenuDefaults(defaults?: Partial): Provider[]; export { FOR_DROPDOWN_MENU_DEFAULTS, ForDropdownMenu, ForDropdownMenuTrigger, provideForDropdownMenuDefaults }; export type { ForDropdownMenuDefaults };