@smilodon/react 1.0.3 → 1.1.1
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 +50 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -64,6 +64,7 @@ function MyApp() {
|
|
|
64
64
|
|
|
65
65
|
```tsx
|
|
66
66
|
import { Select } from '@smilodon/react';
|
|
67
|
+
import { useState } from 'react';
|
|
67
68
|
|
|
68
69
|
function BasicExample() {
|
|
69
70
|
const [value, setValue] = useState('');
|
|
@@ -83,10 +84,56 @@ function BasicExample() {
|
|
|
83
84
|
}
|
|
84
85
|
```
|
|
85
86
|
|
|
86
|
-
###
|
|
87
|
+
### String Array Input (Auto-converted)
|
|
87
88
|
|
|
88
89
|
```tsx
|
|
89
90
|
import { Select } from '@smilodon/react';
|
|
91
|
+
import { useState } from 'react';
|
|
92
|
+
|
|
93
|
+
function StringArrayExample() {
|
|
94
|
+
const [values, setValues] = useState<Array<string | number>>([]);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<Select
|
|
98
|
+
items={['Apple', 'Banana', 'Cherry', 'Date', 'Elderberry']}
|
|
99
|
+
value={values}
|
|
100
|
+
onChange={(val) => setValues(val as Array<string | number>)}
|
|
101
|
+
multiple
|
|
102
|
+
placeholder="Select fruits..."
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> **Note:** String arrays are automatically converted to `SelectItem` format internally. Each string becomes `{ value: string, label: string }`.
|
|
109
|
+
|
|
110
|
+
### Number Array Input (Auto-converted)
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { Select } from '@smilodon/react';
|
|
114
|
+
import { useState } from 'react';
|
|
115
|
+
|
|
116
|
+
function NumberArrayExample() {
|
|
117
|
+
const [value, setValue] = useState<string | number>('');
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<Select
|
|
121
|
+
items={[1, 2, 3, 5, 8, 13, 21, 34, 55, 89]}
|
|
122
|
+
value={value}
|
|
123
|
+
onChange={(val) => setValue(val)}
|
|
124
|
+
placeholder="Select a Fibonacci number..."
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
> **Note:** Number arrays are automatically converted to `SelectItem` format internally. Each number becomes `{ value: number, label: string }`.
|
|
131
|
+
|
|
132
|
+
### Multi-Select with Object Array
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import { Select } from '@smilodon/react';
|
|
136
|
+
import { useState } from 'react';
|
|
90
137
|
|
|
91
138
|
function MultiSelectExample() {
|
|
92
139
|
const [values, setValues] = useState<Array<string | number>>([]);
|
|
@@ -378,7 +425,8 @@ MIT © Smilodon
|
|
|
378
425
|
|
|
379
426
|
## Related Packages
|
|
380
427
|
|
|
428
|
+
|
|
381
429
|
- `@smilodon/core` - Core web component
|
|
382
430
|
- `@smilodon/vue` - Vue 3 adapter
|
|
383
|
-
- `@smilodon/angular` - Angular adapter
|
|
384
431
|
- `@smilodon/svelte` - Svelte adapter
|
|
432
|
+
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smilodon/react",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "React adapter for @smilodon/core - Production-ready accessible select component",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "React adapter for @smilodon/core - Production-ready accessible select component (React, Vue, Svelte, Vanilla JS)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|