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