@hotosm/ui 0.3.1-b4 → 0.3.1-b6
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 +87 -72
- package/dist/chunks/chunk.2MK55PUE.js +700 -0
- package/dist/chunks/{callout.USQGOL5A.js → chunk.3NBBS2A2.js} +2 -2
- package/dist/chunks/chunk.456NATDG.js +1 -0
- package/dist/chunks/{chunk.4YLAIDAG.js → chunk.7RJ72M75.js} +3 -3
- package/dist/chunks/chunk.AIZM63SF.js +669 -0
- package/dist/chunks/chunk.BM3GXGCS.js +1 -0
- package/dist/chunks/{chunk.OVCI43FD.js → chunk.MIYFUINI.js} +2 -2
- package/dist/chunks/{chunk.NQHNA5TA.js → chunk.PDLGEB7T.js} +3 -3
- package/dist/chunks/chunk.SZ46YTWY.js +1 -0
- package/dist/chunks/chunk.YYEOK7MA.js +1 -0
- package/dist/components/consent/consent.component.d.ts +3 -0
- package/dist/components/consent/consent.component.js +1 -1
- package/dist/components/consent/consent.d.ts +0 -1
- package/dist/components/consent/consent.js +1 -1
- package/dist/components/header/header.component.d.ts +4 -0
- package/dist/components/header/header.component.js +1 -1
- package/dist/components/header/header.d.ts +0 -1
- package/dist/components/header/header.js +1 -1
- package/dist/components/logo/logo.component.js +1 -1
- package/dist/components/logo/logo.d.ts +0 -1
- package/dist/components/logo/logo.js +1 -1
- package/dist/components/tracking/tracking.component.d.ts +3 -0
- package/dist/components/tracking/tracking.component.js +1 -1
- package/dist/components/tracking/tracking.d.ts +0 -1
- package/dist/components/tracking/tracking.js +1 -1
- package/dist/hotosm-ui.d.ts +4 -12
- package/dist/hotosm-ui.js +1 -1
- package/dist/style.css +7 -1
- package/dist/themes/hot-wa-override.css +222 -0
- package/dist/themes/hot.css +165 -213
- package/package.json +1 -1
- package/dist/chunks/button.QMPBLQB7.js +0 -1
- package/dist/chunks/chunk.7VBX4GII.js +0 -1
- package/dist/chunks/chunk.FIQQYKEP.js +0 -14
- package/dist/chunks/chunk.I26W4NHZ.js +0 -460
- package/dist/chunks/chunk.OHRBDQCO.js +0 -45
- package/dist/chunks/chunk.TFICHQZE.js +0 -186
- package/dist/chunks/chunk.XAMKQWQ3.js +0 -92
- package/dist/chunks/dialog.ZJLYCG4P.js +0 -217
- package/dist/chunks/icon.ZB6BUFKB.js +0 -1
- package/dist/chunks/tab-group.M6XGU33J.js +0 -360
- package/dist/themes/hot-wa.css +0 -179
package/README.md
CHANGED
|
@@ -52,116 +52,131 @@
|
|
|
52
52
|
|
|
53
53
|
## Shared UI Components with HOT Theming
|
|
54
54
|
|
|
55
|
-
This repository contains
|
|
55
|
+
This repository contains advice on how to use the WebAwesome
|
|
56
|
+
[Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components)
|
|
57
|
+
library, references to the HOTOSM style guide, and a few 'wrapper'
|
|
58
|
+
components to assist development:
|
|
56
59
|
|
|
57
60
|
1. Reduced code duplication across HOT tools (we repeat a lot!)
|
|
58
61
|
2. Simplified developer experience to create a HOT app.
|
|
59
62
|
3. Reasonably consistent theming and style across tools.
|
|
60
63
|
|
|
61
|
-
They are available as
|
|
62
|
-
[Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components)
|
|
63
|
-
and have first-class React support.
|
|
64
|
-
|
|
65
64
|
The main goal of this project is not to re-invent the wheel, or add an extra burden
|
|
66
|
-
of development and maintenance. It should include a minimal number of
|
|
65
|
+
of development and maintenance. It should include a minimal number of
|
|
66
|
+
components, such as:
|
|
67
67
|
|
|
68
68
|
- Header, including auth flows (OSM, Google) and login info.
|
|
69
69
|
- Sidebar with links to extra resources.
|
|
70
70
|
- Footer with links.
|
|
71
|
-
- File upload component (including dropzone).
|
|
72
|
-
- Date picker component.
|
|
73
|
-
- Workflow stepper component.
|
|
74
71
|
|
|
75
72
|
## Quick start
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
### NPM
|
|
80
|
-
|
|
81
|
-
Appropriate for applications that have installable dependencies
|
|
74
|
+
Current HOTOSM UI version used: `0.3.1-b5`
|
|
75
|
+
Current WebAwesome version used: `3.0.0-beta.1`
|
|
82
76
|
|
|
83
|
-
|
|
77
|
+
### Install WebAwesome
|
|
84
78
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
```html
|
|
88
|
-
<script>
|
|
89
|
-
import '@hotosm/ui/dist/style.css';
|
|
90
|
-
import { Logo, Button } from '@hotosm/ui/dist/hotosm-ui';
|
|
91
|
-
</script>
|
|
79
|
+
```bash
|
|
80
|
+
pnpm install "@awesome.me/webawesome@3.0.0-beta.1"
|
|
92
81
|
```
|
|
93
82
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
```
|
|
83
|
+
> [!NOTE]
|
|
84
|
+
> It's important to pin the version of web awesome used to the version in this
|
|
85
|
+
> library, to avoid any conflicts and incompatibilities between components.
|
|
98
86
|
|
|
99
|
-
|
|
87
|
+
### Install HOT Components
|
|
100
88
|
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
import { Logo, Button } from '@hotosm/ui/dist/react';
|
|
89
|
+
```bash
|
|
90
|
+
pnpm install "@hotosm/ui"
|
|
104
91
|
```
|
|
105
92
|
|
|
106
|
-
|
|
107
|
-
<Logo />
|
|
108
|
-
<Button variant="primary">Click me!</Button>
|
|
109
|
-
```
|
|
93
|
+
### Configure The Styles
|
|
110
94
|
|
|
111
|
-
|
|
95
|
+
In your `index.html` or equivalent frontend root, add the following classes
|
|
96
|
+
to your `<html>` block:
|
|
112
97
|
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
```html
|
|
99
|
+
<!DOCTYPE html>
|
|
100
|
+
<html class="wa-theme-default wa-palette-hotosm wa-brand-red wa-neutral-gray
|
|
101
|
+
wa-success-cyan wa-warning-yellow wa-danger-orange">
|
|
102
|
+
<head>
|
|
103
|
+
xxx
|
|
104
|
+
</head>
|
|
105
|
+
<body>
|
|
106
|
+
xxx
|
|
107
|
+
</body>
|
|
108
|
+
</html>
|
|
109
|
+
```
|
|
115
110
|
|
|
116
|
-
|
|
111
|
+
> [!IMPORTANT]
|
|
112
|
+
> These classes determine the colour usage for different component variants,
|
|
113
|
+
> and probably should not be changed!
|
|
117
114
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
rel="stylesheet"
|
|
121
|
-
href="https://s3.amazonaws.com/hotosm-ui/latest/dist/style.css"
|
|
122
|
-
/>
|
|
115
|
+
And import the required styles in your `main.ts` or equivalent (we import from package
|
|
116
|
+
rather than CDN, to allow the bundler to work it's CSS tree-shaking magic).
|
|
123
117
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
></script>
|
|
118
|
+
```js
|
|
119
|
+
import '@hotosm/ui/dist/style.css';
|
|
120
|
+
```
|
|
128
121
|
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
If you wish to use any of the variables in `hot.css` manually, you can reference
|
|
123
|
+
them as variables like so:
|
|
131
124
|
|
|
132
|
-
|
|
125
|
+
```css
|
|
126
|
+
/* In your CSS file */
|
|
127
|
+
some-param: var(--hot-some-param);
|
|
128
|
+
/* See all variables in the `theme/hot.css` file */
|
|
129
|
+
```
|
|
133
130
|
|
|
134
|
-
|
|
135
|
-
tracking banners, etc, and does not re-invent the wheel for low-level components.
|
|
131
|
+
### Use The Components
|
|
136
132
|
|
|
137
|
-
|
|
133
|
+
#### Via Bundler
|
|
138
134
|
|
|
139
|
-
|
|
140
|
-
simply import the component of the same name from the [Shoelace docs]
|
|
141
|
-
(<https://shoelace.style>):
|
|
135
|
+
Import each component individually into your code:
|
|
142
136
|
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
```html
|
|
138
|
+
<script>
|
|
139
|
+
import '@hotosm/ui/dist/components/header/header.js';
|
|
140
|
+
</script>
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
<hot-header
|
|
143
|
+
param1=""
|
|
144
|
+
param2=""
|
|
145
|
+
>
|
|
146
|
+
</hot-header>
|
|
147
|
+
```
|
|
150
148
|
|
|
151
|
-
|
|
149
|
+
#### Via CDN
|
|
152
150
|
|
|
153
|
-
|
|
154
|
-
import
|
|
155
|
-
```
|
|
151
|
+
If you are working directly in HTML, or other ways without a configured
|
|
152
|
+
bundler, you can import all the components as a bundle, as use them like so:
|
|
156
153
|
|
|
157
|
-
```html
|
|
158
|
-
<
|
|
159
|
-
|
|
154
|
+
```html
|
|
155
|
+
<script>
|
|
156
|
+
import '@hotosm/ui/dist/style.css';
|
|
157
|
+
import '@hotosm/ui/dist/hotosm-ui';
|
|
158
|
+
</script>
|
|
160
159
|
|
|
161
|
-
|
|
160
|
+
<hot-logo><hot-logo>
|
|
161
|
+
<hot-button variant="primary">Click me!</hot-button>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### React
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
Import in the same way as the bundler example above, except events
|
|
167
|
+
are bound to slightly differently:
|
|
168
|
+
|
|
169
|
+
```jsx
|
|
170
|
+
<hot-button
|
|
171
|
+
size='small'
|
|
172
|
+
variant='text'
|
|
173
|
+
disabled={currentIndex <= 0}
|
|
174
|
+
onClick={() => {
|
|
175
|
+
console.log('do stuff');
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
</hot-button>
|
|
179
|
+
```
|
|
165
180
|
|
|
166
181
|
### Development
|
|
167
182
|
|