@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,678 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PopoverPositionerProps, Popover, PopoverRootProps } from '@base-ui/react/popover';
|
|
3
|
+
import { U as UseListboxItemParams, c as UseListboxItemReturn } from './use-listbox-item-BIi4eRPI.js';
|
|
4
|
+
import { C as ComponentProps, A as AsyncLoaderConfig, t as AsyncLoaderResult, a2 as NodeDef, z as AsyncState, M as DeepSearchConfig, Y as IncludeInDeepSearch, G as GetQualifiedRowIdFn, O as DisplayNode, I as DataListProps, H as DataListChildrenState, K as DataSubpagesProps, J as DataSubpagesChildrenState, L as DataSurfaceProps } from './types-lQCIvWW8.js';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import { r as RadioValueChangeEventDetails } from './events-BPr8sRGH.js';
|
|
7
|
+
import { V as VirtualItem } from './ListboxStore-DPqpLlAL.js';
|
|
8
|
+
import { a as PopupMenuRootActions } from './separator-B4Ot84B0.js';
|
|
9
|
+
|
|
10
|
+
interface SubmenuContextValue {
|
|
11
|
+
/** Whether the submenu is open */
|
|
12
|
+
open: boolean;
|
|
13
|
+
/** Set the submenu open state */
|
|
14
|
+
setOpen: (open: boolean) => void;
|
|
15
|
+
/** Reference to the trigger element */
|
|
16
|
+
triggerRef: React.RefObject<HTMLElement | null>;
|
|
17
|
+
/** Reference to the submenu content element (for aim guard rect calculations) */
|
|
18
|
+
contentRef: React.RefObject<HTMLElement | null>;
|
|
19
|
+
/** Surface ID of the parent menu (for keyboard navigation back) */
|
|
20
|
+
parentSurfaceId: string;
|
|
21
|
+
/** Surface ID of this submenu (for keyboard navigation into) */
|
|
22
|
+
childSurfaceId: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether pressing Escape in this submenu closes the entire menu from the root.
|
|
25
|
+
* When true, Escape closes the entire menu tree.
|
|
26
|
+
* When false, Escape only closes this submenu and moves focus to the parent.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
closeRootOnEsc: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const SubmenuContext: React.Context<SubmenuContextValue | null>;
|
|
32
|
+
declare function useSubmenuContext(): SubmenuContextValue;
|
|
33
|
+
declare function useMaybeSubmenuContext(): SubmenuContextValue | null;
|
|
34
|
+
|
|
35
|
+
interface SubpageContextValue {
|
|
36
|
+
/** Current page ID. */
|
|
37
|
+
pageId: string;
|
|
38
|
+
/** Surface ID for this page. */
|
|
39
|
+
surfaceId: string;
|
|
40
|
+
/** Surface ID for the previous page, if available. */
|
|
41
|
+
parentSurfaceId: string | null;
|
|
42
|
+
/** Whether this page is currently active. */
|
|
43
|
+
isActive: boolean;
|
|
44
|
+
/** Whether Escape should close the entire menu tree from this page. */
|
|
45
|
+
closeRootOnEsc: boolean;
|
|
46
|
+
/** Navigate back one page. Returns true when navigation happened. */
|
|
47
|
+
goBack: () => boolean;
|
|
48
|
+
}
|
|
49
|
+
declare const SubpageContext: React.Context<SubpageContextValue | null>;
|
|
50
|
+
declare function useSubpageContext(): SubpageContextValue;
|
|
51
|
+
declare function useMaybeSubpageContext(): SubpageContextValue | null;
|
|
52
|
+
|
|
53
|
+
declare const ROOT_SUBPAGE_ID = "__root__";
|
|
54
|
+
interface SubpageRegistration {
|
|
55
|
+
pageId: string;
|
|
56
|
+
surfaceId: string;
|
|
57
|
+
closeRootOnEsc: boolean;
|
|
58
|
+
}
|
|
59
|
+
interface SubpageStackContextValue {
|
|
60
|
+
/** Currently active page ID. */
|
|
61
|
+
activePageId: string;
|
|
62
|
+
/** Surface ID for the currently active page. */
|
|
63
|
+
activeSurfaceId: string;
|
|
64
|
+
/** Whether there is a previous page to navigate back to. */
|
|
65
|
+
canGoBack: boolean;
|
|
66
|
+
/** Whether Escape in the active page should close the entire menu tree. */
|
|
67
|
+
shouldCloseRootOnEsc: boolean;
|
|
68
|
+
/** Current page stack from root to active page. */
|
|
69
|
+
stack: readonly string[];
|
|
70
|
+
/** Register a page and return an unregister cleanup. */
|
|
71
|
+
registerPage: (registration: SubpageRegistration) => () => void;
|
|
72
|
+
/** Push a page onto the stack. Returns true when navigation happened. */
|
|
73
|
+
openPage: (pageId: string) => boolean;
|
|
74
|
+
/** Pop one page from the stack. Returns true when navigation happened. */
|
|
75
|
+
goBack: () => boolean;
|
|
76
|
+
/** Resolve a surface ID for a page ID. */
|
|
77
|
+
getSurfaceId: (pageId: string) => string | null;
|
|
78
|
+
}
|
|
79
|
+
declare const SubpageStackContext: React.Context<SubpageStackContextValue | null>;
|
|
80
|
+
declare function useSubpageStack(): SubpageStackContextValue;
|
|
81
|
+
declare function useMaybeSubpageStack(): SubpageStackContextValue | null;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Extended align options for popup menus.
|
|
85
|
+
* - 'start' | 'center' | 'end': Standard Base UI alignment
|
|
86
|
+
* - 'list-start': Align trigger top with the top of the List component (horizontal sides only)
|
|
87
|
+
*/
|
|
88
|
+
type PopupMenuPositionerAlign = PopoverPositionerProps['align'] | 'list-start';
|
|
89
|
+
interface PopupMenuPositionerProps extends Omit<PopoverPositionerProps, 'align' | 'style'> {
|
|
90
|
+
/**
|
|
91
|
+
* Override the virtual anchor from context.
|
|
92
|
+
* Useful for nested menus that need different positioning.
|
|
93
|
+
*/
|
|
94
|
+
virtualAnchor?: {
|
|
95
|
+
getBoundingClientRect(): DOMRect;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* How to align the popup relative to the specified side.
|
|
99
|
+
* - 'start': align to start of anchor
|
|
100
|
+
* - 'center': align to center of anchor
|
|
101
|
+
* - 'end': align to end of anchor
|
|
102
|
+
* - 'list-start': align the List component's top with the anchor top (horizontal sides only)
|
|
103
|
+
* @default 'start' for submenus, 'center' for root dropdowns
|
|
104
|
+
*/
|
|
105
|
+
align?: PopupMenuPositionerAlign;
|
|
106
|
+
/**
|
|
107
|
+
* Custom styles for the positioner.
|
|
108
|
+
* Note: During list-start alignment measurement, `transition: 'none'` is
|
|
109
|
+
* temporarily applied to prevent visual flash.
|
|
110
|
+
*/
|
|
111
|
+
style?: React.CSSProperties;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Positions the popup menu against its anchor.
|
|
115
|
+
* Wraps Popover.Positioner with:
|
|
116
|
+
* - Automatic virtualAnchor from PopupMenuContext (for context menus)
|
|
117
|
+
* - Smart default positioning based on depth and menu type
|
|
118
|
+
* - Smart collision avoidance: shift for horizontal menus, flip for vertical
|
|
119
|
+
* - 'list-start' alignment for horizontal submenus
|
|
120
|
+
*
|
|
121
|
+
* Renders a `<div>` element.
|
|
122
|
+
*/
|
|
123
|
+
declare const PopupMenuPositioner: React.ForwardRefExoticComponent<PopupMenuPositionerProps & React.RefAttributes<HTMLDivElement>>;
|
|
124
|
+
declare namespace PopupMenuPositioner {
|
|
125
|
+
type Props = PopupMenuPositionerProps;
|
|
126
|
+
type State = Popover.Positioner.State;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface UsePopupMenuItemParams extends Omit<UseListboxItemParams, 'aimGuard' | 'onAfterSelect'> {
|
|
130
|
+
/**
|
|
131
|
+
* Whether clicking this item should close the menu.
|
|
132
|
+
* @default true
|
|
133
|
+
*/
|
|
134
|
+
closeOnClick?: boolean;
|
|
135
|
+
}
|
|
136
|
+
interface UsePopupMenuItemReturn extends UseListboxItemReturn {
|
|
137
|
+
/** Whether this item is effectively disabled (item disabled OR menu disabled). */
|
|
138
|
+
disabled: boolean;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Hook that provides all shared logic for navigatable/highlightable popup menu items.
|
|
142
|
+
* This is a thin wrapper around useListboxItem that automatically adds aim-guard
|
|
143
|
+
* support and handles close-on-click behavior.
|
|
144
|
+
*
|
|
145
|
+
* @see useListboxItem for full documentation
|
|
146
|
+
*/
|
|
147
|
+
declare function usePopupMenuItem(params: UsePopupMenuItemParams): UsePopupMenuItemReturn;
|
|
148
|
+
|
|
149
|
+
interface PopupMenuCheckboxItemIndicatorState extends Record<string, unknown> {
|
|
150
|
+
/**
|
|
151
|
+
* Whether the parent checkbox item is currently checked.
|
|
152
|
+
*/
|
|
153
|
+
checked: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Whether the parent checkbox item is currently highlighted.
|
|
156
|
+
*/
|
|
157
|
+
highlighted: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Whether the parent checkbox item is disabled.
|
|
160
|
+
*/
|
|
161
|
+
disabled: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Toggle the checked state without triggering closeOnClick.
|
|
164
|
+
* Useful when you want clicking directly on the indicator to toggle
|
|
165
|
+
* without closing the menu.
|
|
166
|
+
*/
|
|
167
|
+
toggle: () => void;
|
|
168
|
+
}
|
|
169
|
+
interface PopupMenuCheckboxItemIndicatorProps extends ComponentProps<'span', PopupMenuCheckboxItemIndicator.State> {
|
|
170
|
+
/**
|
|
171
|
+
* Whether to keep the indicator mounted in the DOM when unchecked.
|
|
172
|
+
* Useful for animations.
|
|
173
|
+
* @default false
|
|
174
|
+
*/
|
|
175
|
+
keepMounted?: boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* A visual indicator that shows when a CheckboxItem is checked.
|
|
179
|
+
* Must be used within a CheckboxItem component.
|
|
180
|
+
* Renders a `<span>` element with aria-hidden="true".
|
|
181
|
+
*/
|
|
182
|
+
declare const PopupMenuCheckboxItemIndicator: React.ForwardRefExoticComponent<Omit<PopupMenuCheckboxItemIndicator.Props, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
183
|
+
declare namespace PopupMenuCheckboxItemIndicator {
|
|
184
|
+
type State = PopupMenuCheckboxItemIndicatorState;
|
|
185
|
+
interface Props extends PopupMenuCheckboxItemIndicatorProps {
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
interface PopupMenuRadioGroupValueProps {
|
|
190
|
+
/**
|
|
191
|
+
* The controlled selected value.
|
|
192
|
+
*/
|
|
193
|
+
value: string | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* Callback fired when the selected value changes.
|
|
196
|
+
* The second parameter contains event details including the reason for the change.
|
|
197
|
+
*/
|
|
198
|
+
onValueChange?: (value: string, eventDetails: RadioValueChangeEventDetails) => void;
|
|
199
|
+
/**
|
|
200
|
+
* Whether all items in this group are disabled.
|
|
201
|
+
* @default false
|
|
202
|
+
*/
|
|
203
|
+
disabled?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Children to render within the radio group context.
|
|
206
|
+
*/
|
|
207
|
+
children: React.ReactNode;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Headless provider for radio group state.
|
|
211
|
+
* Use this to wrap DataSurface when using RadioItems in deep search.
|
|
212
|
+
* Does not render any DOM element - only provides context.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```tsx
|
|
216
|
+
* const [theme, setTheme] = useState('light')
|
|
217
|
+
*
|
|
218
|
+
* <DropdownMenu.RadioGroupValue value={theme} onValueChange={setTheme}>
|
|
219
|
+
* <DropdownMenu.DataSurface content={content}>
|
|
220
|
+
* ...
|
|
221
|
+
* </DropdownMenu.DataSurface>
|
|
222
|
+
* </DropdownMenu.RadioGroupValue>
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
declare function PopupMenuRadioGroupValue(props: PopupMenuRadioGroupValueProps): react_jsx_runtime.JSX.Element;
|
|
226
|
+
declare namespace PopupMenuRadioGroupValue {
|
|
227
|
+
interface Props extends PopupMenuRadioGroupValueProps {
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
interface PopupMenuRadioItemIndicatorState extends Record<string, unknown> {
|
|
232
|
+
/**
|
|
233
|
+
* Whether the parent radio item is currently selected/checked.
|
|
234
|
+
*/
|
|
235
|
+
checked: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Whether the parent radio item is currently highlighted.
|
|
238
|
+
*/
|
|
239
|
+
highlighted: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Whether the parent radio item is disabled.
|
|
242
|
+
*/
|
|
243
|
+
disabled: boolean;
|
|
244
|
+
}
|
|
245
|
+
interface PopupMenuRadioItemIndicatorProps extends ComponentProps<'span', PopupMenuRadioItemIndicator.State> {
|
|
246
|
+
/**
|
|
247
|
+
* Whether to keep the indicator mounted in the DOM when unchecked.
|
|
248
|
+
* Useful for animations.
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
keepMounted?: boolean;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* A visual indicator that shows when a RadioItem is selected.
|
|
255
|
+
* Must be used within a RadioItem component.
|
|
256
|
+
* Renders a `<span>` element with aria-hidden="true".
|
|
257
|
+
*/
|
|
258
|
+
declare const PopupMenuRadioItemIndicator: React.ForwardRefExoticComponent<Omit<PopupMenuRadioItemIndicator.Props, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
259
|
+
declare namespace PopupMenuRadioItemIndicator {
|
|
260
|
+
type State = PopupMenuRadioItemIndicatorState;
|
|
261
|
+
interface Props extends PopupMenuRadioItemIndicatorProps {
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* State for the Shortcut component, passed to children render function.
|
|
267
|
+
*/
|
|
268
|
+
interface PopupMenuShortcutState extends Record<string, unknown> {
|
|
269
|
+
/**
|
|
270
|
+
* The keyboard shortcut value from the parent Item.
|
|
271
|
+
*/
|
|
272
|
+
shortcut: string | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Whether the parent item is highlighted.
|
|
275
|
+
*/
|
|
276
|
+
highlighted: boolean;
|
|
277
|
+
}
|
|
278
|
+
interface PopupMenuShortcutProps extends Omit<ComponentProps<'kbd', PopupMenuShortcut.State>, 'children'> {
|
|
279
|
+
/**
|
|
280
|
+
* Content to render inside the shortcut.
|
|
281
|
+
* Can be a render function that receives the shortcut value.
|
|
282
|
+
* If not provided, renders the shortcut value from the parent Item.
|
|
283
|
+
*/
|
|
284
|
+
children?: React.ReactNode | ((state: PopupMenuShortcutState) => React.ReactNode);
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Displays the keyboard shortcut for a menu item.
|
|
288
|
+
* Must be used within a PopupMenu.Item component.
|
|
289
|
+
* Renders a `<kbd>` element by default.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```tsx
|
|
293
|
+
* // Auto-renders the shortcut value
|
|
294
|
+
* <PopupMenu.Item shortcut="1">
|
|
295
|
+
* Icebox
|
|
296
|
+
* <PopupMenu.Shortcut />
|
|
297
|
+
* </PopupMenu.Item>
|
|
298
|
+
*
|
|
299
|
+
* // Custom rendering with children as function
|
|
300
|
+
* <PopupMenu.Item shortcut="1">
|
|
301
|
+
* Icebox
|
|
302
|
+
* <PopupMenu.Shortcut>
|
|
303
|
+
* {({ shortcut }) => <span className="key">{shortcut}</span>}
|
|
304
|
+
* </PopupMenu.Shortcut>
|
|
305
|
+
* </PopupMenu.Item>
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
declare const PopupMenuShortcut: React.ForwardRefExoticComponent<Omit<PopupMenuShortcut.Props, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
309
|
+
declare namespace PopupMenuShortcut {
|
|
310
|
+
type State = PopupMenuShortcutState;
|
|
311
|
+
interface Props extends PopupMenuShortcutProps {
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
interface PopupMenuSubmenuRootProps extends Omit<PopoverRootProps, 'open' | 'onOpenChange' | 'defaultOpen' | 'actionsRef'> {
|
|
316
|
+
/**
|
|
317
|
+
* Whether the submenu is open.
|
|
318
|
+
* Use for controlled mode.
|
|
319
|
+
*/
|
|
320
|
+
open?: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Callback when the open state changes.
|
|
323
|
+
* The second parameter contains event details including the reason for the change.
|
|
324
|
+
*/
|
|
325
|
+
onOpenChange?: (open: boolean, eventDetails: Popover.Root.ChangeEventDetails) => void;
|
|
326
|
+
/**
|
|
327
|
+
* Whether the submenu is initially open.
|
|
328
|
+
* Use for uncontrolled mode.
|
|
329
|
+
* @default false
|
|
330
|
+
*/
|
|
331
|
+
defaultOpen?: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Whether pressing Escape in this submenu closes the entire menu from the root.
|
|
334
|
+
* When true (default), Escape closes the entire menu tree.
|
|
335
|
+
* When false, Escape only closes this submenu and moves focus to the parent.
|
|
336
|
+
* @default true
|
|
337
|
+
*/
|
|
338
|
+
closeRootOnEsc?: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Whether virtualization mode is enabled for this submenu.
|
|
341
|
+
* When true, items should provide an explicit `index` prop and
|
|
342
|
+
* the `items` prop should be provided for navigation to work correctly.
|
|
343
|
+
* @default false
|
|
344
|
+
*/
|
|
345
|
+
virtualized?: boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Pre-registered items for virtualization.
|
|
348
|
+
* When provided with `virtualized={true}`, this allows navigation to work
|
|
349
|
+
* for items that aren't currently mounted in the DOM.
|
|
350
|
+
*/
|
|
351
|
+
items?: VirtualItem[];
|
|
352
|
+
/**
|
|
353
|
+
* Callback when the highlighted item changes.
|
|
354
|
+
* Useful for synchronizing with a virtualizer (e.g., scrollToIndex).
|
|
355
|
+
*/
|
|
356
|
+
onHighlightChange?: (id: string | null, index: number) => void;
|
|
357
|
+
/**
|
|
358
|
+
* Event handler called after any open/close animations have completed.
|
|
359
|
+
* When `clearSearchOnClose="after-exit"` is set on Surface, the search
|
|
360
|
+
* will be cleared before this callback is invoked.
|
|
361
|
+
*/
|
|
362
|
+
onOpenChangeComplete?: (open: boolean) => void;
|
|
363
|
+
/**
|
|
364
|
+
* Whether this submenu should ignore user interaction.
|
|
365
|
+
* Also inherits disabled state from its parent menu.
|
|
366
|
+
* @default false
|
|
367
|
+
*/
|
|
368
|
+
disabled?: boolean;
|
|
369
|
+
/**
|
|
370
|
+
* A ref to imperative actions.
|
|
371
|
+
* - `close`: closes the submenu imperatively.
|
|
372
|
+
* - `unmount`: unmounts the popup imperatively (when keep-mounted mode is enabled).
|
|
373
|
+
* - `setDisabled`: enables/disables the submenu imperatively.
|
|
374
|
+
*/
|
|
375
|
+
actionsRef?: React.RefObject<PopupMenuSubmenuRoot.Actions | null>;
|
|
376
|
+
children: React.ReactNode;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Groups all parts of a submenu.
|
|
380
|
+
* Manages open state and provides context to children.
|
|
381
|
+
* Creates its own ListboxStore independent from the parent menu.
|
|
382
|
+
* Doesn't render its own HTML element.
|
|
383
|
+
*/
|
|
384
|
+
declare function PopupMenuSubmenuRoot(props: PopupMenuSubmenuRootProps): react_jsx_runtime.JSX.Element;
|
|
385
|
+
declare namespace PopupMenuSubmenuRoot {
|
|
386
|
+
interface Props extends PopupMenuSubmenuRootProps {
|
|
387
|
+
}
|
|
388
|
+
type ChangeEventDetails = Popover.Root.ChangeEventDetails;
|
|
389
|
+
type Actions = PopupMenuRootActions;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
interface PopupMenuSubmenuTriggerIndicatorState extends Record<string, unknown> {
|
|
393
|
+
/**
|
|
394
|
+
* Whether the submenu popup is open.
|
|
395
|
+
*/
|
|
396
|
+
popupOpen: boolean;
|
|
397
|
+
/**
|
|
398
|
+
* Whether the submenu owns keyboard focus.
|
|
399
|
+
*/
|
|
400
|
+
popupFocused: boolean;
|
|
401
|
+
}
|
|
402
|
+
interface PopupMenuSubmenuTriggerIndicatorProps extends ComponentProps<'span', PopupMenuSubmenuTriggerIndicator.State> {
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* An indicator element for submenu triggers that reflects the submenu's open and focus state.
|
|
406
|
+
* Typically used to render a chevron or arrow icon.
|
|
407
|
+
* Must be used within PopupMenu.SubmenuTrigger.
|
|
408
|
+
* Renders a `<span>` element.
|
|
409
|
+
*/
|
|
410
|
+
declare const PopupMenuSubmenuTriggerIndicator: React.ForwardRefExoticComponent<Omit<PopupMenuSubmenuTriggerIndicator.Props, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
411
|
+
declare namespace PopupMenuSubmenuTriggerIndicator {
|
|
412
|
+
type State = PopupMenuSubmenuTriggerIndicatorState;
|
|
413
|
+
interface Props extends PopupMenuSubmenuTriggerIndicatorProps {
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
interface PopupMenuSubpageProps {
|
|
418
|
+
/** Unique page ID for stack navigation. */
|
|
419
|
+
pageId: string;
|
|
420
|
+
/**
|
|
421
|
+
* Whether pressing Escape in this page closes the entire menu tree.
|
|
422
|
+
* When false (default), Escape navigates back one page.
|
|
423
|
+
* @default false
|
|
424
|
+
*/
|
|
425
|
+
closeRootOnEsc?: boolean;
|
|
426
|
+
children: React.ReactNode;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Groups all parts of a subpage.
|
|
430
|
+
* Creates an isolated menu surface that renders in the same popup and
|
|
431
|
+
* participates in push/pop page stack navigation.
|
|
432
|
+
* Doesn't render its own HTML element.
|
|
433
|
+
*/
|
|
434
|
+
declare function PopupMenuSubpage(props: PopupMenuSubpageProps): react_jsx_runtime.JSX.Element;
|
|
435
|
+
declare namespace PopupMenuSubpage {
|
|
436
|
+
interface Props extends PopupMenuSubpageProps {
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
interface PopupMenuSubpageBackState extends Record<string, unknown> {
|
|
441
|
+
/** Whether navigating back is currently possible. */
|
|
442
|
+
canGoBack: boolean;
|
|
443
|
+
/** Whether the button is disabled. */
|
|
444
|
+
disabled: boolean;
|
|
445
|
+
}
|
|
446
|
+
interface PopupMenuSubpageBackProps extends ComponentProps<'button', PopupMenuSubpageBack.State> {
|
|
447
|
+
/** Whether this button is disabled. */
|
|
448
|
+
disabled?: boolean;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* A button that navigates back one page in the current subpage stack.
|
|
452
|
+
* Useful for custom headers/toolbars outside of list rows.
|
|
453
|
+
* Renders a `<button>` element.
|
|
454
|
+
*/
|
|
455
|
+
declare const PopupMenuSubpageBack: React.ForwardRefExoticComponent<Omit<PopupMenuSubpageBack.Props, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
456
|
+
declare namespace PopupMenuSubpageBack {
|
|
457
|
+
type State = PopupMenuSubpageBackState;
|
|
458
|
+
interface Props extends PopupMenuSubpageBackProps {
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
interface PopupMenuSubpageBackItemState extends Record<string, unknown> {
|
|
463
|
+
/** Whether this is a subpage back item (always true). */
|
|
464
|
+
subpageBackItem: boolean;
|
|
465
|
+
/** Whether the item is highlighted. */
|
|
466
|
+
highlighted: boolean;
|
|
467
|
+
/** Whether the item is disabled. */
|
|
468
|
+
disabled: boolean;
|
|
469
|
+
}
|
|
470
|
+
interface PopupMenuSubpageBackItemProps extends ComponentProps<'div', PopupMenuSubpageBackItem.State> {
|
|
471
|
+
/** Explicit unique identifier for this item in the store. */
|
|
472
|
+
id?: string;
|
|
473
|
+
/** Unique value for this item used for filtering. */
|
|
474
|
+
value?: string;
|
|
475
|
+
/** Additional keywords to match against when filtering. */
|
|
476
|
+
keywords?: string[];
|
|
477
|
+
/** Whether this item is disabled. */
|
|
478
|
+
disabled?: boolean;
|
|
479
|
+
/** Whether to force render this item regardless of filter results. */
|
|
480
|
+
forceMount?: boolean;
|
|
481
|
+
/** Callback when this item is selected. */
|
|
482
|
+
onSelect?: () => void;
|
|
483
|
+
/**
|
|
484
|
+
* Async callback when this item is selected.
|
|
485
|
+
*
|
|
486
|
+
* When provided, this takes precedence over `onSelect`.
|
|
487
|
+
* If provided, this callback is awaited before navigating back.
|
|
488
|
+
* Return `false` to prevent automatic navigation.
|
|
489
|
+
*/
|
|
490
|
+
onSelectAsync?: (context: PopupMenuSubpageBackItem.OnSelectAsyncContext) => Promise<void | boolean>;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* A list row that navigates back one page in the current subpage stack.
|
|
494
|
+
* Renders a `<div>` element with role="option".
|
|
495
|
+
*/
|
|
496
|
+
declare const PopupMenuSubpageBackItem: React.ForwardRefExoticComponent<Omit<PopupMenuSubpageBackItem.Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
497
|
+
declare namespace PopupMenuSubpageBackItem {
|
|
498
|
+
type State = PopupMenuSubpageBackItemState;
|
|
499
|
+
interface OnSelectAsyncContext {
|
|
500
|
+
/** Navigate back one page manually. */
|
|
501
|
+
goBack: () => boolean;
|
|
502
|
+
/** Aborts when a pending async selection is canceled or unmounted. */
|
|
503
|
+
signal: AbortSignal;
|
|
504
|
+
}
|
|
505
|
+
interface Props extends PopupMenuSubpageBackItemProps {
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* State for a registered async loader.
|
|
511
|
+
*/
|
|
512
|
+
interface AsyncMenuState {
|
|
513
|
+
/** Unique identifier for this async menu */
|
|
514
|
+
id: string;
|
|
515
|
+
/** Breadcrumbs path to this menu (for merging into tree) */
|
|
516
|
+
breadcrumbs: string[];
|
|
517
|
+
/** The loader configuration */
|
|
518
|
+
config: AsyncLoaderConfig;
|
|
519
|
+
/** Current loader result */
|
|
520
|
+
result: AsyncLoaderResult<NodeDef[]>;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Context value for the async menu coordinator.
|
|
524
|
+
*/
|
|
525
|
+
interface AsyncMenuCoordinatorValue {
|
|
526
|
+
/** Register a new async loader */
|
|
527
|
+
registerLoader: (state: AsyncMenuState) => void;
|
|
528
|
+
/** Unregister an async loader */
|
|
529
|
+
unregisterLoader: (id: string) => void;
|
|
530
|
+
/** Update loader result */
|
|
531
|
+
updateLoaderResult: (id: string, result: AsyncLoaderResult<NodeDef[]>) => void;
|
|
532
|
+
/** Current search query from the store */
|
|
533
|
+
searchQuery: string;
|
|
534
|
+
/** All registered loaders */
|
|
535
|
+
loaders: Map<string, AsyncMenuState>;
|
|
536
|
+
/** Any loader is currently in initial loading phase */
|
|
537
|
+
isAnyLoading: boolean;
|
|
538
|
+
/** Any loader is currently fetching (initial or background) */
|
|
539
|
+
isAnyFetching: boolean;
|
|
540
|
+
/** Any loader is currently in first-load phase */
|
|
541
|
+
isAnyInitialLoading: boolean;
|
|
542
|
+
/** Any loader is currently in background refetch phase */
|
|
543
|
+
isAnyRefetching: boolean;
|
|
544
|
+
/** All registered loaders are currently in background refetch phase */
|
|
545
|
+
isAllRefetching: boolean;
|
|
546
|
+
/** The root (__root__) loader is currently in initial loading phase */
|
|
547
|
+
isRootLoading: boolean;
|
|
548
|
+
/** Static loaders are currently in initial loading phase */
|
|
549
|
+
isStaticLoading: boolean;
|
|
550
|
+
/** Static loaders are currently fetching */
|
|
551
|
+
isStaticFetching: boolean;
|
|
552
|
+
/** Static loaders in first-load phase */
|
|
553
|
+
isStaticInitialLoading: boolean;
|
|
554
|
+
/** Static loaders in background refetch phase */
|
|
555
|
+
isStaticRefetching: boolean;
|
|
556
|
+
/** Query loaders are currently in initial loading phase */
|
|
557
|
+
isQueryLoading: boolean;
|
|
558
|
+
/** Query loaders are currently fetching */
|
|
559
|
+
isQueryFetching: boolean;
|
|
560
|
+
/** Query loaders in first-load phase */
|
|
561
|
+
isQueryInitialLoading: boolean;
|
|
562
|
+
/** Query loaders in background refetch phase */
|
|
563
|
+
isQueryRefetching: boolean;
|
|
564
|
+
/** All loaders have resolved (not fetching) */
|
|
565
|
+
allResolved: boolean;
|
|
566
|
+
/** Get all resolved async nodes with their breadcrumbs */
|
|
567
|
+
getAsyncNodes: () => Array<{
|
|
568
|
+
id: string;
|
|
569
|
+
breadcrumbs: string[];
|
|
570
|
+
nodes: NodeDef[];
|
|
571
|
+
}>;
|
|
572
|
+
/** Loaders that errored */
|
|
573
|
+
erroredLoaders: Map<string, Error>;
|
|
574
|
+
/** Get the aggregate async state for DataList */
|
|
575
|
+
getAsyncState: () => AsyncState;
|
|
576
|
+
}
|
|
577
|
+
declare const AsyncMenuCoordinatorContext: React.Context<AsyncMenuCoordinatorValue | null>;
|
|
578
|
+
declare function useAsyncMenuCoordinator(): AsyncMenuCoordinatorValue | null;
|
|
579
|
+
declare function useMaybeAsyncMenuCoordinator(): AsyncMenuCoordinatorValue | null;
|
|
580
|
+
interface AsyncMenuCoordinatorProviderProps {
|
|
581
|
+
/** Children to render */
|
|
582
|
+
children: React.ReactNode;
|
|
583
|
+
/** Current search query from the store */
|
|
584
|
+
searchQuery: string;
|
|
585
|
+
}
|
|
586
|
+
declare function AsyncMenuCoordinatorProvider(props: AsyncMenuCoordinatorProviderProps): react_jsx_runtime.JSX.Element;
|
|
587
|
+
|
|
588
|
+
interface DataSurfaceContextValue {
|
|
589
|
+
/** The original node definitions */
|
|
590
|
+
content: NodeDef[];
|
|
591
|
+
/** Async content configuration for root-level async loading */
|
|
592
|
+
asyncContent?: AsyncLoaderConfig;
|
|
593
|
+
/** Deep search configuration */
|
|
594
|
+
deepSearchConfig: DeepSearchConfig;
|
|
595
|
+
/** Default submenu inclusion mode for deep search */
|
|
596
|
+
includeInDeepSearch: IncludeInDeepSearch;
|
|
597
|
+
/** List element ID for aria-activedescendant */
|
|
598
|
+
listId: string;
|
|
599
|
+
/** Function to generate qualified IDs for row items */
|
|
600
|
+
getQualifiedRowId: GetQualifiedRowIdFn;
|
|
601
|
+
}
|
|
602
|
+
declare const DataSurfaceContext: React.Context<DataSurfaceContextValue | null>;
|
|
603
|
+
interface DataPopupContextValue {
|
|
604
|
+
/** Latest DataSurface context registered within this popup. */
|
|
605
|
+
dataSurfaceContext: DataSurfaceContextValue | null;
|
|
606
|
+
/** Registers/clears DataSurface context for sibling consumers. */
|
|
607
|
+
setDataSurfaceContext: React.Dispatch<React.SetStateAction<DataSurfaceContextValue | null>>;
|
|
608
|
+
}
|
|
609
|
+
declare const DataPopupContext: React.Context<DataPopupContextValue | null>;
|
|
610
|
+
declare function useDataSurfaceContext(): DataSurfaceContextValue;
|
|
611
|
+
declare function useMaybeDataSurfaceContext(): DataSurfaceContextValue | null;
|
|
612
|
+
declare function useDataPopupContext(): DataPopupContextValue;
|
|
613
|
+
declare function useMaybeDataPopupContext(): DataPopupContextValue | null;
|
|
614
|
+
type RenderNodeFn = (displayNode: DisplayNode) => React.ReactNode;
|
|
615
|
+
|
|
616
|
+
interface PopupMenuDataListProps extends DataListProps {
|
|
617
|
+
/** Render function for custom element */
|
|
618
|
+
render?: React.ReactElement;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* DataList renders the menu items using a render prop pattern.
|
|
622
|
+
* It reads from the store for search and computes filtered nodes.
|
|
623
|
+
*
|
|
624
|
+
* Place inside PopupMenuDataSurface.
|
|
625
|
+
* Wraps PopupMenuList for keyboard navigation and accessibility.
|
|
626
|
+
*/
|
|
627
|
+
declare const PopupMenuDataList: React.ForwardRefExoticComponent<PopupMenuDataList.Props & React.RefAttributes<HTMLDivElement>>;
|
|
628
|
+
declare namespace PopupMenuDataList {
|
|
629
|
+
interface Props extends PopupMenuDataListProps {
|
|
630
|
+
}
|
|
631
|
+
type ChildrenState = DataListChildrenState;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
interface PopupMenuDataSubpagesProps extends DataSubpagesProps {
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* DataSubpages renders subpage content alongside the root Surface inside Popup.
|
|
638
|
+
*
|
|
639
|
+
* Place it as a sibling to DataSurface within Popup:
|
|
640
|
+
*
|
|
641
|
+
* ```tsx
|
|
642
|
+
* <Popup>
|
|
643
|
+
* <DataSurface ...>
|
|
644
|
+
* ...
|
|
645
|
+
* </DataSurface>
|
|
646
|
+
* <DataSubpages />
|
|
647
|
+
* </Popup>
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
declare function PopupMenuDataSubpages(props: PopupMenuDataSubpagesProps): react_jsx_runtime.JSX.Element | null;
|
|
651
|
+
declare namespace PopupMenuDataSubpages {
|
|
652
|
+
interface Props extends PopupMenuDataSubpagesProps {
|
|
653
|
+
}
|
|
654
|
+
type ChildrenState = DataSubpagesChildrenState;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
interface PopupMenuDataSurfaceProps extends DataSurfaceProps {
|
|
658
|
+
/** Custom class name */
|
|
659
|
+
className?: string;
|
|
660
|
+
/** Custom styles */
|
|
661
|
+
style?: React.CSSProperties;
|
|
662
|
+
/** Render function for custom element */
|
|
663
|
+
render?: React.ReactElement;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* DataSurface provides deep search functionality for popup menus.
|
|
667
|
+
* It wraps the standard Surface and adds data-first search capabilities.
|
|
668
|
+
*
|
|
669
|
+
* Place inside PopupMenu.Popup to enable deep search functionality.
|
|
670
|
+
* Renders a `<div>` element.
|
|
671
|
+
*/
|
|
672
|
+
declare const PopupMenuDataSurface: React.ForwardRefExoticComponent<PopupMenuDataSurface.Props & React.RefAttributes<HTMLDivElement>>;
|
|
673
|
+
declare namespace PopupMenuDataSurface {
|
|
674
|
+
interface Props extends PopupMenuDataSurfaceProps {
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export { SubmenuContext as $, type PopupMenuSubpageBackItemState as A, type PopupMenuSubpageBackProps as B, type PopupMenuSubpageBackState as C, type PopupMenuSubpageProps as D, type SubpageContextValue as E, type SubpageStackContextValue as F, useMaybeSubmenuContext as G, useMaybeSubpageContext as H, useMaybeSubpageStack as I, useSubmenuContext as J, useSubpageContext as K, useSubpageStack as L, type UsePopupMenuItemReturn as M, usePopupMenuItem as N, type AsyncMenuCoordinatorValue as O, PopupMenuCheckboxItemIndicator as P, type DataSurfaceContextValue as Q, type PopupMenuDataListProps as R, type SubmenuContextValue as S, type PopupMenuDataSubpagesProps as T, type UsePopupMenuItemParams as U, type PopupMenuDataSurfaceProps as V, type PopupMenuRadioGroupValueProps as W, type RenderNodeFn as X, DataSurfaceContext as Y, useDataSurfaceContext as Z, useMaybeDataSurfaceContext as _, PopupMenuDataList as a, SubpageContext as a0, type SubpageRegistration as a1, ROOT_SUBPAGE_ID as a2, SubpageStackContext as a3, type AsyncMenuState as a4, AsyncMenuCoordinatorContext as a5, AsyncMenuCoordinatorProvider as a6, type DataPopupContextValue as a7, DataPopupContext as a8, useDataPopupContext as a9, useMaybeDataPopupContext as aa, PopupMenuDataSubpages as b, PopupMenuDataSurface as c, PopupMenuPositioner as d, PopupMenuRadioGroupValue as e, PopupMenuRadioItemIndicator as f, PopupMenuShortcut as g, PopupMenuSubmenuRoot as h, PopupMenuSubmenuTriggerIndicator as i, PopupMenuSubpage as j, PopupMenuSubpageBack as k, PopupMenuSubpageBackItem as l, useMaybeAsyncMenuCoordinator as m, type PopupMenuCheckboxItemIndicatorProps as n, type PopupMenuCheckboxItemIndicatorState as o, type PopupMenuPositionerAlign as p, type PopupMenuPositionerProps as q, type PopupMenuRadioItemIndicatorProps as r, type PopupMenuRadioItemIndicatorState as s, type PopupMenuShortcutProps as t, useAsyncMenuCoordinator as u, type PopupMenuShortcutState as v, type PopupMenuSubmenuRootProps as w, type PopupMenuSubmenuTriggerIndicatorProps as x, type PopupMenuSubmenuTriggerIndicatorState as y, type PopupMenuSubpageBackItemProps as z };
|