@smilodon/react 1.1.0 → 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 +48 -1
- package/package.json +1 -1
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>>([]);
|
package/package.json
CHANGED