@xsolla/xui-cell 0.99.0 → 0.100.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/README.md +202 -21
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,44 +1,225 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: Cell
|
|
3
|
+
subtitle: A list item layout component.
|
|
4
|
+
description: A cross-platform React cell component for creating consistent list item layouts with slots for content and icons.
|
|
5
|
+
---
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
# Cell
|
|
8
|
+
|
|
9
|
+
A cross-platform React cell component that provides a consistent layout structure for list items. Features slots for leading/trailing content and a flexible content area.
|
|
4
10
|
|
|
5
11
|
## Installation
|
|
6
12
|
|
|
7
13
|
```bash
|
|
14
|
+
npm install @xsolla/xui-cell
|
|
15
|
+
# or
|
|
8
16
|
yarn add @xsolla/xui-cell
|
|
9
17
|
```
|
|
10
18
|
|
|
11
|
-
##
|
|
19
|
+
## Demo
|
|
20
|
+
|
|
21
|
+
### Basic Cell
|
|
12
22
|
|
|
13
23
|
```tsx
|
|
14
|
-
import
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import { Cell } from '@xsolla/xui-cell';
|
|
26
|
+
|
|
27
|
+
export default function BasicCell() {
|
|
28
|
+
return (
|
|
29
|
+
<Cell>
|
|
30
|
+
<Cell.Content>
|
|
31
|
+
Basic cell content
|
|
32
|
+
</Cell.Content>
|
|
33
|
+
</Cell>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### With Slots
|
|
15
39
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
40
|
+
```tsx
|
|
41
|
+
import * as React from 'react';
|
|
42
|
+
import { Cell } from '@xsolla/xui-cell';
|
|
43
|
+
import { Avatar } from '@xsolla/xui-avatar';
|
|
44
|
+
import { ChevronRight } from '@xsolla/xui-icons-base';
|
|
45
|
+
|
|
46
|
+
export default function CellWithSlots() {
|
|
47
|
+
return (
|
|
48
|
+
<Cell>
|
|
49
|
+
<Cell.Slot>
|
|
50
|
+
<Avatar size="md" name="John Doe" />
|
|
51
|
+
</Cell.Slot>
|
|
52
|
+
<Cell.Content>
|
|
53
|
+
<span style={{ fontWeight: 500 }}>John Doe</span>
|
|
54
|
+
<span style={{ color: '#888' }}>john@example.com</span>
|
|
55
|
+
</Cell.Content>
|
|
56
|
+
<Cell.Slot>
|
|
57
|
+
<ChevronRight size={20} />
|
|
58
|
+
</Cell.Slot>
|
|
59
|
+
</Cell>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### With Board Style
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import * as React from 'react';
|
|
68
|
+
import { Cell } from '@xsolla/xui-cell';
|
|
69
|
+
|
|
70
|
+
export default function BoardCell() {
|
|
71
|
+
return (
|
|
72
|
+
<Cell withBoard>
|
|
73
|
+
<Cell.Content>
|
|
74
|
+
Cell with board styling (background, border, rounded corners)
|
|
75
|
+
</Cell.Content>
|
|
76
|
+
</Cell>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Anatomy
|
|
82
|
+
|
|
83
|
+
```jsx
|
|
84
|
+
import { Cell } from '@xsolla/xui-cell';
|
|
85
|
+
|
|
86
|
+
<Cell
|
|
87
|
+
withBoard={false} // Add background, border, and padding
|
|
88
|
+
>
|
|
89
|
+
<Cell.Slot> {/* Leading content (icon, avatar) */}
|
|
90
|
+
<Avatar />
|
|
19
91
|
</Cell.Slot>
|
|
20
|
-
<Cell.Content>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
92
|
+
<Cell.Content> {/* Main content area (flexes to fill) */}
|
|
93
|
+
<Text>Title</Text>
|
|
94
|
+
<Text>Subtitle</Text>
|
|
23
95
|
</Cell.Content>
|
|
24
|
-
<Cell.Slot>
|
|
25
|
-
<
|
|
96
|
+
<Cell.Slot> {/* Trailing content (chevron, button) */}
|
|
97
|
+
<Icon />
|
|
26
98
|
</Cell.Slot>
|
|
27
99
|
</Cell>
|
|
28
100
|
```
|
|
29
101
|
|
|
30
|
-
##
|
|
102
|
+
## Examples
|
|
31
103
|
|
|
32
|
-
|
|
33
|
-
|-----------|-------------|
|
|
34
|
-
| `Cell` | Root row container |
|
|
35
|
-
| `Cell.Slot` | Non-growing slot for icons or small elements at either end |
|
|
36
|
-
| `Cell.Content` | Flex-grow content area, typically used for text |
|
|
104
|
+
### Settings List
|
|
37
105
|
|
|
38
|
-
|
|
106
|
+
```tsx
|
|
107
|
+
import * as React from 'react';
|
|
108
|
+
import { Cell } from '@xsolla/xui-cell';
|
|
109
|
+
import { User, Bell } from '@xsolla/xui-icons';
|
|
110
|
+
import { ChevronRight, Shield } from '@xsolla/xui-icons-base';
|
|
111
|
+
|
|
112
|
+
export default function SettingsList() {
|
|
113
|
+
return (
|
|
114
|
+
<div>
|
|
115
|
+
<Cell>
|
|
116
|
+
<Cell.Slot>
|
|
117
|
+
<User size={20} />
|
|
118
|
+
</Cell.Slot>
|
|
119
|
+
<Cell.Content>
|
|
120
|
+
<span>Profile</span>
|
|
121
|
+
</Cell.Content>
|
|
122
|
+
<Cell.Slot>
|
|
123
|
+
<ChevronRight size={16} />
|
|
124
|
+
</Cell.Slot>
|
|
125
|
+
</Cell>
|
|
126
|
+
<Cell>
|
|
127
|
+
<Cell.Slot>
|
|
128
|
+
<Bell size={20} />
|
|
129
|
+
</Cell.Slot>
|
|
130
|
+
<Cell.Content>
|
|
131
|
+
<span>Notifications</span>
|
|
132
|
+
</Cell.Content>
|
|
133
|
+
<Cell.Slot>
|
|
134
|
+
<ChevronRight size={16} />
|
|
135
|
+
</Cell.Slot>
|
|
136
|
+
</Cell>
|
|
137
|
+
<Cell>
|
|
138
|
+
<Cell.Slot>
|
|
139
|
+
<Shield size={20} />
|
|
140
|
+
</Cell.Slot>
|
|
141
|
+
<Cell.Content>
|
|
142
|
+
<span>Security</span>
|
|
143
|
+
</Cell.Content>
|
|
144
|
+
<Cell.Slot>
|
|
145
|
+
<ChevronRight size={16} />
|
|
146
|
+
</Cell.Slot>
|
|
147
|
+
</Cell>
|
|
148
|
+
</div>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Contact Card
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
import * as React from 'react';
|
|
157
|
+
import { Cell } from '@xsolla/xui-cell';
|
|
158
|
+
import { Avatar } from '@xsolla/xui-avatar';
|
|
159
|
+
import { Button } from '@xsolla/xui-button';
|
|
160
|
+
|
|
161
|
+
export default function ContactCard() {
|
|
162
|
+
return (
|
|
163
|
+
<Cell withBoard>
|
|
164
|
+
<Cell.Slot>
|
|
165
|
+
<Avatar
|
|
166
|
+
size="lg"
|
|
167
|
+
src="https://example.com/avatar.jpg"
|
|
168
|
+
name="Jane Smith"
|
|
169
|
+
/>
|
|
170
|
+
</Cell.Slot>
|
|
171
|
+
<Cell.Content>
|
|
172
|
+
<span style={{ fontWeight: 600 }}>Jane Smith</span>
|
|
173
|
+
<span style={{ fontSize: 14, color: '#666' }}>Product Manager</span>
|
|
174
|
+
</Cell.Content>
|
|
175
|
+
<Cell.Slot>
|
|
176
|
+
<Button size="sm" variant="secondary">Message</Button>
|
|
177
|
+
</Cell.Slot>
|
|
178
|
+
</Cell>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## API Reference
|
|
39
184
|
|
|
40
185
|
### Cell
|
|
41
186
|
|
|
187
|
+
Container component for cell layout.
|
|
188
|
+
|
|
189
|
+
**Cell Props:**
|
|
190
|
+
|
|
191
|
+
| Prop | Type | Default | Description |
|
|
192
|
+
| :--- | :--- | :------ | :---------- |
|
|
193
|
+
| children | `ReactNode` | - | Cell content (Slot and Content components). |
|
|
194
|
+
| withBoard | `boolean` | `false` | Add background, border, and rounded corners. |
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### Cell.Slot
|
|
199
|
+
|
|
200
|
+
Container for leading or trailing content.
|
|
201
|
+
|
|
202
|
+
**Cell.Slot Props:**
|
|
203
|
+
|
|
204
|
+
| Prop | Type | Default | Description |
|
|
205
|
+
| :--- | :--- | :------ | :---------- |
|
|
206
|
+
| children | `ReactNode` | - | Slot content (icons, avatars, buttons). |
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### Cell.Content
|
|
211
|
+
|
|
212
|
+
Main content area that expands to fill available space.
|
|
213
|
+
|
|
214
|
+
**Cell.Content Props:**
|
|
215
|
+
|
|
42
216
|
| Prop | Type | Default | Description |
|
|
43
|
-
|
|
44
|
-
|
|
|
217
|
+
| :--- | :--- | :------ | :---------- |
|
|
218
|
+
| children | `ReactNode` | - | Content elements. |
|
|
219
|
+
|
|
220
|
+
## Layout
|
|
221
|
+
|
|
222
|
+
- Cell uses horizontal flexbox layout with 12px gap
|
|
223
|
+
- Minimum height of 56px
|
|
224
|
+
- Horizontal padding of 16px
|
|
225
|
+
- `withBoard` adds: secondary background, border, 8px border radius, and 12px vertical padding
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-cell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.100.0",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"build:native": "PLATFORM=native tsup"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xsolla/xui-avatar": "0.
|
|
14
|
-
"@xsolla/xui-button": "0.
|
|
15
|
-
"@xsolla/xui-core": "0.
|
|
16
|
-
"@xsolla/xui-primitives-core": "0.
|
|
13
|
+
"@xsolla/xui-avatar": "0.100.0",
|
|
14
|
+
"@xsolla/xui-button": "0.100.0",
|
|
15
|
+
"@xsolla/xui-core": "0.100.0",
|
|
16
|
+
"@xsolla/xui-primitives-core": "0.100.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=16.8.0",
|