@bazza-ui/react 0.0.0-snapshot-20260205122957

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,925 @@
1
+ import * as React from 'react';
2
+ import { ReactStore } from '@base-ui/utils/store';
3
+ import { bs as VirtualizationConfig, bt as VirtualAnchor, G as GetQualifiedRowIdFn, av as SubmenuContextValue, be as AsyncLoaderConfig, A as AsyncLoaderResult, N as NodeDef, bh as AsyncState, b4 as SubmenuDef, bf as AsyncNodesConfig, aP as GroupBehavior, bl as RadioGroupBehavior, b2 as ScoredNode, aO as DisplayRowNode, bu as GetQualifiedRowIdContext, aM as DisplayNode, bi as BreadcrumbNode, aQ as GroupDef, aZ as RadioGroupDef, aT as ItemDef, bm as RadioItemDef, aD as CheckboxItemDef } from '../../data-surface-Dki7544r.js';
4
+ export { bg as AsyncRenderState, aE as CheckboxItemRenderParams, aF as CheckboxItemRenderProps, aG as DataListChildrenState, aH as DataListProps, b7 as DataSurfaceContext, aI as DataSurfaceContextValue, aJ as DataSurfaceProps, aK as DeepSearchConfig, aL as DisplayGroupNode, aN as DisplayRadioGroupNode, bj as DisplaySeparatorNode, aR as GroupRenderContext, aS as GroupRenderParams, aU as ItemRenderParams, aV as ItemRenderProps, L as LoaderComponentProps, b as PopupMenuArrow, F as PopupMenuArrowProps, c as PopupMenuBackdrop, H as PopupMenuBackdropProps, n as PopupMenuCheckboxItem, o as PopupMenuCheckboxItemIndicator, a7 as PopupMenuCheckboxItemIndicatorProps, a8 as PopupMenuCheckboxItemIndicatorState, a9 as PopupMenuCheckboxItemProps, aa as PopupMenuCheckboxItemState, bv as PopupMenuContext, au as PopupMenuContextValue, p as PopupMenuDataInput, ab as PopupMenuDataInputProps, q as PopupMenuDataList, aW as PopupMenuDataListProps, r as PopupMenuDataSurface, aX as PopupMenuDataSurfaceProps, d as PopupMenuEmpty, I as PopupMenuEmptyProps, J as PopupMenuEmptyState, e as PopupMenuGroup, f as PopupMenuGroupLabel, K as PopupMenuGroupLabelProps, M as PopupMenuGroupLabelState, O as PopupMenuGroupProps, R as PopupMenuGroupState, g as PopupMenuIcon, T as PopupMenuIconProps, U as PopupMenuIconState, p as PopupMenuInput, ab as PopupMenuInputProps, ac as PopupMenuInputState, s as PopupMenuItem, ad as PopupMenuItemProps, ae as PopupMenuItemState, h as PopupMenuList, V as PopupMenuListChildrenState, a5 as PopupMenuListCssVars, W as PopupMenuListProps, X as PopupMenuListState, i as PopupMenuPopup, Y as PopupMenuPopupProps, E as PopupMenuPopupState, j as PopupMenuPortal, Z as PopupMenuPortalProps, t as PopupMenuPositioner, af as PopupMenuPositionerAlign, a6 as PopupMenuPositionerCssVars, ag as PopupMenuPositionerProps, u as PopupMenuRadioGroup, ah as PopupMenuRadioGroupProps, ai as PopupMenuRadioGroupState, v as PopupMenuRadioGroupValue, aY as PopupMenuRadioGroupValueProps, w as PopupMenuRadioItem, x as PopupMenuRadioItemIndicator, aj as PopupMenuRadioItemIndicatorProps, ak as PopupMenuRadioItemIndicatorState, al as PopupMenuRadioItemProps, am as PopupMenuRadioItemState, bx as PopupMenuScrollArrow, _ as PopupMenuScrollArrowProps, $ as PopupMenuScrollArrowState, k as PopupMenuScrollDownArrow, a0 as PopupMenuScrollDownArrowProps, l as PopupMenuScrollUpArrow, a1 as PopupMenuScrollUpArrowProps, m as PopupMenuSeparator, a2 as PopupMenuSeparatorProps, a3 as PopupMenuSeparatorState, y as PopupMenuShortcut, an as PopupMenuShortcutProps, ao as PopupMenuShortcutState, z as PopupMenuSubmenuRoot, ap as PopupMenuSubmenuRootProps, B as PopupMenuSubmenuTrigger, D as PopupMenuSubmenuTriggerIndicator, aq as PopupMenuSubmenuTriggerIndicatorProps, ar as PopupMenuSubmenuTriggerIndicatorState, as as PopupMenuSubmenuTriggerProps, at as PopupMenuSubmenuTriggerState, P as PopupMenuSurface, a as PopupMenuSurfaceProps, a4 as PopupMenuSurfaceState, bk as QueryAsyncNodesConfig, Q as QueryDependentLoaderConfig, a_ as RadioGroupRenderParams, a$ as RadioGroupRenderProps, bn as RadioItemRenderParams, bo as RadioItemRenderProps, b0 as RenderNodeFn, b1 as RowRenderContext, b3 as SeparatorDef, bp as SeparatorRenderParams, bq as StaticAsyncNodesConfig, S as StaticLoaderConfig, bw as SubmenuContext, b5 as SubmenuRenderParams, b6 as SubmenuRenderProps, aA as UsePopupMenuItemParams, aB as UsePopupMenuItemReturn, b8 as defineRadioGroup, b9 as isDisplayGroupNode, ba as isDisplayRadioGroupNode, bb as isDisplayRowNode, br as isDisplaySeparatorNode, bc as useDataSurfaceContext, bd as useMaybeDataSurfaceContext, aw as useMaybePopupMenuContext, ax as useMaybeSubmenuContext, ay as usePopupMenuContext, aC as usePopupMenuItem, az as useSubmenuContext } from '../../data-surface-Dki7544r.js';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import { C as ChangeEventDetails, V as VirtualItem, G as GenericEventDetails, r as ListboxStore, P as PopupMenuOpenChangeReason, u as ItemContextValue, E as CheckedChangeReason, R as RadioValueChangeReason } from '../../use-listbox-item-bi01_uzf.js';
7
+ import '@base-ui/react/popover';
8
+
9
+ declare enum PopupMenuCheckboxItemDataAttributes {
10
+ /**
11
+ * Identifies the component part.
12
+ * @type {'bazzaui-dropdown-menu-checkbox-item' | 'bazzaui-context-menu-checkbox-item'}
13
+ */
14
+ slot = "bazzaui-[component]-checkbox-item",
15
+ /**
16
+ * Present when the checkbox item is checked.
17
+ */
18
+ checked = "data-checked",
19
+ /**
20
+ * Present when the checkbox item is unchecked.
21
+ */
22
+ unchecked = "data-unchecked",
23
+ /**
24
+ * Present when the item is highlighted (via keyboard or pointer).
25
+ */
26
+ highlighted = "data-highlighted",
27
+ /**
28
+ * Present when the item is disabled.
29
+ */
30
+ disabled = "data-disabled"
31
+ }
32
+
33
+ declare enum PopupMenuItemDataAttributes {
34
+ /**
35
+ * Identifies the component part.
36
+ * @type {'bazzaui-dropdown-menu-item' | 'bazzaui-context-menu-item' | 'bazzaui-select-item' | 'bazzaui-combobox-item'}
37
+ */
38
+ slot = "bazzaui-[component]-item",
39
+ /**
40
+ * Present when the item is highlighted (via keyboard or pointer).
41
+ */
42
+ highlighted = "data-highlighted",
43
+ /**
44
+ * Present when the item is disabled.
45
+ */
46
+ disabled = "data-disabled"
47
+ }
48
+
49
+ declare enum PopupMenuRadioGroupDataAttributes {
50
+ /**
51
+ * Identifies the component part.
52
+ * @type {'bazzaui-dropdown-menu-radio-group' | 'bazzaui-context-menu-radio-group'}
53
+ */
54
+ slot = "bazzaui-[component]-radio-group",
55
+ /**
56
+ * Present when the radio group is disabled.
57
+ */
58
+ disabled = "data-disabled"
59
+ }
60
+
61
+ declare enum PopupMenuRadioItemDataAttributes {
62
+ /**
63
+ * Identifies the component part.
64
+ * @type {'bazzaui-dropdown-menu-radio-item' | 'bazzaui-context-menu-radio-item'}
65
+ */
66
+ slot = "bazzaui-[component]-radio-item",
67
+ /**
68
+ * Present when the radio item is checked/selected.
69
+ */
70
+ checked = "data-checked",
71
+ /**
72
+ * Present when the radio item is unchecked.
73
+ */
74
+ unchecked = "data-unchecked",
75
+ /**
76
+ * Present when the item is highlighted (via keyboard or pointer).
77
+ */
78
+ highlighted = "data-highlighted",
79
+ /**
80
+ * Present when the item is disabled.
81
+ */
82
+ disabled = "data-disabled"
83
+ }
84
+
85
+ /**
86
+ * Component name used for generating bazzaui-* slot attributes.
87
+ * E.g., 'dropdown-menu', 'context-menu', 'select', 'combobox'
88
+ */
89
+ type ComponentName = 'dropdown-menu' | 'context-menu' | 'select' | 'combobox';
90
+ declare const ComponentNameContext: React.Context<ComponentName | null>;
91
+ /**
92
+ * Returns the component name from context.
93
+ * Throws if used outside of a component that provides the context.
94
+ */
95
+ declare function useComponentName(): ComponentName;
96
+ /**
97
+ * Returns the component name from context, or null if not available.
98
+ * Useful for internal components that may be used outside the popup-menu context.
99
+ */
100
+ declare function useMaybeComponentName(): ComponentName | null;
101
+ /**
102
+ * Helper to generate a bazzaui slot attribute value.
103
+ * @param componentName The component name (e.g., 'dropdown-menu')
104
+ * @param partName The part name (e.g., 'trigger', 'item')
105
+ * @returns The slot attribute value (e.g., 'bazzaui-dropdown-menu-trigger')
106
+ */
107
+ declare function getSlotAttribute(componentName: ComponentName | null, partName: string): string | undefined;
108
+
109
+ interface FocusOwnerState {
110
+ /** Which surface currently owns focus (surfaceId or null) */
111
+ ownerId: string | null;
112
+ }
113
+ declare const selectors$1: {
114
+ ownerId: (state: FocusOwnerState) => string | null;
115
+ isOwner: (state: FocusOwnerState, surfaceId: string) => boolean;
116
+ };
117
+ /**
118
+ * Tracks which menu surface owns DOM focus.
119
+ * Single instance per menu tree (created at root, shared via context).
120
+ *
121
+ * Used by: DropdownMenu, ContextMenu
122
+ * Not used by: Select, CommandMenu (single surface)
123
+ */
124
+ declare class FocusOwnerStore extends ReactStore<FocusOwnerState, {}, typeof selectors$1> {
125
+ constructor();
126
+ /**
127
+ * Set the owner surface ID.
128
+ * Call this when focus should transfer to a new surface.
129
+ */
130
+ setOwnerId(id: string | null): void;
131
+ /**
132
+ * Clear the owner (set to null).
133
+ * Call this when the menu tree closes.
134
+ */
135
+ clearOwner(): void;
136
+ }
137
+
138
+ declare const FocusOwnerContext: React.Context<FocusOwnerStore | null>;
139
+ declare function useFocusOwner(): FocusOwnerStore;
140
+ declare function useMaybeFocusOwner(): FocusOwnerStore | null;
141
+
142
+ interface OpenChainState {
143
+ /**
144
+ * Ordered array of surface IDs for submenus that are currently open.
145
+ * The last element is the most recently opened (deepest in chain).
146
+ */
147
+ chain: string[];
148
+ }
149
+ declare const selectors: {
150
+ isOpen: (state: OpenChainState, surfaceId: string) => boolean;
151
+ isLast: (state: OpenChainState, surfaceId: string) => boolean;
152
+ /**
153
+ * Returns true if there's an open submenu below the given depth.
154
+ * - Root (depth 0): true if any submenu is open
155
+ * - Submenu at depth N: true if a deeper submenu is open
156
+ */
157
+ hasOpenSubmenu: (state: OpenChainState, depth: number) => boolean;
158
+ };
159
+ /**
160
+ * Tracks which submenu surfaces are currently open in order.
161
+ * Used to show backdrops for all open menus in the chain.
162
+ * Single instance per menu tree (created at root, shared via context).
163
+ *
164
+ * Used by: DropdownMenu, ContextMenu
165
+ * Not used by: Select, CommandMenu (no submenus)
166
+ */
167
+ declare class OpenChainStore extends ReactStore<OpenChainState, {}, typeof selectors> {
168
+ constructor();
169
+ /**
170
+ * Mark a surface as open (adds to end of chain).
171
+ */
172
+ open(surfaceId: string): void;
173
+ /**
174
+ * Mark a surface as closed (removes from chain).
175
+ */
176
+ close(surfaceId: string): void;
177
+ /**
178
+ * Clear all open surfaces (menu tree closed).
179
+ */
180
+ clear(): void;
181
+ }
182
+
183
+ declare const OpenChainContext: React.Context<OpenChainStore | null>;
184
+ declare function useOpenChain(): OpenChainStore;
185
+ declare function useMaybeOpenChain(): OpenChainStore | null;
186
+
187
+ /**
188
+ * Context for passing surfaceId from Popup to Surface.
189
+ * This ensures Popup and Surface share the same ID for data attribute tracking.
190
+ *
191
+ * For root menus, Popup generates the ID and provides it via this context.
192
+ * For submenus, the ID comes from SubmenuContext.childSurfaceId instead.
193
+ */
194
+ declare const PopupSurfaceIdContext: React.Context<string | null>;
195
+ declare function usePopupSurfaceId(): string | null;
196
+
197
+ interface AimGuardContextValue {
198
+ aimGuardActive: boolean;
199
+ guardedTriggerId: string | null;
200
+ guardedDepth: number | null;
201
+ guardedSubmenuSurfaceId: string | null;
202
+ activateAimGuard: (triggerId: string, depth: number, submenuSurfaceId: string, timeoutMs?: number) => void;
203
+ clearAimGuard: () => void;
204
+ aimGuardActiveRef: React.RefObject<boolean>;
205
+ guardedTriggerIdRef: React.RefObject<string | null>;
206
+ guardedDepthRef: React.RefObject<number | null>;
207
+ guardedSubmenuSurfaceIdRef: React.RefObject<string | null>;
208
+ isGuardBlocking: (rowId: string) => boolean;
209
+ }
210
+ declare const AimGuardCtx: React.Context<AimGuardContextValue>;
211
+ declare const useAimGuard: () => AimGuardContextValue;
212
+ interface AimGuardProviderProps {
213
+ children: React.ReactNode;
214
+ }
215
+ /**
216
+ * Provides aim guard for safe polygon navigation.
217
+ * Prevents accidental submenu closures when users move diagonally toward an open submenu.
218
+ */
219
+ declare function AimGuardProvider({ children }: AimGuardProviderProps): react_jsx_runtime.JSX.Element;
220
+
221
+ type AnchorSide = 'left' | 'right';
222
+ /**
223
+ * Determines which side of the submenu the trigger is anchored to.
224
+ * Used to know which direction the user should be moving toward.
225
+ */
226
+ declare function resolveAnchorSide(rect: DOMRect, tRect: DOMRect | null, mx: number): AnchorSide;
227
+ /**
228
+ * Calculates a smoothed heading vector from the mouse trail.
229
+ * If movement is too slow, infers direction toward the submenu center.
230
+ */
231
+ declare function getSmoothedHeading(trail: [number, number][], exitX: number, exitY: number, anchor: AnchorSide, tRect: DOMRect | null, rect: DOMRect): {
232
+ dx: number;
233
+ dy: number;
234
+ };
235
+ /**
236
+ * Tests if the user's trajectory will intersect the submenu's safe zone.
237
+ * Returns true if the user is aiming toward the submenu.
238
+ */
239
+ declare function willHitSubmenu(exitX: number, exitY: number, heading: {
240
+ dx: number;
241
+ dy: number;
242
+ }, rect: DOMRect, anchor: AnchorSide, triggerRect: DOMRect | null): boolean;
243
+
244
+ /**
245
+ * Keeps track of the last N mouse positions without causing re-renders.
246
+ * Used for calculating mouse trajectory in aim guard.
247
+ */
248
+ declare function useMouseTrail(n?: number): React.RefObject<[number, number][]>;
249
+
250
+ interface UsePopupMenuRootParams {
251
+ /**
252
+ * Callback when the open state changes.
253
+ * The second parameter contains event details including the reason for the change.
254
+ */
255
+ onOpenChange?: (open: boolean, eventDetails: ChangeEventDetails<string>) => void;
256
+ /**
257
+ * Whether the menu is initially open.
258
+ * @default false
259
+ */
260
+ defaultOpen?: boolean;
261
+ /**
262
+ * Whether virtualization mode is enabled.
263
+ * @default false
264
+ */
265
+ virtualized?: boolean;
266
+ /**
267
+ * Pre-registered items for virtualization.
268
+ */
269
+ items?: VirtualItem[];
270
+ /**
271
+ * Callback when the highlighted item changes.
272
+ * The third parameter contains event details including the reason for the change.
273
+ */
274
+ onHighlightChange?: (id: string | null, index: number, eventDetails: GenericEventDetails<string, {
275
+ index: number;
276
+ }>) => void;
277
+ /**
278
+ * When to close the menu on outside interactions.
279
+ * - 'pointerdown': Close immediately when pointer is pressed outside (default)
280
+ * - 'click': Close when a full click (pointerdown + pointerup) occurs outside
281
+ * @default 'pointerdown'
282
+ */
283
+ closeOnOutsidePress?: 'click' | 'pointerdown';
284
+ }
285
+ interface UsePopupMenuRootReturn {
286
+ /** The Listbox store instance */
287
+ store: ListboxStore;
288
+ /** The FocusOwner store instance */
289
+ focusOwnerStore: FocusOwnerStore;
290
+ /** The OpenChain store instance */
291
+ openChainStore: OpenChainStore;
292
+ /** Register a surface (submenu) for closeAll tracking */
293
+ registerSurface: (depth: number, setOpen: (open: boolean) => void) => () => void;
294
+ /** Close the entire menu tree */
295
+ closeAll: (reason?: PopupMenuOpenChangeReason, event?: Event) => void;
296
+ /** Virtualization configuration (if enabled) */
297
+ virtualization: VirtualizationConfig | undefined;
298
+ /** Handle open state change (updates store and clears stores on close) */
299
+ handleOpenChange: (open: boolean, reason?: PopupMenuOpenChangeReason, event?: Event) => void;
300
+ }
301
+ /**
302
+ * Hook that creates and manages the core stores and utilities for popup menus.
303
+ * Used by both DropdownMenu.Root and ContextMenu.Root.
304
+ *
305
+ * Provides:
306
+ * - ListboxStore for item management
307
+ * - FocusOwnerStore for focus tracking across submenus
308
+ * - OpenChainStore for tracking open submenu chain
309
+ * - Surface registry for closeAll functionality
310
+ */
311
+ declare function usePopupMenuRoot(params?: UsePopupMenuRootParams): UsePopupMenuRootReturn;
312
+
313
+ declare enum PopupMenuArrowDataAttributes {
314
+ /**
315
+ * Identifies the component part.
316
+ * @type {'bazzaui-dropdown-menu-arrow' | 'bazzaui-context-menu-arrow' | 'bazzaui-select-arrow' | 'bazzaui-combobox-arrow'}
317
+ */
318
+ slot = "bazzaui-[component]-arrow",
319
+ /**
320
+ * Present when the popup menu is open.
321
+ */
322
+ open = "data-open",
323
+ /**
324
+ * Present when the popup menu is closed.
325
+ */
326
+ closed = "data-closed",
327
+ /**
328
+ * Indicates which side the popup is positioned relative to the trigger.
329
+ * @type {'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'}
330
+ */
331
+ side = "data-side",
332
+ /**
333
+ * Indicates how the popup is aligned relative to specified side.
334
+ * @type {'start' | 'center' | 'end'}
335
+ */
336
+ align = "data-align",
337
+ /**
338
+ * Present when the arrow is not centered due to collision avoidance.
339
+ */
340
+ uncentered = "data-uncentered"
341
+ }
342
+
343
+ declare enum PopupMenuBackdropDataAttributes {
344
+ /**
345
+ * Identifies the component part.
346
+ * @type {'bazzaui-dropdown-menu-backdrop' | 'bazzaui-context-menu-backdrop' | 'bazzaui-select-backdrop' | 'bazzaui-combobox-backdrop'}
347
+ */
348
+ slot = "bazzaui-[component]-backdrop",
349
+ /**
350
+ * Present when the popup menu is open.
351
+ */
352
+ open = "data-open",
353
+ /**
354
+ * Present when the popup menu is closed.
355
+ */
356
+ closed = "data-closed",
357
+ /**
358
+ * Present when the popup menu is animating in.
359
+ */
360
+ startingStyle = "data-starting-style",
361
+ /**
362
+ * Present when the popup menu is animating out.
363
+ */
364
+ endingStyle = "data-ending-style"
365
+ }
366
+
367
+ declare enum PopupMenuPopupDataAttributes {
368
+ /**
369
+ * Identifies the component part.
370
+ * @type {'bazzaui-dropdown-menu-popup' | 'bazzaui-context-menu-popup' | 'bazzaui-select-popup' | 'bazzaui-combobox-popup'}
371
+ */
372
+ slot = "bazzaui-[component]-popup",
373
+ /**
374
+ * Present when the popup menu is open.
375
+ */
376
+ open = "data-open",
377
+ /**
378
+ * Present when the popup menu is closed.
379
+ */
380
+ closed = "data-closed",
381
+ /**
382
+ * Indicates which side the popup is positioned relative to the trigger.
383
+ * @type {'top' | 'bottom' | 'left' | 'right'}
384
+ */
385
+ side = "data-side",
386
+ /**
387
+ * Indicates how the popup is aligned relative to specified side.
388
+ * @type {'start' | 'center' | 'end'}
389
+ */
390
+ align = "data-align",
391
+ /**
392
+ * Present when the popup is animating in.
393
+ */
394
+ startingStyle = "data-starting-style",
395
+ /**
396
+ * Present when the popup is animating out.
397
+ */
398
+ endingStyle = "data-ending-style",
399
+ /**
400
+ * Present if animations should be instant.
401
+ * @type {'click' | 'dismiss'}
402
+ */
403
+ instant = "data-instant",
404
+ /**
405
+ * Present when this popup's surface is the focus owner.
406
+ * Useful for styling the currently focused menu in a submenu chain.
407
+ */
408
+ focused = "data-focused",
409
+ /**
410
+ * Present when this popup has an open submenu below it in the menu tree.
411
+ * Useful for styling all parent menus in an open submenu chain.
412
+ */
413
+ hasOpenSubmenu = "data-has-open-submenu",
414
+ /**
415
+ * Present when this popup is a submenu (not the root menu).
416
+ * Useful for applying different styles to submenus vs root menus.
417
+ */
418
+ submenu = "data-submenu"
419
+ }
420
+
421
+ declare enum PopupMenuPositionerDataAttributes {
422
+ /**
423
+ * Identifies the component part.
424
+ * @type {'bazzaui-dropdown-menu-positioner' | 'bazzaui-context-menu-positioner' | 'bazzaui-select-positioner' | 'bazzaui-combobox-positioner'}
425
+ */
426
+ slot = "bazzaui-[component]-positioner",
427
+ /**
428
+ * Present when the popup menu is open.
429
+ */
430
+ open = "data-open",
431
+ /**
432
+ * Present when the popup menu is closed.
433
+ */
434
+ closed = "data-closed",
435
+ /**
436
+ * Present when the anchor is hidden.
437
+ */
438
+ anchorHidden = "data-anchor-hidden",
439
+ /**
440
+ * Indicates which side the popup is positioned relative to the trigger.
441
+ * @type {'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'}
442
+ */
443
+ side = "data-side",
444
+ /**
445
+ * Indicates how the popup is aligned relative to specified side.
446
+ * @type {'start' | 'center' | 'end' | 'list-start'}
447
+ */
448
+ align = "data-align"
449
+ }
450
+
451
+ interface PopupMenuProvidersProps {
452
+ /** The Listbox store instance */
453
+ store: ListboxStore;
454
+ /** The FocusOwner store instance */
455
+ focusOwnerStore: FocusOwnerStore;
456
+ /** The OpenChain store instance */
457
+ openChainStore: OpenChainStore;
458
+ /** Nesting depth: 0 = root menu */
459
+ depth: number;
460
+ /** Close the entire menu tree */
461
+ closeAll: () => void;
462
+ /** Register a surface for closeAll tracking */
463
+ registerSurface: (depth: number, setOpen: (open: boolean) => void) => () => void;
464
+ /** Virtualization configuration */
465
+ virtualization?: VirtualizationConfig;
466
+ /**
467
+ * Virtual anchor for positioning (used by ContextMenu).
468
+ * DropdownMenu uses Popover's anchor (trigger button) instead.
469
+ */
470
+ virtualAnchor?: VirtualAnchor;
471
+ /**
472
+ * Type of menu for positioning logic.
473
+ * @default 'dropdown'
474
+ */
475
+ menuType?: 'dropdown' | 'context';
476
+ /**
477
+ * When to close the menu on outside interactions.
478
+ * @default 'pointerdown'
479
+ */
480
+ closeOnOutsidePress?: 'click' | 'pointerdown';
481
+ /**
482
+ * Function to generate qualified unique IDs for rows.
483
+ * Defined once at the root level and applied to all surfaces (root and submenus).
484
+ */
485
+ getQualifiedRowId?: GetQualifiedRowIdFn;
486
+ /**
487
+ * Component name for generating bazzaui-* slot attributes.
488
+ * E.g., 'dropdown-menu', 'context-menu', 'select', 'combobox'
489
+ */
490
+ componentName: ComponentName;
491
+ children: React.ReactNode;
492
+ }
493
+ /**
494
+ * Provides all shared context providers for popup menus.
495
+ * Wraps children with:
496
+ * - PopupMenuContext (menu-specific state)
497
+ * - ListboxContextProvider (for compatibility with listbox components)
498
+ * - AimGuardProvider (for submenu aim detection)
499
+ * - FocusOwnerContext (for focus tracking across submenus)
500
+ * - OpenChainContext (for tracking open submenu chain)
501
+ */
502
+ declare function PopupMenuProviders(props: PopupMenuProvidersProps): react_jsx_runtime.JSX.Element;
503
+
504
+ interface UsePopupMenuKeyboardParams {
505
+ /** The Listbox store instance */
506
+ store: ListboxStore;
507
+ /** Unique identifier for this surface */
508
+ surfaceId: string;
509
+ /** The FocusOwner store for managing focus ownership */
510
+ focusOwnerStore: FocusOwnerStore;
511
+ /** Menu depth (0 for root, >0 for submenus) */
512
+ depth: number;
513
+ /** Submenu context for ArrowLeft navigation back to parent */
514
+ submenuContext: SubmenuContextValue | null;
515
+ /** Whether keyboard handling is enabled */
516
+ enabled: boolean;
517
+ /**
518
+ * Whether to enable type-to-search behavior.
519
+ * When true, printable characters will activate the input and set pending search.
520
+ * Used by List when hideUntilActive is enabled and input is not yet active.
521
+ * @default false
522
+ */
523
+ enableTypeToSearch?: boolean;
524
+ /** User's onKeyDown handler to compose with */
525
+ onKeyDown?: React.KeyboardEventHandler;
526
+ /**
527
+ * Callback to close the entire menu tree from the root.
528
+ * Used when Escape is pressed and closeRootOnEsc is true (default).
529
+ */
530
+ closeAll: () => void;
531
+ /**
532
+ * Whether to skip the focus owner check.
533
+ * When true, keyboard handling will work based on `enabled` prop alone,
534
+ * ignoring focus ownership. Useful for Combobox where the input is outside
535
+ * the Surface but should still handle keyboard navigation.
536
+ * @default false
537
+ */
538
+ skipFocusOwnerCheck?: boolean;
539
+ }
540
+ interface UsePopupMenuKeyboardReturn {
541
+ /** Keyboard event handler to attach to the element */
542
+ handleKeyDown: React.KeyboardEventHandler;
543
+ }
544
+ /**
545
+ * Centralized keyboard navigation hook for popup menus.
546
+ * Handles arrow navigation, vim bindings, submenu open/close, and selection.
547
+ */
548
+ declare function usePopupMenuKeyboard(params: UsePopupMenuKeyboardParams): UsePopupMenuKeyboardReturn;
549
+
550
+ declare const PopupMenuIconDataAttributes: {
551
+ /**
552
+ * Identifies the component part.
553
+ * @type {'bazzaui-dropdown-menu-icon' | 'bazzaui-context-menu-icon' | 'bazzaui-select-icon' | 'bazzaui-combobox-icon'}
554
+ */
555
+ readonly slot: "bazzaui-[component]-icon";
556
+ /** Present when the popup is open. */
557
+ readonly open: "data-popup-open";
558
+ };
559
+
560
+ declare enum PopupMenuListDataAttributes {
561
+ /**
562
+ * Identifies the component part.
563
+ * @type {'bazzaui-dropdown-menu-list' | 'bazzaui-context-menu-list' | 'bazzaui-select-list' | 'bazzaui-combobox-list'}
564
+ */
565
+ slot = "bazzaui-[component]-list",
566
+ /**
567
+ * Always present on the list element.
568
+ * Used for styling and by useStickyRowWidth to find the list container.
569
+ */
570
+ list = "data-popup-menu-list"
571
+ }
572
+
573
+ declare const PopupMenuScrollArrowDataAttributes: {
574
+ /**
575
+ * Identifies the component part.
576
+ * @type {'bazzaui-dropdown-menu-scroll-up-arrow' | 'bazzaui-dropdown-menu-scroll-down-arrow' | 'bazzaui-context-menu-scroll-up-arrow' | 'bazzaui-context-menu-scroll-down-arrow' | 'bazzaui-select-scroll-up-arrow' | 'bazzaui-select-scroll-down-arrow' | 'bazzaui-combobox-scroll-up-arrow' | 'bazzaui-combobox-scroll-down-arrow'}
577
+ */
578
+ readonly slot: "bazzaui-[component]-scroll-[up|down]-arrow";
579
+ /** @type {'up' | 'down'} */
580
+ readonly direction: "data-direction";
581
+ /** @type {'top' | 'bottom' | 'left' | 'right'} */
582
+ readonly side: "data-side";
583
+ };
584
+
585
+ /**
586
+ * Context value for checkbox menu items.
587
+ * Extends ItemContextValue with checkbox-specific state.
588
+ */
589
+ interface CheckboxItemContextValue extends ItemContextValue {
590
+ /** Whether this checkbox item is currently checked */
591
+ checked: boolean;
592
+ /**
593
+ * Toggle the checked state.
594
+ * @param reason - The reason for the change (default: 'item-press')
595
+ * @param event - The native DOM event that triggered the change
596
+ */
597
+ toggle: (reason?: CheckedChangeReason, event?: Event) => void;
598
+ }
599
+ declare const CheckboxItemContext: React.Context<CheckboxItemContextValue | null>;
600
+ declare function useCheckboxItemContext(): CheckboxItemContextValue;
601
+
602
+ interface RadioGroupContextValue {
603
+ /** Current selected value */
604
+ value: string | undefined;
605
+ /**
606
+ * Function to update the selected value.
607
+ * @param value - The new value to select
608
+ * @param reason - The reason for the change (default: 'item-press')
609
+ * @param event - The native DOM event that triggered the change
610
+ */
611
+ setValue: (value: string, reason?: RadioValueChangeReason, event?: Event) => void;
612
+ /** Whether all items in the group are disabled */
613
+ disabled: boolean;
614
+ }
615
+ declare const RadioGroupContext: React.Context<RadioGroupContextValue | null>;
616
+ declare function useRadioGroupContext(): RadioGroupContextValue;
617
+
618
+ /**
619
+ * Context value for radio menu items.
620
+ * Extends ItemContextValue with radio-specific state.
621
+ */
622
+ interface RadioItemContextValue extends ItemContextValue {
623
+ /** Whether this radio item is currently selected */
624
+ checked: boolean;
625
+ }
626
+ declare const RadioItemContext: React.Context<RadioItemContextValue | null>;
627
+ declare function useRadioItemContext(): RadioItemContextValue;
628
+
629
+ declare enum PopupMenuShortcutDataAttributes {
630
+ /**
631
+ * Identifies the component part.
632
+ * @type {'bazzaui-dropdown-menu-shortcut' | 'bazzaui-context-menu-shortcut'}
633
+ */
634
+ slot = "bazzaui-[component]-shortcut",
635
+ /**
636
+ * Present when the parent item is highlighted.
637
+ */
638
+ highlighted = "data-highlighted"
639
+ }
640
+
641
+ declare enum PopupMenuSubmenuTriggerDataAttributes {
642
+ /**
643
+ * Identifies the component part.
644
+ * @type {'bazzaui-dropdown-menu-submenu-trigger' | 'bazzaui-context-menu-submenu-trigger'}
645
+ */
646
+ slot = "bazzaui-[component]-submenu-trigger",
647
+ /**
648
+ * Present on submenu trigger elements.
649
+ */
650
+ submenuTrigger = "data-submenu-trigger",
651
+ /**
652
+ * Present when the submenu popup is open.
653
+ */
654
+ popupOpen = "data-popup-open",
655
+ /**
656
+ * Present when the submenu owns keyboard focus.
657
+ */
658
+ popupFocused = "data-popup-focused",
659
+ /**
660
+ * Present when the item is highlighted.
661
+ */
662
+ highlighted = "data-highlighted",
663
+ /**
664
+ * Present when the item is disabled.
665
+ */
666
+ disabled = "data-disabled"
667
+ }
668
+
669
+ /**
670
+ * State for a registered async loader.
671
+ */
672
+ interface AsyncMenuState {
673
+ /** Unique identifier for this async menu */
674
+ id: string;
675
+ /** Breadcrumbs path to this menu (for merging into tree) */
676
+ breadcrumbs: string[];
677
+ /** The loader configuration */
678
+ config: AsyncLoaderConfig;
679
+ /** Current loader result */
680
+ result: AsyncLoaderResult<NodeDef[]>;
681
+ }
682
+ /**
683
+ * Context value for the async menu coordinator.
684
+ */
685
+ interface AsyncMenuCoordinatorValue {
686
+ /** Register a new async loader */
687
+ registerLoader: (state: AsyncMenuState) => void;
688
+ /** Unregister an async loader */
689
+ unregisterLoader: (id: string) => void;
690
+ /** Update loader result */
691
+ updateLoaderResult: (id: string, result: AsyncLoaderResult<NodeDef[]>) => void;
692
+ /** Current search query from the store */
693
+ searchQuery: string;
694
+ /** All registered loaders */
695
+ loaders: Map<string, AsyncMenuState>;
696
+ /** Any loader is currently loading */
697
+ isAnyLoading: boolean;
698
+ /** Static loaders are loading */
699
+ isStaticLoading: boolean;
700
+ /** Query loaders are loading */
701
+ isQueryLoading: boolean;
702
+ /** All loaders have resolved (not loading, no pending) */
703
+ allResolved: boolean;
704
+ /** Get all resolved async nodes with their breadcrumbs */
705
+ getAsyncNodes: () => Array<{
706
+ id: string;
707
+ breadcrumbs: string[];
708
+ nodes: NodeDef[];
709
+ }>;
710
+ /** Loaders that errored */
711
+ erroredLoaders: Map<string, Error>;
712
+ /** Get the aggregate async state for DataList */
713
+ getAsyncState: () => AsyncState;
714
+ }
715
+ declare const AsyncMenuCoordinatorContext: React.Context<AsyncMenuCoordinatorValue | null>;
716
+ declare function useAsyncMenuCoordinator(): AsyncMenuCoordinatorValue | null;
717
+ declare function useMaybeAsyncMenuCoordinator(): AsyncMenuCoordinatorValue | null;
718
+ interface AsyncMenuCoordinatorProviderProps {
719
+ /** Children to render */
720
+ children: React.ReactNode;
721
+ /** Current search query from the store */
722
+ searchQuery: string;
723
+ }
724
+ declare function AsyncMenuCoordinatorProvider(props: AsyncMenuCoordinatorProviderProps): react_jsx_runtime.JSX.Element;
725
+
726
+ /**
727
+ * Default function to generate qualified unique IDs for rows.
728
+ *
729
+ * Logic:
730
+ * - If node.id is provided, use it as-is (treat as globally unique)
731
+ * - Otherwise, when deep searching, qualify with breadcrumb path + value
732
+ * - When not deep searching, just use the slugified value
733
+ *
734
+ * @example
735
+ * // With explicit id:
736
+ * // { id: 'my-unique-id', value: 'In Progress' }
737
+ * // => 'my-unique-id'
738
+ *
739
+ * // Without id, deep searching in "Status" submenu:
740
+ * // { value: 'In Progress' } in Status submenu
741
+ * // => 'status.in-progress'
742
+ *
743
+ * // Without id, not deep searching:
744
+ * // { value: 'In Progress' }
745
+ * // => 'in-progress'
746
+ */
747
+ declare function defaultGetQualifiedRowId(ctx: GetQualifiedRowIdContext): string;
748
+ declare function isItemDef(node: NodeDef): node is ItemDef;
749
+ declare function isRadioItemDef(node: NodeDef): node is RadioItemDef;
750
+ declare function isCheckboxItemDef(node: NodeDef): node is CheckboxItemDef;
751
+ declare function isSubmenuDef(node: NodeDef): node is SubmenuDef;
752
+ declare function isGroupDef(node: NodeDef): node is GroupDef;
753
+ declare function isRadioGroupDef(node: NodeDef): node is RadioGroupDef;
754
+ declare function isSeparatorDef(node: NodeDef): node is {
755
+ kind: 'separator';
756
+ id?: string;
757
+ };
758
+ interface FlattenOptions {
759
+ /** Whether to include children of submenus (deep search) */
760
+ deep?: boolean;
761
+ /** Parent breadcrumb nodes (submenu nodes from root to parent) */
762
+ breadcrumbs?: BreadcrumbNode[];
763
+ /** Current group context (nested groups not supported) */
764
+ group?: {
765
+ id: string;
766
+ label?: string;
767
+ groupDef: GroupDef;
768
+ } | null;
769
+ /** Current radio group context */
770
+ radioGroup?: {
771
+ id: string;
772
+ label?: string;
773
+ radioGroupDef: RadioGroupDef;
774
+ } | null;
775
+ }
776
+ interface FlattenedNode {
777
+ node: ItemDef | RadioItemDef | CheckboxItemDef | SubmenuDef;
778
+ /** Breadcrumb nodes (submenu nodes from root to parent) */
779
+ breadcrumbs: BreadcrumbNode[];
780
+ /** The group this node belongs to, if any */
781
+ group: {
782
+ id: string;
783
+ label?: string;
784
+ groupDef: GroupDef;
785
+ } | null;
786
+ /** The radio group this node belongs to, if any */
787
+ radioGroup: {
788
+ id: string;
789
+ label?: string;
790
+ radioGroupDef: RadioGroupDef;
791
+ } | null;
792
+ }
793
+ /**
794
+ * Flattens a tree of node definitions into a flat array.
795
+ * When deep=true, includes children of submenus with their breadcrumb paths.
796
+ * Tracks group and radio group membership for each node.
797
+ */
798
+ declare function flattenNodes(nodes: NodeDef[], options?: FlattenOptions): FlattenedNode[];
799
+ /**
800
+ * Scores nodes against a search query.
801
+ * Returns only nodes with a score > 0.
802
+ */
803
+ declare function scoreNodes(flattenedNodes: FlattenedNode[], query: string): ScoredNode[];
804
+ /**
805
+ * Sorts scored nodes by score (descending).
806
+ */
807
+ declare function sortByScore(nodes: ScoredNode[]): ScoredNode[];
808
+ /**
809
+ * Partitions nodes: items first, then submenu triggers.
810
+ * This ensures items appear before submenu triggers in search results.
811
+ */
812
+ declare function partitionByKind(nodes: ScoredNode[]): ScoredNode[];
813
+ /**
814
+ * Deduplicates nodes by their composite ID (breadcrumbs + node.value).
815
+ * This handles the case where the same node appears multiple times in the tree.
816
+ * Values are normalized (trimmed) for consistent deduplication.
817
+ */
818
+ declare function deduplicateNodes(nodes: ScoredNode[]): ScoredNode[];
819
+ /**
820
+ * Converts scored nodes to display row nodes with render context.
821
+ * Used for flatten mode where groups are invisible.
822
+ */
823
+ declare function buildDisplayRowNodes(scoredNodes: ScoredNode[], query: string, highlightedId: string | null): DisplayRowNode[];
824
+ /**
825
+ * Gets nodes for browse mode (no search) with flatten behavior.
826
+ * Returns only top-level items and submenu triggers, flattening groups.
827
+ */
828
+ declare function getBrowseNodesFlatten(nodes: NodeDef[], highlightedId: string | null, group?: {
829
+ id: string;
830
+ label?: string;
831
+ } | null): DisplayRowNode[];
832
+ /**
833
+ * Gets nodes for browse mode (no search) with preserve behavior.
834
+ * Keeps group structure intact, showing group containers with their items.
835
+ */
836
+ declare function getBrowseNodesPreserve(nodes: NodeDef[], highlightedId: string | null): DisplayNode[];
837
+ interface FilterNodesOptions {
838
+ /** The search query */
839
+ query: string;
840
+ /** The node definitions to filter */
841
+ nodes: NodeDef[];
842
+ /** Currently highlighted node ID */
843
+ highlightedId: string | null;
844
+ /** Whether deep search is enabled */
845
+ deepSearch?: boolean;
846
+ /** Minimum query length for deep search */
847
+ minLength?: number;
848
+ /** How groups behave during search (only applies when searching, not browse mode) */
849
+ groupSearchBehavior?: GroupBehavior;
850
+ /** How radio groups behave during search */
851
+ radioGroupSearchBehavior?: RadioGroupBehavior;
852
+ /** Whether to sort groups by best score */
853
+ sortGroups?: boolean;
854
+ }
855
+ /**
856
+ * Main filtering pipeline.
857
+ * Handles both browse mode and search mode (shallow and deep).
858
+ * Respects groupSearchBehavior configuration (only applies during search).
859
+ * Note: Radio groups are ALWAYS preserved regardless of groupSearchBehavior.
860
+ */
861
+ declare function filterNodes(options: FilterNodesOptions): {
862
+ displayNodes: DisplayNode[];
863
+ isDeepSearching: boolean;
864
+ };
865
+ /**
866
+ * Gets the IDs of all navigable (non-disabled) nodes.
867
+ * Handles row nodes, group nodes, and radio group nodes (extracts item IDs).
868
+ * Separators are skipped as they're not navigable.
869
+ * Used for keyboard navigation.
870
+ *
871
+ * Note: Uses `node.id ?? node.value` as the identifier. For proper ID handling
872
+ * with custom getItemId functions, use `getOrderedItemIds` from DataList instead.
873
+ */
874
+ declare function getNavigableIds(displayNodes: DisplayNode[]): string[];
875
+ /**
876
+ * Gets the first navigable node ID.
877
+ */
878
+ declare function getFirstNavigableId(displayNodes: DisplayNode[]): string | null;
879
+ /**
880
+ * Info about an async submenu for registration with coordinator.
881
+ */
882
+ interface AsyncSubmenuInfo {
883
+ /** Unique identifier (uses node value and breadcrumbs) */
884
+ id: string;
885
+ /** Breadcrumbs path to this submenu */
886
+ breadcrumbs: string[];
887
+ /** The submenu node definition */
888
+ node: SubmenuDef;
889
+ /** The async configuration */
890
+ config: AsyncNodesConfig;
891
+ }
892
+ /**
893
+ * Collects all async submenus from a node tree.
894
+ * Recursively traverses groups and submenus to find all async configurations.
895
+ */
896
+ declare function collectAsyncSubmenus(nodes: NodeDef[], breadcrumbs?: string[]): AsyncSubmenuInfo[];
897
+ /**
898
+ * Merges async nodes into a submenu's node list.
899
+ * Static nodes come first, async nodes are appended.
900
+ */
901
+ declare function mergeSubmenuNodes(staticNodes: NodeDef[] | undefined, asyncNodes: NodeDef[] | undefined): NodeDef[];
902
+ /**
903
+ * Async data from the coordinator ready for merging.
904
+ */
905
+ interface AsyncNodeData {
906
+ id: string;
907
+ breadcrumbs: string[];
908
+ nodes: NodeDef[];
909
+ }
910
+ /**
911
+ * Creates a merged content tree with async nodes injected at their proper locations.
912
+ * This function modifies the tree to include async nodes where they belong.
913
+ */
914
+ declare function mergeAsyncNodesIntoTree(staticContent: NodeDef[], asyncData: AsyncNodeData[]): NodeDef[];
915
+ /**
916
+ * Checks if deep search should include this async config.
917
+ */
918
+ declare function shouldIncludeInDeepSearch(config: AsyncNodesConfig): boolean;
919
+ /**
920
+ * Checks if an async loader should be rendered eagerly.
921
+ * Eager loaders mount when the root menu opens (before their submenu is opened).
922
+ */
923
+ declare function shouldLoadEagerly(config: AsyncNodesConfig): boolean;
924
+
925
+ export { type AimGuardContextValue, AimGuardCtx, AimGuardProvider, type AimGuardProviderProps, type AnchorSide, AsyncLoaderConfig, AsyncLoaderResult, AsyncMenuCoordinatorContext, AsyncMenuCoordinatorProvider, type AsyncMenuCoordinatorValue, type AsyncMenuState, AsyncNodesConfig, AsyncState, type AsyncSubmenuInfo, BreadcrumbNode, CheckboxItemContext, type CheckboxItemContextValue, CheckboxItemDef, type ComponentName, ComponentNameContext, DisplayNode, DisplayRowNode, type FilterNodesOptions, FocusOwnerContext, type FocusOwnerState, FocusOwnerStore, GroupBehavior, GroupDef, ItemDef, NodeDef, OpenChainContext, type OpenChainState, OpenChainStore, PopupMenuArrowDataAttributes, PopupMenuBackdropDataAttributes, PopupMenuCheckboxItemDataAttributes, PopupMenuIconDataAttributes, PopupMenuItemDataAttributes, PopupMenuListDataAttributes, PopupMenuPopupDataAttributes, PopupMenuPositionerDataAttributes, PopupMenuProviders, type PopupMenuProvidersProps, PopupMenuRadioGroupDataAttributes, PopupMenuRadioItemDataAttributes, PopupMenuScrollArrowDataAttributes, PopupMenuShortcutDataAttributes, PopupMenuSubmenuTriggerDataAttributes, PopupSurfaceIdContext, RadioGroupBehavior, RadioGroupContext, type RadioGroupContextValue, RadioGroupDef, RadioItemContext, type RadioItemContextValue, RadioItemDef, ScoredNode, SubmenuContextValue, SubmenuDef, type UsePopupMenuKeyboardParams, type UsePopupMenuKeyboardReturn, type UsePopupMenuRootParams, type UsePopupMenuRootReturn, VirtualAnchor, VirtualItem, VirtualizationConfig, buildDisplayRowNodes, collectAsyncSubmenus, deduplicateNodes, defaultGetQualifiedRowId, filterNodes, flattenNodes, getBrowseNodesFlatten, getBrowseNodesPreserve, getFirstNavigableId, getNavigableIds, getSlotAttribute, getSmoothedHeading, isCheckboxItemDef, isGroupDef, isItemDef, isRadioGroupDef, isRadioItemDef, isSeparatorDef, isSubmenuDef, mergeAsyncNodesIntoTree, mergeSubmenuNodes, partitionByKind, resolveAnchorSide, scoreNodes, shouldIncludeInDeepSearch, shouldLoadEagerly, sortByScore, useAimGuard, useAsyncMenuCoordinator, useCheckboxItemContext, useComponentName, useFocusOwner, useMaybeAsyncMenuCoordinator, useMaybeComponentName, useMaybeFocusOwner, useMaybeOpenChain, useMouseTrail, useOpenChain, usePopupMenuKeyboard, usePopupMenuRoot, usePopupSurfaceId, useRadioGroupContext, useRadioItemContext, willHitSubmenu };