@xsolla/xui-switch 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 +37 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @xsolla/xui-switch
|
|
2
|
+
|
|
3
|
+
Toggle switch component with label, description, and error state support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add @xsolla/xui-switch
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Switch } from '@xsolla/xui-switch';
|
|
15
|
+
|
|
16
|
+
<Switch
|
|
17
|
+
label="Enable notifications"
|
|
18
|
+
checked={enabled}
|
|
19
|
+
onValueChange={setEnabled}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
### Switch
|
|
26
|
+
|
|
27
|
+
| Prop | Type | Default | Description |
|
|
28
|
+
|------|------|---------|-------------|
|
|
29
|
+
| `checked` | `boolean` | `false` | Whether the switch is on |
|
|
30
|
+
| `onValueChange` | `(value: boolean) => void` | — | Callback when toggled |
|
|
31
|
+
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Switch size |
|
|
32
|
+
| `disabled` | `boolean` | `false` | Disables the switch |
|
|
33
|
+
| `state` | `'default' \| 'hover' \| 'disable' \| 'error'` | `'default'` | Visual state |
|
|
34
|
+
| `label` | `string` | — | Label text displayed beside the switch |
|
|
35
|
+
| `description` | `string` | — | Secondary text below the label |
|
|
36
|
+
| `errorLabel` | `string` | — | Error text shown when `state` is `'error'` |
|
|
37
|
+
| `ariaLabel` | `string` | — | Accessible label for screen readers |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-switch",
|
|
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",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"test:coverage": "vitest run --coverage"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@xsolla/xui-core": "0.
|
|
17
|
-
"@xsolla/xui-primitives-core": "0.
|
|
16
|
+
"@xsolla/xui-core": "0.97.0",
|
|
17
|
+
"@xsolla/xui-primitives-core": "0.97.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": ">=16.8.0",
|