@getodk/web-forms 0.1.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 +62 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.js +34797 -0
- package/dist/style.css +1 -0
- package/package.json +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @getodk/web-forms
|
|
2
|
+
|
|
3
|
+
This is a Vue component library that uses [`@getodk/xforms-engine`](../xforms-engine/) to render ODK XForms.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
To use this library in a Vue.js application:
|
|
8
|
+
|
|
9
|
+
1. Import `@getodk/web-forms` as a dependency in the application
|
|
10
|
+
2. Install the exported plugin by adding app.use(WebFormsPlugin) in entry component (usually App.vue)
|
|
11
|
+
3. Add the exported component anywhere in the application:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<OdkWebForm :form-xml="formVersionXml.data" @submit="handleSubmit" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Plugin:**
|
|
18
|
+
|
|
19
|
+
Plugin is there to initialize PrimeVue, currently it exposes no options. In future, various configuration options might be added to the plugin.
|
|
20
|
+
|
|
21
|
+
**Props and Events:**
|
|
22
|
+
|
|
23
|
+
- `form-xml`: the XML of ODK XForm to be rendered.
|
|
24
|
+
- `submit`: it is raised when user pressed "Send" button on the Form.
|
|
25
|
+
|
|
26
|
+
## Development
|
|
27
|
+
|
|
28
|
+
To run in development, run this command at the monorepo root:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
yarn workspace @getodk/web-forms dev
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Individual test environments, and their corresponding watch modes, also have separate commands which can be found in [`package.json`](./package.json).
|
|
35
|
+
|
|
36
|
+
### Material Design
|
|
37
|
+
|
|
38
|
+
This package uses Material Design system for the UI, though not strictly. The idea is to closely match the design to that of ODK Collect.
|
|
39
|
+
|
|
40
|
+
For Material Components and layout, it is using PrimeVue component library.
|
|
41
|
+
|
|
42
|
+
### Theme and Styles
|
|
43
|
+
|
|
44
|
+
We are using customized version of Material Light Indigo theme provided by the PrimeVue. All customization is done in [`./themes/2024-light/theme.scss`](./themes/2024-light/theme.scss) file. We tend to define all css rules in that file so that in future we could support shipping multiple themes at the same time, However, this approach is flexible and subject to change in the near future.
|
|
45
|
+
|
|
46
|
+
### Icons
|
|
47
|
+
|
|
48
|
+
We use **Material Icons** using IcoMoon to select a subset of icons in order to minimize the size. The font files are located in [`./src/assets/fonts/`](./src/assets/fonts/), and the CSS is [`./src/assets/css/icomoon.css`](/src/assets/css/icomoon.css). Our IcoMoon definition is in the root directory of this package at [`./icomoon.json`](./icomoon.json).
|
|
49
|
+
|
|
50
|
+
To update the icons using the [IcoMoon website](https://icomoon.io/app/):
|
|
51
|
+
|
|
52
|
+
1. Click the "Import Icons" button in IcoMoon. Select [`icomoon.json`](/icomoon.json). When prompted, load the settings stored in the file.
|
|
53
|
+
2. Scroll down to the "Add Icons From Library" link and add **Material Icons**.
|
|
54
|
+
3. Move the imported set above Material Icons, using the 3-bar icon to the right of the imported set's title. (This should help preserve the icon order and minimize the diff.)
|
|
55
|
+
4. Update the icons by selecting (highlighting) the new icons to add. They don't need to be moved or altered.
|
|
56
|
+
5. Download the new font, then copy the files (`icomoon.css`, `fonts/*`, `icomoon.json`) into their locations in the repository.
|
|
57
|
+
- You will need to rename the files and update the paths in the CSS (`fonts/icomoon.ttf?...` becomes `/fonts/icomoon.ttf?...` with a beginning slash).
|
|
58
|
+
- You will also need to prettify the JSON file to use two space indentation.
|
|
59
|
+
|
|
60
|
+
By following the steps above, you should minimize the diff. However, in the JSON file, you may still see changes for properties like `id`, `iconIdx`, `setId`, and `setIdx`.
|
|
61
|
+
|
|
62
|
+
Material Icons are available under the Apache License Version 2.0. Copy of the license can be found at [`./src/assets/fonts/LICENSE-2.0.txt`](./src/assets/fonts/LICENSE-2.0.txt)
|
package/dist/favicon.ico
ADDED
|
Binary file
|