@openwebf/react-cupertino-ui 0.3.35 → 0.4.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 ADDED
@@ -0,0 +1,207 @@
1
+ # WebF Cupertino UI
2
+
3
+ A Cupertino UI component set for WebF.
4
+
5
+ It wraps Flutter's native Cupertino widgets as HTML custom elements (e.g. `<flutter-cupertino-button>`),
6
+ so you can build Flutter app UIs using web technologies with WebF.
7
+
8
+ ## React / Vue (npm) — Install & Use
9
+
10
+ These npm packages are for **WebF JavaScript developers**. They provide framework integrations and
11
+ TypeScript types for the Cupertino custom elements rendered by Flutter.
12
+
13
+ > This is not a “run in the browser” UI library. You still need a Flutter app with WebF + this
14
+ > Flutter package installed (see the next section).
15
+
16
+ ### Install
17
+
18
+ Vue:
19
+
20
+ ```bash
21
+ npm install @openwebf/vue-cupertino-ui
22
+ ```
23
+
24
+ React:
25
+
26
+ ```bash
27
+ npm install @openwebf/react-cupertino-ui
28
+ ```
29
+
30
+ ### React usage (from `@openwebf/react-cupertino-ui`)
31
+
32
+ ```tsx
33
+ import React, { useState } from 'react';
34
+ import {
35
+ FlutterCupertinoButton,
36
+ FlutterCupertinoInput,
37
+ FlutterCupertinoSwitch,
38
+ } from '@openwebf/react-cupertino-ui';
39
+
40
+ export function App() {
41
+ const [username, setUsername] = useState('');
42
+ const [enabled, setEnabled] = useState(false);
43
+
44
+ return (
45
+ <>
46
+ <FlutterCupertinoInput
47
+ val={username}
48
+ placeholder="Enter username"
49
+ onInput={(e) => setUsername(e.detail)}
50
+ />
51
+
52
+ <FlutterCupertinoSwitch
53
+ checked={enabled}
54
+ onChange={(e) => setEnabled(e.detail)}
55
+ />
56
+
57
+ <FlutterCupertinoButton onClick={() => console.log({ username, enabled })}>
58
+ Submit
59
+ </FlutterCupertinoButton>
60
+ </>
61
+ );
62
+ }
63
+ ```
64
+
65
+ ### Vue usage (from `@openwebf/vue-cupertino-ui`)
66
+
67
+ 1) Enable template type-checking for the custom elements by referencing the package types (for
68
+ example in `src/env.d.ts`):
69
+
70
+ ```ts
71
+ /// <reference types="@openwebf/vue-cupertino-ui" />
72
+ ```
73
+
74
+ 2) Use the custom elements in your SFC templates:
75
+
76
+ ```vue
77
+ <template>
78
+ <flutter-cupertino-input
79
+ :val="username"
80
+ placeholder="Enter username"
81
+ @input="(e) => (username = e.detail)"
82
+ />
83
+
84
+ <flutter-cupertino-switch
85
+ :checked="enabled"
86
+ @change="(e) => (enabled = e.detail)"
87
+ />
88
+
89
+ <flutter-cupertino-button @click="submit">
90
+ Submit
91
+ </flutter-cupertino-button>
92
+ </template>
93
+
94
+ <script setup lang="ts">
95
+ import { ref } from 'vue';
96
+
97
+ const username = ref('');
98
+ const enabled = ref(false);
99
+
100
+ function submit() {
101
+ console.log({ username: username.value, enabled: enabled.value });
102
+ }
103
+ </script>
104
+ ```
105
+
106
+ ## Flutter (WebF runtime) — Install & Use
107
+
108
+ The npm packages above only provide types/framework wrappers. The actual rendering happens inside
109
+ your Flutter app via WebF + this Flutter package.
110
+
111
+ ### 1) Add dependencies
112
+
113
+ Add `webf_cupertino_ui` to your `pubspec.yaml`:
114
+
115
+ ```yaml
116
+ dependencies:
117
+ webf_cupertino_ui: ^0.4.0
118
+ ```
119
+
120
+ This package depends on WebF (`webf: ^0.24.0`) and will pull it in automatically, but you can pin it
121
+ explicitly if your app needs to.
122
+
123
+ ### 2) Register the custom elements
124
+
125
+ Call `installWebFCupertinoUI()` before creating/loading any WebF pages:
126
+
127
+ ```dart
128
+ import 'package:flutter/material.dart';
129
+ import 'package:webf_cupertino_ui/webf_cupertino_ui.dart';
130
+
131
+ void main() {
132
+ installWebFCupertinoUI();
133
+ runApp(const MyApp());
134
+ }
135
+ ```
136
+
137
+ Now your WebF pages can use the Cupertino tags (e.g. `<flutter-cupertino-button>`) and they will
138
+ render as real Flutter Cupertino widgets.
139
+
140
+ ## Features
141
+
142
+ - **Native Flutter Widgets**: Use Flutter's native Cupertino widgets through web technologies
143
+ - **Web Framework Development**: Build your Flutter app UI with Vue.js or React
144
+ - **Custom HTML Elements**: Cupertino widgets exposed as HTML custom elements
145
+ - **Full Native Performance**: Renders as native Flutter widgets, not web views
146
+ - **TypeScript Support**: Complete type definitions for better development experience
147
+
148
+ ## Components & Docs
149
+
150
+ Component docs live in `lib/src/*.md` (React-focused):
151
+ - [FlutterCupertinoActionSheet](lib/src/action_sheet.md)
152
+ - [FlutterCupertinoAlert](lib/src/alert.md)
153
+ - [FlutterCupertinoButton](lib/src/button.md)
154
+ - [FlutterCupertinoCheckbox](lib/src/checkbox.md)
155
+ - [FlutterCupertinoContextMenu](lib/src/context_menu.md)
156
+ - [FlutterCupertinoDatePicker](lib/src/date_picker.md)
157
+ - [FlutterCupertinoFormSection](lib/src/form_section.md)
158
+ - [FlutterCupertinoInput](lib/src/input.md)
159
+ - [FlutterCupertinoListSection](lib/src/list_section.md)
160
+ - [FlutterCupertinoListTile](lib/src/list_tile.md)
161
+ - [FlutterCupertinoModalPopup](lib/src/modal_popup.md)
162
+ - [FlutterCupertinoRadio](lib/src/radio.md)
163
+ - [FlutterCupertinoSearchTextField](lib/src/search_text_field.md)
164
+ - [FlutterCupertinoSlider](lib/src/slider.md)
165
+ - [FlutterCupertinoSlidingSegmentedControl](lib/src/sliding-segmented-control.md)
166
+ - [FlutterCupertinoSwitch](lib/src/switch.md)
167
+ - [FlutterCupertinoTabBar](lib/src/tab_bar.md)
168
+ - [FlutterCupertinoTabScaffold](lib/src/tab_scaffold.md)
169
+ - [FlutterCupertinoTabView](lib/src/tab_view.md)
170
+ - [FlutterCupertinoTextFormFieldRow](lib/src/text_form_field_row.md)
171
+
172
+
173
+ ## Contributing & Testing (via `webf codegen`)
174
+
175
+ This repo is the source of truth for:
176
+ - Flutter custom elements (`lib/src/*.dart`)
177
+ - TypeScript typings (`lib/src/*.d.ts`)
178
+ - Generated Dart bindings (`lib/src/*_bindings_generated.dart`, generated by `webf codegen`)
179
+ - Generated npm packages (`@openwebf/react-cupertino-ui`, `@openwebf/vue-cupertino-ui`)
180
+
181
+ Typical workflow:
182
+
183
+ 1) Update or add typings in `lib/src/*.d.ts`
184
+ 2) Regenerate Dart bindings:
185
+
186
+ ```bash
187
+ webf codegen --dart-only
188
+ ```
189
+
190
+ 3) Generate the React/Vue npm packages (optionally add `--publish-to-npm`):
191
+
192
+ ```bash
193
+ webf codegen --framework react --package-name @openwebf/react-cupertino-ui
194
+ webf codegen --framework vue --package-name @openwebf/vue-cupertino-ui
195
+ ```
196
+
197
+ 4) Run tests:
198
+
199
+ ```bash
200
+ flutter test
201
+ ```
202
+
203
+ See `CONTRIBUTING.md` and `docs/migration-rules.md` for more details and conventions.
204
+
205
+ ## License
206
+
207
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.