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