@xsolla/xui-list 0.99.0 → 0.101.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 +204 -17
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,43 +1,230 @@
1
- # @xsolla/xui-list
1
+ # List
2
2
 
3
- Structured list container with interactive rows and optional section title groupings.
3
+ A cross-platform React list component that provides semantic list structure with optional title sections and interactive rows. Supports hover states and keyboard navigation.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
+ npm install @xsolla/xui-list
9
+ # or
8
10
  yarn add @xsolla/xui-list
9
11
  ```
10
12
 
11
- ## Usage
13
+ ## Demo
14
+
15
+ ### Basic List
12
16
 
13
17
  ```tsx
18
+ import * as React from 'react';
14
19
  import { List } from '@xsolla/xui-list';
15
20
 
16
- function MyComponent() {
21
+ export default function BasicList() {
17
22
  return (
18
23
  <List>
19
- <List.Title>Section</List.Title>
20
- <List.Row hoverable onClick={() => console.log('pressed')}>
21
- Item 1
22
- </List.Row>
24
+ <List.Row>Item 1</List.Row>
23
25
  <List.Row>Item 2</List.Row>
26
+ <List.Row>Item 3</List.Row>
27
+ </List>
28
+ );
29
+ }
30
+ ```
31
+
32
+ ### With Title Sections
33
+
34
+ ```tsx
35
+ import * as React from 'react';
36
+ import { List } from '@xsolla/xui-list';
37
+
38
+ export default function SectionedList() {
39
+ return (
40
+ <List>
41
+ <List.Title>Fruits</List.Title>
42
+ <List.Row>Apple</List.Row>
43
+ <List.Row>Banana</List.Row>
44
+ <List.Row>Cherry</List.Row>
45
+ <List.Title>Vegetables</List.Title>
46
+ <List.Row>Carrot</List.Row>
47
+ <List.Row>Broccoli</List.Row>
48
+ </List>
49
+ );
50
+ }
51
+ ```
52
+
53
+ ### Hoverable Rows
54
+
55
+ ```tsx
56
+ import * as React from 'react';
57
+ import { List } from '@xsolla/xui-list';
58
+
59
+ export default function HoverableList() {
60
+ return (
61
+ <List>
62
+ <List.Row hoverable>Hoverable row 1</List.Row>
63
+ <List.Row hoverable>Hoverable row 2</List.Row>
64
+ <List.Row hoverable>Hoverable row 3</List.Row>
65
+ </List>
66
+ );
67
+ }
68
+ ```
69
+
70
+ ### Clickable Rows
71
+
72
+ ```tsx
73
+ import * as React from 'react';
74
+ import { List } from '@xsolla/xui-list';
75
+
76
+ export default function ClickableList() {
77
+ const handleClick = (item: string) => {
78
+ console.log('Clicked:', item);
79
+ };
80
+
81
+ return (
82
+ <List>
83
+ <List.Row onClick={() => handleClick('Item 1')}>Click me - Item 1</List.Row>
84
+ <List.Row onClick={() => handleClick('Item 2')}>Click me - Item 2</List.Row>
85
+ <List.Row onClick={() => handleClick('Item 3')}>Click me - Item 3</List.Row>
24
86
  </List>
25
87
  );
26
88
  }
27
89
  ```
28
90
 
29
- ## Components
91
+ ## Anatomy
30
92
 
31
- - **List** — Full-width column container with list role
32
- - **List.Row** Individual row; interactive when `onClick` or `hoverable` is set
33
- - **List.Title** — Section header rendered on a secondary background
93
+ ```jsx
94
+ import { List } from '@xsolla/xui-list';
95
+
96
+ <List>
97
+ <List.Title>Section Header</List.Title> {/* Section title */}
98
+ <List.Row {/* List item */}
99
+ hoverable={false} // Show hover background
100
+ onClick={handleClick} // Click handler
101
+ onPress={handlePress} // Press handler (RN)
102
+ >
103
+ Row Content
104
+ </List.Row>
105
+ </List>
106
+ ```
34
107
 
35
- ## Props
108
+ ## Examples
109
+
110
+ ### Settings Menu
111
+
112
+ ```tsx
113
+ import * as React from 'react';
114
+ import { List } from '@xsolla/xui-list';
115
+ import { Cell } from '@xsolla/xui-cell';
116
+ import { User, Bell } from '@xsolla/xui-icons';
117
+ import { ChevronRight, Shield } from '@xsolla/xui-icons-base';
118
+
119
+ export default function SettingsMenu() {
120
+ return (
121
+ <List>
122
+ <List.Title>Account</List.Title>
123
+ <List.Row onClick={() => console.log('Profile')}>
124
+ <Cell>
125
+ <Cell.Slot><User size={20} /></Cell.Slot>
126
+ <Cell.Content>Profile</Cell.Content>
127
+ <Cell.Slot><ChevronRight size={16} /></Cell.Slot>
128
+ </Cell>
129
+ </List.Row>
130
+ <List.Row onClick={() => console.log('Security')}>
131
+ <Cell>
132
+ <Cell.Slot><Shield size={20} /></Cell.Slot>
133
+ <Cell.Content>Security</Cell.Content>
134
+ <Cell.Slot><ChevronRight size={16} /></Cell.Slot>
135
+ </Cell>
136
+ </List.Row>
137
+ <List.Title>Preferences</List.Title>
138
+ <List.Row onClick={() => console.log('Notifications')}>
139
+ <Cell>
140
+ <Cell.Slot><Bell size={20} /></Cell.Slot>
141
+ <Cell.Content>Notifications</Cell.Content>
142
+ <Cell.Slot><ChevronRight size={16} /></Cell.Slot>
143
+ </Cell>
144
+ </List.Row>
145
+ </List>
146
+ );
147
+ }
148
+ ```
149
+
150
+ ### Selection List
151
+
152
+ ```tsx
153
+ import * as React from 'react';
154
+ import { List } from '@xsolla/xui-list';
155
+ import { Radio } from '@xsolla/xui-radio';
156
+
157
+ export default function SelectionList() {
158
+ const [selected, setSelected] = React.useState('option1');
159
+
160
+ return (
161
+ <List>
162
+ <List.Row onClick={() => setSelected('option1')}>
163
+ <Radio checked={selected === 'option1'} />
164
+ <span style={{ marginLeft: 12 }}>Option 1</span>
165
+ </List.Row>
166
+ <List.Row onClick={() => setSelected('option2')}>
167
+ <Radio checked={selected === 'option2'} />
168
+ <span style={{ marginLeft: 12 }}>Option 2</span>
169
+ </List.Row>
170
+ <List.Row onClick={() => setSelected('option3')}>
171
+ <Radio checked={selected === 'option3'} />
172
+ <span style={{ marginLeft: 12 }}>Option 3</span>
173
+ </List.Row>
174
+ </List>
175
+ );
176
+ }
177
+ ```
178
+
179
+ ## API Reference
180
+
181
+ ### List
182
+
183
+ Container component for list items.
184
+
185
+ **List Props:**
186
+
187
+ | Prop | Type | Default | Description |
188
+ | :--- | :--- | :------ | :---------- |
189
+ | children | `ReactNode` | - | List rows and titles. |
190
+
191
+ ---
36
192
 
37
193
  ### List.Row
38
194
 
195
+ Individual list item component.
196
+
197
+ **List.Row Props:**
198
+
39
199
  | Prop | Type | Default | Description |
40
- |------|------|---------|-------------|
41
- | `hoverable` | `boolean` | | Apply hover background even without a press handler |
42
- | `onClick` | `() => void` | | Click/press handler; makes row interactive |
43
- | `onPress` | `() => void` | | Alias for `onClick` (React Native compat) |
200
+ | :--- | :--- | :------ | :---------- |
201
+ | children | `ReactNode` | - | Row content. |
202
+ | hoverable | `boolean` | `false` | Show hover background effect. |
203
+ | onClick | `() => void` | - | Click handler (web). |
204
+ | onPress | `() => void` | - | Press handler (React Native). |
205
+
206
+ ---
207
+
208
+ ### List.Title
209
+
210
+ Section title component.
211
+
212
+ **List.Title Props:**
213
+
214
+ | Prop | Type | Default | Description |
215
+ | :--- | :--- | :------ | :---------- |
216
+ | children | `ReactNode` | - | Title text. |
217
+
218
+ ## Keyboard Navigation
219
+
220
+ | Key | Action |
221
+ | :-- | :----- |
222
+ | Enter | Activate row (when onClick/onPress set) |
223
+ | Space | Activate row (when onClick/onPress set) |
224
+
225
+ ## Accessibility
226
+
227
+ - List uses `role="list"` semantically
228
+ - Rows use `role="listitem"`
229
+ - Interactive rows are focusable with `tabIndex={0}`
230
+ - Keyboard navigation with Enter/Space to activate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-list",
3
- "version": "0.99.0",
3
+ "version": "0.101.0",
4
4
  "main": "./web/index.js",
5
5
  "module": "./web/index.mjs",
6
6
  "types": "./web/index.d.ts",
@@ -10,9 +10,9 @@
10
10
  "build:native": "PLATFORM=native tsup"
11
11
  },
12
12
  "dependencies": {
13
- "@xsolla/xui-avatar": "0.99.0",
14
- "@xsolla/xui-core": "0.99.0",
15
- "@xsolla/xui-primitives-core": "0.99.0"
13
+ "@xsolla/xui-avatar": "0.101.0",
14
+ "@xsolla/xui-core": "0.101.0",
15
+ "@xsolla/xui-primitives-core": "0.101.0"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "react": ">=16.8.0",