@xsolla/xui-context-menu 0.96.0 → 0.97.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.
Files changed (2) hide show
  1. package/README.md +60 -0
  2. package/package.json +8 -8
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @xsolla/xui-context-menu
2
+
3
+ Accessible dropdown and right-click menu with compound components, keyboard navigation, and a data-driven API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ yarn add @xsolla/xui-context-menu
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import {
15
+ ContextMenu,
16
+ ContextMenuItem,
17
+ ContextMenuGroup,
18
+ ContextMenuSeparator,
19
+ } from '@xsolla/xui-context-menu';
20
+ import { Button } from '@xsolla/xui-button';
21
+
22
+ const Example = () => (
23
+ <ContextMenu trigger={<Button>Options</Button>} size="md">
24
+ <ContextMenuGroup label="Actions">
25
+ <ContextMenuItem onPress={() => console.log('copy')}>Copy</ContextMenuItem>
26
+ <ContextMenuItem onPress={() => console.log('delete')} disabled>Delete</ContextMenuItem>
27
+ </ContextMenuGroup>
28
+ <ContextMenuSeparator />
29
+ <ContextMenuItem onPress={() => console.log('settings')}>Settings</ContextMenuItem>
30
+ </ContextMenu>
31
+ );
32
+ ```
33
+
34
+ ## Components
35
+
36
+ - `ContextMenu` — root container; accepts `trigger`, `list`, or `groups` props
37
+ - `ContextMenuItem` — standard menu item
38
+ - `ContextMenuCheckboxItem` — item with a checkbox
39
+ - `ContextMenuRadioGroup` + `ContextMenuRadioItem` — single-select group
40
+ - `ContextMenuGroup` — labelled section wrapper
41
+ - `ContextMenuSeparator` — horizontal divider
42
+ - `ContextMenuSearch` — inline search input for filtering items
43
+
44
+ ## Props
45
+
46
+ ### ContextMenu
47
+
48
+ | Prop | Type | Default | Description |
49
+ |------|------|---------|-------------|
50
+ | `trigger` | `ReactNode` | — | Element that opens the menu on click |
51
+ | `list` | `ContextMenuItemData[]` | — | Data-driven item list (alternative to children) |
52
+ | `groups` | `ContextMenuGroupData[]` | — | Data-driven grouped items |
53
+ | `size` | `"sm" \| "md" \| "lg" \| "xl"` | — | Size of the menu and its items |
54
+ | `isOpen` | `boolean` | — | Controlled open state |
55
+ | `onOpenChange` | `(open: boolean) => void` | — | Called when open state changes |
56
+ | `position` | `{ x: number; y: number }` | — | Anchor position for right-click mode |
57
+ | `width` | `number \| string` | — | Menu width |
58
+ | `maxHeight` | `number` | — | Maximum height before scrolling |
59
+ | `onSelect` | `(item: ContextMenuItemData) => void` | — | Called when an item is selected |
60
+ | `closeOnSelect` | `boolean` | — | Close menu after item selection |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-context-menu",
3
- "version": "0.96.0",
3
+ "version": "0.97.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.96.0",
17
- "@xsolla/xui-core": "0.96.0",
18
- "@xsolla/xui-divider": "0.96.0",
19
- "@xsolla/xui-icons": "0.96.0",
20
- "@xsolla/xui-primitives-core": "0.96.0",
21
- "@xsolla/xui-radio": "0.96.0",
22
- "@xsolla/xui-spinner": "0.96.0"
16
+ "@xsolla/xui-checkbox": "0.97.0",
17
+ "@xsolla/xui-core": "0.97.0",
18
+ "@xsolla/xui-divider": "0.97.0",
19
+ "@xsolla/xui-icons": "0.97.0",
20
+ "@xsolla/xui-primitives-core": "0.97.0",
21
+ "@xsolla/xui-radio": "0.97.0",
22
+ "@xsolla/xui-spinner": "0.97.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=16.8.0",