@octane-xplat/picker 0.9.0 → 0.11.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
CHANGED
|
@@ -3,15 +3,83 @@
|
|
|
3
3
|
An install boundary for platform-specific selection controls: a SwiftUI `Picker`
|
|
4
4
|
on iOS, a Material 3 dropdown built with Jetpack Compose on Android, and an
|
|
5
5
|
HTML `<select>` on web.
|
|
6
|
-
|
|
7
6
|
Install the package in the app that renders a control. Import `SwiftUIPicker`
|
|
8
7
|
from `@octane-xplat/picker/ios`, `MaterialDropdown` from
|
|
9
8
|
`@octane-xplat/picker/android`, or `Select` from `@octane-xplat/picker/web` in
|
|
10
9
|
the matching platform-suffixed file. Each entry exports its own component and
|
|
11
10
|
types; there is no shared picker API at the package root.
|
|
12
11
|
|
|
12
|
+
```tsx
|
|
13
|
+
/** @jsxImportSource @nativescript-community/octane */
|
|
14
|
+
// SwiftUIPickerExample.ios.tsx
|
|
15
|
+
import { SwiftUIPicker } from '@octane-xplat/picker/ios'
|
|
16
|
+
|
|
17
|
+
export function Picker() {
|
|
18
|
+
return (
|
|
19
|
+
<SwiftUIPicker
|
|
20
|
+
label="Bag"
|
|
21
|
+
options={[{ id: 'carry', title: 'Carry-on' }]}
|
|
22
|
+
defaultSelection="carry"
|
|
23
|
+
onSelectionChange={console.log}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
/** @jsxImportSource @nativescript-community/octane */
|
|
31
|
+
// MaterialDropdownExample.android.tsx
|
|
32
|
+
import { MaterialDropdown } from '@octane-xplat/picker/android'
|
|
33
|
+
|
|
34
|
+
export function Picker() {
|
|
35
|
+
return (
|
|
36
|
+
<MaterialDropdown
|
|
37
|
+
label="Bag"
|
|
38
|
+
items={[{ key: 'carry', text: 'Carry-on' }]}
|
|
39
|
+
defaultSelectedKey="carry"
|
|
40
|
+
onSelectedKeyChange={console.log}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
// SelectExample.web.tsx
|
|
48
|
+
import { Select } from '@octane-xplat/picker/web'
|
|
49
|
+
|
|
50
|
+
export function Picker() {
|
|
51
|
+
return (
|
|
52
|
+
<Select
|
|
53
|
+
label="Bag"
|
|
54
|
+
options={[{ value: 'carry', label: 'Carry-on' }]}
|
|
55
|
+
defaultValue="carry"
|
|
56
|
+
onChange={console.log}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
13
62
|
The platform APIs use their own selection vocabulary and option shapes. The iOS
|
|
14
63
|
entry uses SwiftUI selection IDs, the Android entry uses Material dropdown keys
|
|
15
64
|
and enabled states, and the web entry follows browser select values. See the
|
|
16
65
|
framework guide for details and maintained examples:
|
|
17
|
-
[`docs/native-picker.md`](../../docs/native-picker.md).
|
|
66
|
+
[`docs/platform/native-picker.md`](../../docs/platform/native-picker.md).
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
/** @jsxImportSource @nativescript-community/octane */
|
|
70
|
+
// BagPicker.ios.tsx
|
|
71
|
+
import { useState } from 'octane'
|
|
72
|
+
import { SwiftUIPicker } from '@octane-xplat/picker/ios'
|
|
73
|
+
|
|
74
|
+
export function BagPicker() {
|
|
75
|
+
const [selection, setSelection] = useState('carry')
|
|
76
|
+
return (
|
|
77
|
+
<SwiftUIPicker
|
|
78
|
+
label="Bag"
|
|
79
|
+
selection={selection}
|
|
80
|
+
onSelectionChange={setSelection}
|
|
81
|
+
options={[{ id: 'carry', title: 'Carry-on' }]}
|
|
82
|
+
/>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octane-xplat/picker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Select control for Octane xplat — web select + SwiftUI picker (iOS) / Material dropdown (Android)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"android",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@nativescript/core": "9.1.2",
|
|
56
56
|
"@octanejs/vite-plugin": "0.1.61",
|
|
57
57
|
"octane": "0.6.3",
|
|
58
|
-
"tsrx-typegen": "0.2.
|
|
58
|
+
"tsrx-typegen": "0.2.2",
|
|
59
59
|
"typescript": "5.9.3",
|
|
60
60
|
"vite": "8.3.0"
|
|
61
61
|
},
|