@xsolla/xui-segmented 0.95.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.
- package/README.md +47 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @xsolla/xui-segmented
|
|
2
|
+
|
|
3
|
+
Segmented control for switching between related views or filter options.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add @xsolla/xui-segmented
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Segmented } from '@xsolla/xui-segmented';
|
|
15
|
+
|
|
16
|
+
<Segmented
|
|
17
|
+
items={[
|
|
18
|
+
{ id: 'day', label: 'Day' },
|
|
19
|
+
{ id: 'week', label: 'Week' },
|
|
20
|
+
{ id: 'month', label: 'Month' },
|
|
21
|
+
]}
|
|
22
|
+
activeId="day"
|
|
23
|
+
onChange={(id) => console.log(id)}
|
|
24
|
+
/>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Props
|
|
28
|
+
|
|
29
|
+
### Segmented
|
|
30
|
+
|
|
31
|
+
| Prop | Type | Default | Description |
|
|
32
|
+
|------|------|---------|-------------|
|
|
33
|
+
| `items` | `SegmentedItemType[]` | — | Array of segment items (required) |
|
|
34
|
+
| `activeId` | `string` | — | ID of the currently active segment |
|
|
35
|
+
| `onChange` | `(id: string) => void` | — | Callback when a segment is selected |
|
|
36
|
+
| `size` | `'xl' \| 'lg' \| 'md' \| 'sm'` | `'md'` | Size variant |
|
|
37
|
+
| `stroke` | `boolean` | `false` | Adds a border around the container |
|
|
38
|
+
| `fullWidth` | `boolean` | `false` | Stretches the control to fill its container |
|
|
39
|
+
|
|
40
|
+
#### SegmentedItemType
|
|
41
|
+
|
|
42
|
+
| Field | Type | Description |
|
|
43
|
+
|-------|------|-------------|
|
|
44
|
+
| `id` | `string` | Unique identifier |
|
|
45
|
+
| `label` | `string` | Display text |
|
|
46
|
+
| `icon` | `React.ReactNode` | Optional icon |
|
|
47
|
+
| `disabled` | `boolean` | Disables this segment |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-segmented",
|
|
3
|
-
"version": "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",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"build:native": "PLATFORM=native tsup"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xsolla/xui-badge": "0.
|
|
14
|
-
"@xsolla/xui-core": "0.
|
|
15
|
-
"@xsolla/xui-primitives-core": "0.
|
|
13
|
+
"@xsolla/xui-badge": "0.97.0",
|
|
14
|
+
"@xsolla/xui-core": "0.97.0",
|
|
15
|
+
"@xsolla/xui-primitives-core": "0.97.0"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": ">=16.8.0",
|