@xsolla/xui-context-menu 0.74.0 → 0.76.0

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,578 @@
1
+ /**
2
+ * Flowtype definitions for index
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ import React$1, { Node, RefObject } from "react";
9
+
10
+ /**
11
+ * Size variants for the context menu
12
+ */
13
+ declare type ContextMenuSize = "sm" | "md" | "lg" | "xl";
14
+ /**
15
+ * Item variant types for data-driven API
16
+ */
17
+ declare type ContextMenuItemVariant = "default" | "checkbox" | "radio";
18
+ /**
19
+ * Trailing element types
20
+ */
21
+ declare type ContextMenuTrailingType =
22
+ | "none"
23
+ | "shortcut"
24
+ | "badge"
25
+ | "switch"
26
+ | "arrow";
27
+ /**
28
+ * Position configuration for context menu
29
+ */
30
+ declare interface ContextMenuPosition {
31
+ x: number;
32
+ y: number;
33
+ }
34
+ /**
35
+ * Individual menu item data structure for data-driven API
36
+ */
37
+ declare interface ContextMenuItemData {
38
+ id: string;
39
+ label: string;
40
+ description?: string;
41
+ icon?: Node;
42
+ trailing?: {
43
+ type: ContextMenuTrailingType,
44
+ content?: Node | string,
45
+ ...
46
+ };
47
+ variant?: ContextMenuItemVariant;
48
+ checked?: boolean;
49
+
50
+ /**
51
+ * Whether this item is selected (shows trailing checkmark) - for Select/Dropdown usage
52
+ */
53
+ selected?: boolean;
54
+ disabled?: boolean;
55
+ onPress?: () => void;
56
+ children?: ContextMenuItemData[];
57
+ groupId?: string;
58
+ }
59
+ /**
60
+ * Menu group with optional header
61
+ */
62
+ declare interface ContextMenuGroupData {
63
+ id: string;
64
+ label?: string;
65
+ description?: string;
66
+ items: ContextMenuItemData[];
67
+ }
68
+ /**
69
+ * Main ContextMenu Container Props
70
+ */
71
+ declare interface ContextMenuProps {
72
+ /**
73
+ * Menu items - data-driven API (alternative to children)
74
+ */
75
+ list?: ContextMenuItemData[];
76
+
77
+ /**
78
+ * Grouped menu items with optional headers
79
+ */
80
+ groups?: ContextMenuGroupData[];
81
+
82
+ /**
83
+ * Render function for custom children (alternative to list/groups)
84
+ */
85
+ children?: Node;
86
+
87
+ /**
88
+ * Size of the context menu
89
+ */
90
+ size?: ContextMenuSize;
91
+
92
+ /**
93
+ * Controlled open state
94
+ */
95
+ isOpen?: boolean;
96
+
97
+ /**
98
+ * Callback when open state changes
99
+ */
100
+ onOpenChange?: (open: boolean) => void;
101
+
102
+ /**
103
+ * Position for right-click context menu mode
104
+ */
105
+ position?: ContextMenuPosition;
106
+
107
+ /**
108
+ * Trigger element (button, etc.) for dropdown mode
109
+ */
110
+ trigger?: Node;
111
+
112
+ /**
113
+ * Width of the menu
114
+ */
115
+ width?: number | string;
116
+
117
+ /**
118
+ * Maximum height before scrolling
119
+ */
120
+ maxHeight?: number;
121
+
122
+ /**
123
+ * Callback when an item is selected
124
+ */
125
+ onSelect?: (item: ContextMenuItemData) => void;
126
+
127
+ /**
128
+ * Callback when checkbox/radio values change
129
+ */
130
+ onCheckedChange?: (itemId: string, checked: boolean) => void;
131
+
132
+ /**
133
+ * Close menu on item select (default: true for non-checkbox items)
134
+ */
135
+ closeOnSelect?: boolean;
136
+
137
+ /**
138
+ * Loading state - shows spinner
139
+ */
140
+ isLoading?: boolean;
141
+
142
+ /**
143
+ * ARIA label for the menu
144
+ */
145
+ "aria-label"?: string;
146
+
147
+ /**
148
+ * Test ID
149
+ */
150
+ "data-testid"?: string;
151
+ }
152
+ /**
153
+ * ContextMenuItem Component Props - for default menu items
154
+ */
155
+ declare interface ContextMenuItemProps {
156
+ /**
157
+ * Item label text
158
+ */
159
+ children: Node;
160
+
161
+ /**
162
+ * Description text below label
163
+ */
164
+ description?: string;
165
+
166
+ /**
167
+ * Leading icon
168
+ */
169
+ icon?: Node;
170
+
171
+ /**
172
+ * Trailing element
173
+ */
174
+ trailing?: Node;
175
+
176
+ /**
177
+ * Keyboard shortcut display text
178
+ */
179
+ shortcut?: string;
180
+
181
+ /**
182
+ * Whether this item is selected (cyan background) - for Select/Dropdown usage
183
+ */
184
+ selected?: boolean;
185
+
186
+ /**
187
+ * Whether item is disabled
188
+ */
189
+ disabled?: boolean;
190
+
191
+ /**
192
+ * Whether item is currently active/focused (for keyboard navigation)
193
+ */
194
+ active?: boolean;
195
+
196
+ /**
197
+ * Size inherited from parent
198
+ */
199
+ size?: ContextMenuSize;
200
+
201
+ /**
202
+ * Whether this item has a submenu
203
+ */
204
+ hasSubmenu?: boolean;
205
+
206
+ /**
207
+ * Press handler
208
+ */
209
+ onPress?: () => void;
210
+
211
+ /**
212
+ * Test ID
213
+ */
214
+ "data-testid"?: string;
215
+ }
216
+ /**
217
+ * ContextMenuCheckboxItem Component Props
218
+ */
219
+ declare interface ContextMenuCheckboxItemProps {
220
+ /**
221
+ * Item label text
222
+ */
223
+ children: Node;
224
+
225
+ /**
226
+ * Description text below label
227
+ */
228
+ description?: string;
229
+
230
+ /**
231
+ * Content placed after checkbox but before label (e.g., Status indicator)
232
+ */
233
+ leadingContent?: Node;
234
+
235
+ /**
236
+ * Trailing element
237
+ */
238
+ trailing?: Node;
239
+
240
+ /**
241
+ * Checked state
242
+ */
243
+ checked?: boolean;
244
+
245
+ /**
246
+ * Indeterminate state - shows minus icon instead of check (for "select all" partially selected)
247
+ */
248
+ indeterminate?: boolean;
249
+
250
+ /**
251
+ * Whether item is disabled
252
+ */
253
+ disabled?: boolean;
254
+
255
+ /**
256
+ * Size inherited from parent
257
+ */
258
+ size?: ContextMenuSize;
259
+
260
+ /**
261
+ * Checked change handler
262
+ */
263
+ onCheckedChange?: (checked: boolean) => void;
264
+
265
+ /**
266
+ * Press handler
267
+ */
268
+ onPress?: () => void;
269
+
270
+ /**
271
+ * Test ID
272
+ */
273
+ "data-testid"?: string;
274
+ }
275
+ /**
276
+ * ContextMenuRadioGroup Component Props
277
+ */
278
+ declare interface ContextMenuRadioGroupProps {
279
+ /**
280
+ * Radio items
281
+ */
282
+ children: Node;
283
+
284
+ /**
285
+ * Current selected value
286
+ */
287
+ value: string;
288
+
289
+ /**
290
+ * Value change handler
291
+ */
292
+ onValueChange: (value: string) => void;
293
+
294
+ /**
295
+ * Test ID
296
+ */
297
+ "data-testid"?: string;
298
+ }
299
+ /**
300
+ * ContextMenuRadioItem Component Props
301
+ */
302
+ declare interface ContextMenuRadioItemProps {
303
+ /**
304
+ * Item label text
305
+ */
306
+ children: Node;
307
+
308
+ /**
309
+ * Description text below label
310
+ */
311
+ description?: string;
312
+
313
+ /**
314
+ * Value for this radio item
315
+ */
316
+ value: string;
317
+
318
+ /**
319
+ * Whether item is disabled
320
+ */
321
+ disabled?: boolean;
322
+
323
+ /**
324
+ * Size inherited from parent
325
+ */
326
+ size?: ContextMenuSize;
327
+
328
+ /**
329
+ * Press handler
330
+ */
331
+ onPress?: () => void;
332
+
333
+ /**
334
+ * Test ID
335
+ */
336
+ "data-testid"?: string;
337
+ }
338
+ /**
339
+ * ContextMenuGroup Component Props
340
+ */
341
+ declare interface ContextMenuGroupProps {
342
+ /**
343
+ * Group heading text
344
+ */
345
+ label?: string;
346
+
347
+ /**
348
+ * Group description
349
+ */
350
+ description?: string;
351
+
352
+ /**
353
+ * Group items
354
+ */
355
+ children: Node;
356
+
357
+ /**
358
+ * Size inherited from parent
359
+ */
360
+ size?: ContextMenuSize;
361
+
362
+ /**
363
+ * Test ID
364
+ */
365
+ "data-testid"?: string;
366
+ }
367
+ /**
368
+ * ContextMenuSeparator Component Props
369
+ */
370
+ declare interface ContextMenuSeparatorProps {
371
+ /**
372
+ * Size for consistent spacing
373
+ */
374
+ size?: ContextMenuSize;
375
+
376
+ /**
377
+ * Test ID
378
+ */
379
+ "data-testid"?: string;
380
+ }
381
+ /**
382
+ * ContextMenuSearch Component Props
383
+ */
384
+ declare interface ContextMenuSearchProps {
385
+ /**
386
+ * Current search value
387
+ */
388
+ value?: string;
389
+
390
+ /**
391
+ * Change handler (event-based)
392
+ */
393
+ onChange?: (e: React$ChangeEvent<HTMLInputElement>) => void;
394
+
395
+ /**
396
+ * Change handler (value-based)
397
+ */
398
+ onValueChange?: (value: string) => void;
399
+
400
+ /**
401
+ * Placeholder text
402
+ */
403
+ placeholder?: string;
404
+
405
+ /**
406
+ * Whether to auto-focus the input when mounted
407
+ */
408
+ autoFocus?: boolean;
409
+
410
+ /**
411
+ * Size inherited from parent
412
+ */
413
+ size?: ContextMenuSize;
414
+
415
+ /**
416
+ * Test ID
417
+ */
418
+ "data-testid"?: string;
419
+ }
420
+ /**
421
+ * Context for passing state to children
422
+ */
423
+ declare interface ContextMenuContextValue {
424
+ size: ContextMenuSize;
425
+ closeMenu: () => void;
426
+ onItemSelect: (item: ContextMenuItemData) => void;
427
+ activeIndex: number;
428
+ setActiveIndex: (index: number) => void;
429
+ registerItem: (id: string) => number;
430
+ unregisterItem: (id: string) => void;
431
+ }
432
+ /**
433
+ * Sizing configuration returned by theme.sizing.contextMenu
434
+ */
435
+ declare interface ContextMenuSizing {
436
+ paddingVertical: number;
437
+ itemPaddingHorizontal: number;
438
+ itemPaddingVertical: number;
439
+ fontSize: number;
440
+ descriptionFontSize: number;
441
+ iconSize: number;
442
+ gap: number;
443
+ minWidth: number;
444
+ }
445
+ declare var ContextMenu: {
446
+ ...React$1.ForwardRefExoticComponent<{
447
+ ...ContextMenuProps,
448
+ ...React$1.RefAttributes<any>,
449
+ }>,
450
+ ...{
451
+ Item: React$1.ForwardRefExoticComponent<{
452
+ ...ContextMenuItemProps,
453
+ ...React$1.RefAttributes<any>,
454
+ }>,
455
+ CheckboxItem: React$1.ForwardRefExoticComponent<{
456
+ ...ContextMenuCheckboxItemProps,
457
+ ...React$1.RefAttributes<any>,
458
+ }>,
459
+ RadioGroup: React$1.ForwardRefExoticComponent<{
460
+ ...ContextMenuRadioGroupProps,
461
+ ...React$1.RefAttributes<any>,
462
+ }>,
463
+ RadioItem: React$1.ForwardRefExoticComponent<{
464
+ ...ContextMenuRadioItemProps,
465
+ ...React$1.RefAttributes<any>,
466
+ }>,
467
+ Group: React$1.ForwardRefExoticComponent<{
468
+ ...ContextMenuGroupProps,
469
+ ...React$1.RefAttributes<any>,
470
+ }>,
471
+ Separator: React$1.FC<ContextMenuSeparatorProps>,
472
+ Search: React$1.ForwardRefExoticComponent<{
473
+ ...ContextMenuSearchProps,
474
+ ...React$1.RefAttributes<HTMLInputElement>,
475
+ }>,
476
+ ...
477
+ },
478
+ };
479
+ declare var ContextMenuItem: React$1.ForwardRefExoticComponent<{
480
+ ...ContextMenuItemProps,
481
+ ...React$1.RefAttributes<any>,
482
+ }>;
483
+ declare var ContextMenuCheckboxItem: React$1.ForwardRefExoticComponent<{
484
+ ...ContextMenuCheckboxItemProps,
485
+ ...React$1.RefAttributes<any>,
486
+ }>;
487
+ declare interface RadioGroupContextValue {
488
+ value: string;
489
+ onValueChange: (value: string) => void;
490
+ }
491
+ declare var useRadioGroup: () => RadioGroupContextValue | null;
492
+ declare var ContextMenuRadioGroup: React$1.ForwardRefExoticComponent<{
493
+ ...ContextMenuRadioGroupProps,
494
+ ...React$1.RefAttributes<any>,
495
+ }>;
496
+ declare var ContextMenuRadioItem: React$1.ForwardRefExoticComponent<{
497
+ ...ContextMenuRadioItemProps,
498
+ ...React$1.RefAttributes<any>,
499
+ }>;
500
+ declare var ContextMenuGroup: React$1.ForwardRefExoticComponent<{
501
+ ...ContextMenuGroupProps,
502
+ ...React$1.RefAttributes<any>,
503
+ }>;
504
+ declare var ContextMenuSeparator: React$1.FC<ContextMenuSeparatorProps>;
505
+ declare var ContextMenuSearch: React$1.ForwardRefExoticComponent<{
506
+ ...ContextMenuSearchProps,
507
+ ...React$1.RefAttributes<HTMLInputElement>,
508
+ }>;
509
+ declare var useContextMenu: () => ContextMenuContextValue | void;
510
+ declare var useContextMenuRequired: () => ContextMenuContextValue;
511
+ declare interface UseContextMenuPositionOptions {
512
+ position?: ContextMenuPosition;
513
+ menuRef: RefObject<HTMLElement>;
514
+ isOpen: boolean;
515
+ offset?: number;
516
+ }
517
+ declare type AdjustedPosition = {
518
+ transformOrigin: string,
519
+ ...
520
+ } & ContextMenuPosition;
521
+
522
+ /**
523
+ * Hook to calculate smart positioning for context menus
524
+ * Adjusts position to avoid viewport overflow
525
+ */
526
+ declare var useContextMenuPosition: (
527
+ x: UseContextMenuPositionOptions
528
+ ) => AdjustedPosition | void;
529
+ declare interface UseKeyboardNavigationOptions {
530
+ isOpen: boolean;
531
+ itemCount: number;
532
+ activeIndex: number;
533
+ setActiveIndex: (index: number) => void;
534
+ onSelect: (index: number) => void;
535
+ onClose: () => void;
536
+ loop?: boolean;
537
+ }
538
+ /**
539
+ * Hook to handle keyboard navigation in context menus
540
+ * Supports arrow keys, home/end, enter/space, and escape
541
+ */
542
+ declare var useKeyboardNavigation: (x: UseKeyboardNavigationOptions) => {
543
+ handleKeyDown: (event: React$KeyboardEvent<>) => void,
544
+ ...
545
+ };
546
+ export type {
547
+ ContextMenuCheckboxItemProps,
548
+ ContextMenuContextValue,
549
+ ContextMenuGroupData,
550
+ ContextMenuGroupProps,
551
+ ContextMenuItemData,
552
+ ContextMenuItemProps,
553
+ ContextMenuItemVariant,
554
+ ContextMenuPosition,
555
+ ContextMenuProps,
556
+ ContextMenuRadioGroupProps,
557
+ ContextMenuRadioItemProps,
558
+ ContextMenuSearchProps,
559
+ ContextMenuSeparatorProps,
560
+ ContextMenuSize,
561
+ ContextMenuSizing,
562
+ ContextMenuTrailingType,
563
+ };
564
+ declare export {
565
+ ContextMenu,
566
+ ContextMenuCheckboxItem,
567
+ ContextMenuGroup,
568
+ ContextMenuItem,
569
+ ContextMenuRadioGroup,
570
+ ContextMenuRadioItem,
571
+ ContextMenuSearch,
572
+ ContextMenuSeparator,
573
+ useContextMenu,
574
+ useContextMenuPosition,
575
+ useContextMenuRequired,
576
+ useKeyboardNavigation,
577
+ useRadioGroup,
578
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-context-menu",
3
- "version": "0.74.0",
3
+ "version": "0.76.0",
4
4
  "main": "./web/index.js",
5
5
  "module": "./web/index.mjs",
6
6
  "types": "./web/index.d.ts",
@@ -13,13 +13,13 @@
13
13
  "test:coverage": "vitest run --coverage"
14
14
  },
15
15
  "dependencies": {
16
- "@xsolla/xui-checkbox": "0.74.0",
17
- "@xsolla/xui-core": "0.74.0",
18
- "@xsolla/xui-divider": "0.74.0",
19
- "@xsolla/xui-icons": "0.74.0",
20
- "@xsolla/xui-primitives-core": "0.74.0",
21
- "@xsolla/xui-radio": "0.74.0",
22
- "@xsolla/xui-spinner": "0.74.0"
16
+ "@xsolla/xui-checkbox": "0.76.0",
17
+ "@xsolla/xui-core": "0.76.0",
18
+ "@xsolla/xui-divider": "0.76.0",
19
+ "@xsolla/xui-icons": "0.76.0",
20
+ "@xsolla/xui-primitives-core": "0.76.0",
21
+ "@xsolla/xui-radio": "0.76.0",
22
+ "@xsolla/xui-spinner": "0.76.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=16.8.0",
@@ -0,0 +1,578 @@
1
+ /**
2
+ * Flowtype definitions for index
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ import React$1, { Node, RefObject } from "react";
9
+
10
+ /**
11
+ * Size variants for the context menu
12
+ */
13
+ declare type ContextMenuSize = "sm" | "md" | "lg" | "xl";
14
+ /**
15
+ * Item variant types for data-driven API
16
+ */
17
+ declare type ContextMenuItemVariant = "default" | "checkbox" | "radio";
18
+ /**
19
+ * Trailing element types
20
+ */
21
+ declare type ContextMenuTrailingType =
22
+ | "none"
23
+ | "shortcut"
24
+ | "badge"
25
+ | "switch"
26
+ | "arrow";
27
+ /**
28
+ * Position configuration for context menu
29
+ */
30
+ declare interface ContextMenuPosition {
31
+ x: number;
32
+ y: number;
33
+ }
34
+ /**
35
+ * Individual menu item data structure for data-driven API
36
+ */
37
+ declare interface ContextMenuItemData {
38
+ id: string;
39
+ label: string;
40
+ description?: string;
41
+ icon?: Node;
42
+ trailing?: {
43
+ type: ContextMenuTrailingType,
44
+ content?: Node | string,
45
+ ...
46
+ };
47
+ variant?: ContextMenuItemVariant;
48
+ checked?: boolean;
49
+
50
+ /**
51
+ * Whether this item is selected (shows trailing checkmark) - for Select/Dropdown usage
52
+ */
53
+ selected?: boolean;
54
+ disabled?: boolean;
55
+ onPress?: () => void;
56
+ children?: ContextMenuItemData[];
57
+ groupId?: string;
58
+ }
59
+ /**
60
+ * Menu group with optional header
61
+ */
62
+ declare interface ContextMenuGroupData {
63
+ id: string;
64
+ label?: string;
65
+ description?: string;
66
+ items: ContextMenuItemData[];
67
+ }
68
+ /**
69
+ * Main ContextMenu Container Props
70
+ */
71
+ declare interface ContextMenuProps {
72
+ /**
73
+ * Menu items - data-driven API (alternative to children)
74
+ */
75
+ list?: ContextMenuItemData[];
76
+
77
+ /**
78
+ * Grouped menu items with optional headers
79
+ */
80
+ groups?: ContextMenuGroupData[];
81
+
82
+ /**
83
+ * Render function for custom children (alternative to list/groups)
84
+ */
85
+ children?: Node;
86
+
87
+ /**
88
+ * Size of the context menu
89
+ */
90
+ size?: ContextMenuSize;
91
+
92
+ /**
93
+ * Controlled open state
94
+ */
95
+ isOpen?: boolean;
96
+
97
+ /**
98
+ * Callback when open state changes
99
+ */
100
+ onOpenChange?: (open: boolean) => void;
101
+
102
+ /**
103
+ * Position for right-click context menu mode
104
+ */
105
+ position?: ContextMenuPosition;
106
+
107
+ /**
108
+ * Trigger element (button, etc.) for dropdown mode
109
+ */
110
+ trigger?: Node;
111
+
112
+ /**
113
+ * Width of the menu
114
+ */
115
+ width?: number | string;
116
+
117
+ /**
118
+ * Maximum height before scrolling
119
+ */
120
+ maxHeight?: number;
121
+
122
+ /**
123
+ * Callback when an item is selected
124
+ */
125
+ onSelect?: (item: ContextMenuItemData) => void;
126
+
127
+ /**
128
+ * Callback when checkbox/radio values change
129
+ */
130
+ onCheckedChange?: (itemId: string, checked: boolean) => void;
131
+
132
+ /**
133
+ * Close menu on item select (default: true for non-checkbox items)
134
+ */
135
+ closeOnSelect?: boolean;
136
+
137
+ /**
138
+ * Loading state - shows spinner
139
+ */
140
+ isLoading?: boolean;
141
+
142
+ /**
143
+ * ARIA label for the menu
144
+ */
145
+ "aria-label"?: string;
146
+
147
+ /**
148
+ * Test ID
149
+ */
150
+ "data-testid"?: string;
151
+ }
152
+ /**
153
+ * ContextMenuItem Component Props - for default menu items
154
+ */
155
+ declare interface ContextMenuItemProps {
156
+ /**
157
+ * Item label text
158
+ */
159
+ children: Node;
160
+
161
+ /**
162
+ * Description text below label
163
+ */
164
+ description?: string;
165
+
166
+ /**
167
+ * Leading icon
168
+ */
169
+ icon?: Node;
170
+
171
+ /**
172
+ * Trailing element
173
+ */
174
+ trailing?: Node;
175
+
176
+ /**
177
+ * Keyboard shortcut display text
178
+ */
179
+ shortcut?: string;
180
+
181
+ /**
182
+ * Whether this item is selected (cyan background) - for Select/Dropdown usage
183
+ */
184
+ selected?: boolean;
185
+
186
+ /**
187
+ * Whether item is disabled
188
+ */
189
+ disabled?: boolean;
190
+
191
+ /**
192
+ * Whether item is currently active/focused (for keyboard navigation)
193
+ */
194
+ active?: boolean;
195
+
196
+ /**
197
+ * Size inherited from parent
198
+ */
199
+ size?: ContextMenuSize;
200
+
201
+ /**
202
+ * Whether this item has a submenu
203
+ */
204
+ hasSubmenu?: boolean;
205
+
206
+ /**
207
+ * Press handler
208
+ */
209
+ onPress?: () => void;
210
+
211
+ /**
212
+ * Test ID
213
+ */
214
+ "data-testid"?: string;
215
+ }
216
+ /**
217
+ * ContextMenuCheckboxItem Component Props
218
+ */
219
+ declare interface ContextMenuCheckboxItemProps {
220
+ /**
221
+ * Item label text
222
+ */
223
+ children: Node;
224
+
225
+ /**
226
+ * Description text below label
227
+ */
228
+ description?: string;
229
+
230
+ /**
231
+ * Content placed after checkbox but before label (e.g., Status indicator)
232
+ */
233
+ leadingContent?: Node;
234
+
235
+ /**
236
+ * Trailing element
237
+ */
238
+ trailing?: Node;
239
+
240
+ /**
241
+ * Checked state
242
+ */
243
+ checked?: boolean;
244
+
245
+ /**
246
+ * Indeterminate state - shows minus icon instead of check (for "select all" partially selected)
247
+ */
248
+ indeterminate?: boolean;
249
+
250
+ /**
251
+ * Whether item is disabled
252
+ */
253
+ disabled?: boolean;
254
+
255
+ /**
256
+ * Size inherited from parent
257
+ */
258
+ size?: ContextMenuSize;
259
+
260
+ /**
261
+ * Checked change handler
262
+ */
263
+ onCheckedChange?: (checked: boolean) => void;
264
+
265
+ /**
266
+ * Press handler
267
+ */
268
+ onPress?: () => void;
269
+
270
+ /**
271
+ * Test ID
272
+ */
273
+ "data-testid"?: string;
274
+ }
275
+ /**
276
+ * ContextMenuRadioGroup Component Props
277
+ */
278
+ declare interface ContextMenuRadioGroupProps {
279
+ /**
280
+ * Radio items
281
+ */
282
+ children: Node;
283
+
284
+ /**
285
+ * Current selected value
286
+ */
287
+ value: string;
288
+
289
+ /**
290
+ * Value change handler
291
+ */
292
+ onValueChange: (value: string) => void;
293
+
294
+ /**
295
+ * Test ID
296
+ */
297
+ "data-testid"?: string;
298
+ }
299
+ /**
300
+ * ContextMenuRadioItem Component Props
301
+ */
302
+ declare interface ContextMenuRadioItemProps {
303
+ /**
304
+ * Item label text
305
+ */
306
+ children: Node;
307
+
308
+ /**
309
+ * Description text below label
310
+ */
311
+ description?: string;
312
+
313
+ /**
314
+ * Value for this radio item
315
+ */
316
+ value: string;
317
+
318
+ /**
319
+ * Whether item is disabled
320
+ */
321
+ disabled?: boolean;
322
+
323
+ /**
324
+ * Size inherited from parent
325
+ */
326
+ size?: ContextMenuSize;
327
+
328
+ /**
329
+ * Press handler
330
+ */
331
+ onPress?: () => void;
332
+
333
+ /**
334
+ * Test ID
335
+ */
336
+ "data-testid"?: string;
337
+ }
338
+ /**
339
+ * ContextMenuGroup Component Props
340
+ */
341
+ declare interface ContextMenuGroupProps {
342
+ /**
343
+ * Group heading text
344
+ */
345
+ label?: string;
346
+
347
+ /**
348
+ * Group description
349
+ */
350
+ description?: string;
351
+
352
+ /**
353
+ * Group items
354
+ */
355
+ children: Node;
356
+
357
+ /**
358
+ * Size inherited from parent
359
+ */
360
+ size?: ContextMenuSize;
361
+
362
+ /**
363
+ * Test ID
364
+ */
365
+ "data-testid"?: string;
366
+ }
367
+ /**
368
+ * ContextMenuSeparator Component Props
369
+ */
370
+ declare interface ContextMenuSeparatorProps {
371
+ /**
372
+ * Size for consistent spacing
373
+ */
374
+ size?: ContextMenuSize;
375
+
376
+ /**
377
+ * Test ID
378
+ */
379
+ "data-testid"?: string;
380
+ }
381
+ /**
382
+ * ContextMenuSearch Component Props
383
+ */
384
+ declare interface ContextMenuSearchProps {
385
+ /**
386
+ * Current search value
387
+ */
388
+ value?: string;
389
+
390
+ /**
391
+ * Change handler (event-based)
392
+ */
393
+ onChange?: (e: React$ChangeEvent<HTMLInputElement>) => void;
394
+
395
+ /**
396
+ * Change handler (value-based)
397
+ */
398
+ onValueChange?: (value: string) => void;
399
+
400
+ /**
401
+ * Placeholder text
402
+ */
403
+ placeholder?: string;
404
+
405
+ /**
406
+ * Whether to auto-focus the input when mounted
407
+ */
408
+ autoFocus?: boolean;
409
+
410
+ /**
411
+ * Size inherited from parent
412
+ */
413
+ size?: ContextMenuSize;
414
+
415
+ /**
416
+ * Test ID
417
+ */
418
+ "data-testid"?: string;
419
+ }
420
+ /**
421
+ * Context for passing state to children
422
+ */
423
+ declare interface ContextMenuContextValue {
424
+ size: ContextMenuSize;
425
+ closeMenu: () => void;
426
+ onItemSelect: (item: ContextMenuItemData) => void;
427
+ activeIndex: number;
428
+ setActiveIndex: (index: number) => void;
429
+ registerItem: (id: string) => number;
430
+ unregisterItem: (id: string) => void;
431
+ }
432
+ /**
433
+ * Sizing configuration returned by theme.sizing.contextMenu
434
+ */
435
+ declare interface ContextMenuSizing {
436
+ paddingVertical: number;
437
+ itemPaddingHorizontal: number;
438
+ itemPaddingVertical: number;
439
+ fontSize: number;
440
+ descriptionFontSize: number;
441
+ iconSize: number;
442
+ gap: number;
443
+ minWidth: number;
444
+ }
445
+ declare var ContextMenu: {
446
+ ...React$1.ForwardRefExoticComponent<{
447
+ ...ContextMenuProps,
448
+ ...React$1.RefAttributes<any>,
449
+ }>,
450
+ ...{
451
+ Item: React$1.ForwardRefExoticComponent<{
452
+ ...ContextMenuItemProps,
453
+ ...React$1.RefAttributes<any>,
454
+ }>,
455
+ CheckboxItem: React$1.ForwardRefExoticComponent<{
456
+ ...ContextMenuCheckboxItemProps,
457
+ ...React$1.RefAttributes<any>,
458
+ }>,
459
+ RadioGroup: React$1.ForwardRefExoticComponent<{
460
+ ...ContextMenuRadioGroupProps,
461
+ ...React$1.RefAttributes<any>,
462
+ }>,
463
+ RadioItem: React$1.ForwardRefExoticComponent<{
464
+ ...ContextMenuRadioItemProps,
465
+ ...React$1.RefAttributes<any>,
466
+ }>,
467
+ Group: React$1.ForwardRefExoticComponent<{
468
+ ...ContextMenuGroupProps,
469
+ ...React$1.RefAttributes<any>,
470
+ }>,
471
+ Separator: React$1.FC<ContextMenuSeparatorProps>,
472
+ Search: React$1.ForwardRefExoticComponent<{
473
+ ...ContextMenuSearchProps,
474
+ ...React$1.RefAttributes<HTMLInputElement>,
475
+ }>,
476
+ ...
477
+ },
478
+ };
479
+ declare var ContextMenuItem: React$1.ForwardRefExoticComponent<{
480
+ ...ContextMenuItemProps,
481
+ ...React$1.RefAttributes<any>,
482
+ }>;
483
+ declare var ContextMenuCheckboxItem: React$1.ForwardRefExoticComponent<{
484
+ ...ContextMenuCheckboxItemProps,
485
+ ...React$1.RefAttributes<any>,
486
+ }>;
487
+ declare interface RadioGroupContextValue {
488
+ value: string;
489
+ onValueChange: (value: string) => void;
490
+ }
491
+ declare var useRadioGroup: () => RadioGroupContextValue | null;
492
+ declare var ContextMenuRadioGroup: React$1.ForwardRefExoticComponent<{
493
+ ...ContextMenuRadioGroupProps,
494
+ ...React$1.RefAttributes<any>,
495
+ }>;
496
+ declare var ContextMenuRadioItem: React$1.ForwardRefExoticComponent<{
497
+ ...ContextMenuRadioItemProps,
498
+ ...React$1.RefAttributes<any>,
499
+ }>;
500
+ declare var ContextMenuGroup: React$1.ForwardRefExoticComponent<{
501
+ ...ContextMenuGroupProps,
502
+ ...React$1.RefAttributes<any>,
503
+ }>;
504
+ declare var ContextMenuSeparator: React$1.FC<ContextMenuSeparatorProps>;
505
+ declare var ContextMenuSearch: React$1.ForwardRefExoticComponent<{
506
+ ...ContextMenuSearchProps,
507
+ ...React$1.RefAttributes<HTMLInputElement>,
508
+ }>;
509
+ declare var useContextMenu: () => ContextMenuContextValue | void;
510
+ declare var useContextMenuRequired: () => ContextMenuContextValue;
511
+ declare interface UseContextMenuPositionOptions {
512
+ position?: ContextMenuPosition;
513
+ menuRef: RefObject<HTMLElement>;
514
+ isOpen: boolean;
515
+ offset?: number;
516
+ }
517
+ declare type AdjustedPosition = {
518
+ transformOrigin: string,
519
+ ...
520
+ } & ContextMenuPosition;
521
+
522
+ /**
523
+ * Hook to calculate smart positioning for context menus
524
+ * Adjusts position to avoid viewport overflow
525
+ */
526
+ declare var useContextMenuPosition: (
527
+ x: UseContextMenuPositionOptions
528
+ ) => AdjustedPosition | void;
529
+ declare interface UseKeyboardNavigationOptions {
530
+ isOpen: boolean;
531
+ itemCount: number;
532
+ activeIndex: number;
533
+ setActiveIndex: (index: number) => void;
534
+ onSelect: (index: number) => void;
535
+ onClose: () => void;
536
+ loop?: boolean;
537
+ }
538
+ /**
539
+ * Hook to handle keyboard navigation in context menus
540
+ * Supports arrow keys, home/end, enter/space, and escape
541
+ */
542
+ declare var useKeyboardNavigation: (x: UseKeyboardNavigationOptions) => {
543
+ handleKeyDown: (event: React$KeyboardEvent<>) => void,
544
+ ...
545
+ };
546
+ export type {
547
+ ContextMenuCheckboxItemProps,
548
+ ContextMenuContextValue,
549
+ ContextMenuGroupData,
550
+ ContextMenuGroupProps,
551
+ ContextMenuItemData,
552
+ ContextMenuItemProps,
553
+ ContextMenuItemVariant,
554
+ ContextMenuPosition,
555
+ ContextMenuProps,
556
+ ContextMenuRadioGroupProps,
557
+ ContextMenuRadioItemProps,
558
+ ContextMenuSearchProps,
559
+ ContextMenuSeparatorProps,
560
+ ContextMenuSize,
561
+ ContextMenuSizing,
562
+ ContextMenuTrailingType,
563
+ };
564
+ declare export {
565
+ ContextMenu,
566
+ ContextMenuCheckboxItem,
567
+ ContextMenuGroup,
568
+ ContextMenuItem,
569
+ ContextMenuRadioGroup,
570
+ ContextMenuRadioItem,
571
+ ContextMenuSearch,
572
+ ContextMenuSeparator,
573
+ useContextMenu,
574
+ useContextMenuPosition,
575
+ useContextMenuRequired,
576
+ useKeyboardNavigation,
577
+ useRadioGroup,
578
+ };