@xsolla/xui-autocomplete 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.
- package/README.md +41 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @xsolla/xui-autocomplete
|
|
2
|
+
|
|
3
|
+
Text input with a filterable dropdown of suggestions supporting keyboard navigation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add @xsolla/xui-autocomplete
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Autocomplete } from '@xsolla/xui-autocomplete';
|
|
15
|
+
|
|
16
|
+
<Autocomplete
|
|
17
|
+
label="Search games"
|
|
18
|
+
options={['Cyberpunk 2077', 'Elden Ring', 'Starfield']}
|
|
19
|
+
onValueChange={(text) => console.log(text)}
|
|
20
|
+
onSelect={(value) => console.log(value)}
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
### Autocomplete
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | Description |
|
|
29
|
+
|------|------|---------|-------------|
|
|
30
|
+
| `options` | `string[]` | `[]` | Simple string options |
|
|
31
|
+
| `list` | `AutocompleteOption[]` | — | Rich options with `id`, `label`, `description`, `icon`; takes priority over `options` |
|
|
32
|
+
| `value` | `string` | — | Controlled input value |
|
|
33
|
+
| `onValueChange` | `(value: string) => void` | — | Called on every keystroke |
|
|
34
|
+
| `onSelect` | `(option: string \| AutocompleteOption) => void` | — | Called when an option is selected |
|
|
35
|
+
| `placeholder` | `string` | `"Search..."` | Input placeholder text |
|
|
36
|
+
| `label` | `string` | — | Label displayed above the input |
|
|
37
|
+
| `size` | `"xl" \| "lg" \| "md" \| "sm" \| "xs"` | `"md"` | Size of the control |
|
|
38
|
+
| `state` | `"default" \| "hover" \| "focus" \| "disable" \| "error"` | — | Visual state |
|
|
39
|
+
| `isLoading` | `boolean` | `false` | Shows a spinner in the dropdown while loading |
|
|
40
|
+
| `errorLabel` | `string` | — | Error message shown below the control |
|
|
41
|
+
| `emptyMessage` | `string` | `"No results found"` | Shown when no options match |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-autocomplete",
|
|
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-core": "0.
|
|
14
|
-
"@xsolla/xui-primitives-core": "0.
|
|
15
|
-
"@xsolla/xui-spinner": "0.
|
|
13
|
+
"@xsolla/xui-core": "0.97.0",
|
|
14
|
+
"@xsolla/xui-primitives-core": "0.97.0",
|
|
15
|
+
"@xsolla/xui-spinner": "0.97.0"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": ">=16.8.0",
|