@getodk/web-forms 0.8.0 → 0.10.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 +40 -15
- package/dist/__vite-browser-external-DYxpcVy9.js +4 -0
- package/dist/index.js +34914 -36757
- package/package.json +22 -18
package/README.md
CHANGED
|
@@ -67,30 +67,55 @@ Individual test environments, and their corresponding watch modes, also have sep
|
|
|
67
67
|
|
|
68
68
|
Upload XLSForm and XForm functionality in [`demo`](./src/demo/) app and in dev mode depends on [XLSForm-online](https://github.com/getodk/xlsform-online). Run the xlsform-online locally. By default it runs on port 8000, if you are running it on another port then you should update the [`config`](./src/demo/config.json) file.
|
|
69
69
|
|
|
70
|
-
###
|
|
70
|
+
### Styling Overview
|
|
71
71
|
|
|
72
|
-
This
|
|
72
|
+
This project uses a combination of [PrimeFlex](https://primeflex.org/) and [PrimeVue](https://primevue.org/) for consistent styling, alongside specific font rules for the ODK Website's Web Forms Preview.
|
|
73
|
+
|
|
74
|
+
- **PrimeFlex**: A CSS utility library used for layout-related properties such as positioning (e.g., flexbox, grid), responsive breakpoints, font-size and font-weight adjustments.
|
|
75
|
+
- **PrimeVue**: A UI component library that defines the visual design of components, including shapes (e.g., borders, rounded corners) and color schemes.
|
|
76
|
+
|
|
77
|
+
#### Theming with CSS Variables
|
|
78
|
+
|
|
79
|
+
We use CSS variables for theming with two prefixes:
|
|
80
|
+
|
|
81
|
+
- `--p-` Prefix: Variables prefixed with `--p-` (e.g., `--p-primary-50`) come from PrimeVue and control its component styles (e.g., colors, borders). These are part of PrimeVue’s [theming system](https://primevue.org/theming/styled/).
|
|
82
|
+
- `--odk-` Prefix: Variables prefixed with `--odk-` (e.g., `--odk-font-family`) are custom to this project and manage styles outside PrimeVue or PrimeFlex, such as application-specific typography.
|
|
83
|
+
|
|
84
|
+
#### Z-Index Layering System
|
|
85
|
+
|
|
86
|
+
This package uses a centralized `z-index` layering system to manage UI stacking order, defined in `src/assets/css/style.scss`. The ODK variables (e.g., `--odk-z-index-error-banner`) ensure elements like floating error messages, form controls, and overlays stack correctly without overlap.
|
|
73
87
|
|
|
74
|
-
|
|
88
|
+
- **Key layers**:
|
|
75
89
|
|
|
76
|
-
|
|
90
|
+
- `--odk-z-index-base` (background)
|
|
91
|
+
- `--odk-z-index-form-content` (inputs, buttons)
|
|
92
|
+
- `--odk-z-index-form-floating` (highlights, tooltips)
|
|
93
|
+
- `--odk-z-index-error-banner` (floating errors)
|
|
94
|
+
- `--odk-z-index-overlay` (modals)
|
|
95
|
+
- `--odk-z-index-topmost` (loaders, notifications)
|
|
77
96
|
|
|
78
|
-
|
|
97
|
+
- **Usage**: Apply with `z-index: var(--odk-z-index-error-banner);` on positioned elements (e.g., `position: absolute`).
|
|
98
|
+
|
|
99
|
+
#### Fonts
|
|
100
|
+
|
|
101
|
+
Form elements use `font-family: Roboto, sans-serif;` for accessibility and a clean, readable appearance.
|
|
102
|
+
|
|
103
|
+
#### Material Design
|
|
104
|
+
|
|
105
|
+
This package uses the Material Design system for the UI, though not strictly. The idea is to closely match the design to that of [ODK Collect](https://docs.getodk.org/collect-intro/).
|
|
79
106
|
|
|
80
107
|
### Icons
|
|
81
108
|
|
|
82
|
-
|
|
109
|
+
The `IconSVG` component renders Material Design Icons (MDI) with customizable size and style variants. It uses the `@mdi/js` library for icon data and supports a predefined set of icons.
|
|
83
110
|
|
|
84
|
-
|
|
111
|
+
```js
|
|
112
|
+
<IconSVG name="mdiCamera" size="md" variant="primary" />
|
|
113
|
+
```
|
|
85
114
|
|
|
86
|
-
|
|
87
|
-
2. Scroll down to the "Add Icons From Library" link and add **Material Icons**.
|
|
88
|
-
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.)
|
|
89
|
-
4. Update the icons by selecting (highlighting) the new icons to add. They don't need to be moved or altered.
|
|
90
|
-
5. Download the new font, then copy the files (`icomoon.css`, `fonts/*`, `icomoon.json`) into their locations in the repository.
|
|
91
|
-
- 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).
|
|
92
|
-
- You will also need to prettify the JSON file to use two space indentation.
|
|
115
|
+
To add a new icon:
|
|
93
116
|
|
|
94
|
-
|
|
117
|
+
- Import the icon from `@mdi/js` in the `IconSVG` component.
|
|
118
|
+
- Add the icon to the `iconMap` object with its corresponding name.
|
|
119
|
+
- Use the icon by passing its name to the `name` prop.
|
|
95
120
|
|
|
96
121
|
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)
|