@helsevestikt/hviktor-icons 0.0.47 → 0.0.51
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 +35 -281
- package/dist/custom-elements.json +30144 -7049
- package/package.json +4 -9
package/README.md
CHANGED
|
@@ -1,60 +1,35 @@
|
|
|
1
1
|
# Hviktor Icons
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
En samling med 900+ ikoner som rene Web Components som fungerer i alle rammeverk: Angular, React, Vue, Blazor eller vanilla JavaScript.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installasjon
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @helsevestikt/hviktor-icons
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Funksjoner
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- ✅ **Tiny bundle** - no framework overhead
|
|
13
|
+
- 900+ ikoner basert på NAV Aksel
|
|
14
|
+
- Rene Web Components (ingen avhengighet til rammeverk)
|
|
15
|
+
- Fungerer i Angular, React, Vue, Blazor og vanilla JS
|
|
16
|
+
- Tre innebygde størrelser: `sm` (16px), `md` (24px), `lg` (32px)
|
|
17
|
+
- Arver farge gjennom `currentColor`
|
|
18
|
+
- TypeScript typinger + `custom-elements.json`
|
|
20
19
|
|
|
21
|
-
##
|
|
20
|
+
## Bruk
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- `dist/lib/icons.d.ts` (configured via the `types` field in `package.json`)
|
|
26
|
-
- `dist/custom-elements.json`
|
|
27
|
-
|
|
28
|
-
This gives strong IntelliSense across editors and frameworks for:
|
|
29
|
-
|
|
30
|
-
- custom element tags (`hvi-icon-*`)
|
|
31
|
-
- attributes/properties (`size`)
|
|
32
|
-
- typed custom event `hvi-size-change`
|
|
33
|
-
|
|
34
|
-
TypeScript example:
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
const icon = document.createElement('hvi-icon-airplane');
|
|
38
|
-
icon.size = 'lg';
|
|
39
|
-
icon.addEventListener('hvi-size-change', (event) => {
|
|
40
|
-
console.log(event.detail.previousSize, event.detail.size);
|
|
41
|
-
});
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Quick Start
|
|
22
|
+
Du kan enten laste inn hele kodepakken (900+ ikoner), eller hente inn kun de ikonene du skal bruke i løsningen. Ikonene følger automatisk tekstfargen på siden, så de tilpasser seg for eksempel fargen i en knapp.
|
|
45
23
|
|
|
46
24
|
### Angular
|
|
47
25
|
|
|
48
|
-
```
|
|
49
|
-
//
|
|
26
|
+
```ts
|
|
27
|
+
// Importerer hele ikon-biblioteket:
|
|
50
28
|
import '@helsevestikt/hviktor-icons';
|
|
51
|
-
|
|
29
|
+
// eller importer ett og ett ikon:
|
|
30
|
+
import '@helsevestikt/hviktor-icons/icon-airplane.webcomponent';
|
|
31
|
+
import '@helsevestikt/hviktor-icons/icon-person.webcomponent';
|
|
52
32
|
|
|
53
|
-
export const appConfig = {
|
|
54
|
-
// Add schema to allow custom elements
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// In component
|
|
58
33
|
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
59
34
|
|
|
60
35
|
@Component({
|
|
@@ -63,276 +38,55 @@ import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
|
63
38
|
template: `
|
|
64
39
|
<hvi-icon-airplane size="lg"></hvi-icon-airplane>
|
|
65
40
|
<hvi-icon-person size="md"></hvi-icon-person>
|
|
66
|
-
<hvi-icon-house size="sm"></hvi-icon-house>
|
|
67
41
|
`,
|
|
68
42
|
})
|
|
69
43
|
export class AppComponent {}
|
|
70
44
|
```
|
|
71
45
|
|
|
72
|
-
###
|
|
73
|
-
|
|
74
|
-
```jsx
|
|
75
|
-
import '@helsevestikt/hviktor-icons';
|
|
76
|
-
|
|
77
|
-
function App() {
|
|
78
|
-
return (
|
|
79
|
-
<>
|
|
80
|
-
<hvi-icon-airplane size="lg"></hvi-icon-airplane>
|
|
81
|
-
<hvi-icon-person size="md"></hvi-icon-person>
|
|
82
|
-
</>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Vue
|
|
88
|
-
|
|
89
|
-
```vue
|
|
90
|
-
<template>
|
|
91
|
-
<hvi-icon-airplane size="lg"></hvi-icon-airplane>
|
|
92
|
-
<hvi-icon-person size="md"></hvi-icon-person>
|
|
93
|
-
</template>
|
|
94
|
-
|
|
95
|
-
<script>
|
|
96
|
-
import '@helsevestikt/hviktor-icons';
|
|
97
|
-
</script>
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Blazor
|
|
46
|
+
### Blazor / vanlig HTML
|
|
101
47
|
|
|
102
48
|
```html
|
|
103
|
-
<!-- In _Host.cshtml, _Layout.cshtml, or index.html -->
|
|
104
49
|
<script type="module">
|
|
105
50
|
import '@helsevestikt/hviktor-icons';
|
|
106
51
|
</script>
|
|
107
52
|
|
|
108
|
-
<!-- Then in your Razor components -->
|
|
109
53
|
<hvi-icon-airplane size="lg"></hvi-icon-airplane>
|
|
54
|
+
<hvi-icon-person size="md"></hvi-icon-person>
|
|
110
55
|
```
|
|
111
56
|
|
|
112
|
-
|
|
113
|
-
</div>
|
|
114
|
-
|
|
115
|
-
<hvi-icon-checkmark-circle size="md"></hvi-icon-checkmark-circle>
|
|
116
|
-
<hvi-icon-exclamationmark-triangle size="md"></hvi-icon-exclamationmark-triangle>
|
|
117
|
-
|
|
118
|
-
<style>
|
|
119
|
-
hvi-icon-house {
|
|
120
|
-
color: #0078d4;
|
|
121
|
-
}
|
|
57
|
+
## Størrelse
|
|
122
58
|
|
|
123
|
-
|
|
124
|
-
color: #107c10;
|
|
125
|
-
}
|
|
59
|
+
Tre forhåndsdefinerte størrelser er tilgjengelige via `size`-attributtet:
|
|
126
60
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
</style>
|
|
131
|
-
|
|
132
|
-
````
|
|
133
|
-
|
|
134
|
-
#### Vanilla JavaScript / HTML
|
|
61
|
+
- `size="sm"` - 16px
|
|
62
|
+
- `size="md"` - 24px (standard)
|
|
63
|
+
- `size="lg"` - 32px
|
|
135
64
|
|
|
136
65
|
```html
|
|
137
|
-
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
</head>
|
|
142
|
-
<body>
|
|
143
|
-
<hvi-icon-person size="md"></hvi-icon-person>
|
|
144
|
-
<hvi-icon-house size="lg"></hvi-icon-house>
|
|
145
|
-
|
|
146
|
-
<script>
|
|
147
|
-
HvictorIcons.register();
|
|
148
|
-
</script>
|
|
149
|
-
</body>
|
|
150
|
-
</html>
|
|
151
|
-
````
|
|
152
|
-
|
|
153
|
-
## Available Icons
|
|
66
|
+
<hvi-icon-checkmark size="sm"></hvi-icon-checkmark>
|
|
67
|
+
<hvi-icon-checkmark size="md"></hvi-icon-checkmark>
|
|
68
|
+
<hvi-icon-checkmark size="lg"></hvi-icon-checkmark>
|
|
69
|
+
```
|
|
154
70
|
|
|
155
|
-
|
|
71
|
+
## Tilgjengelige ikoner
|
|
156
72
|
|
|
157
|
-
|
|
73
|
+
Alle ikoner fra NAV Aksel er tilgjengelige med navnmønsteret:
|
|
158
74
|
|
|
159
|
-
-
|
|
160
|
-
- **Arrows** (52 icons): arrow-up, arrow-down, chevron-right, caret-left, etc.
|
|
161
|
-
- **Development** (20 icons): code, terminal, database, cloud, etc.
|
|
162
|
-
- **Files and application** (48 icons): file-pdf, folder, download, upload, etc.
|
|
163
|
-
- **Home** (46 icons): house, bed, calculator, book, etc.
|
|
164
|
-
- **Interface** (92 icons): chat, search, settings, trash, pencil, etc.
|
|
165
|
-
- **Law and security** (21 icons): shield, lock, gavel, passport, etc.
|
|
166
|
-
- **Media** (25 icons): play, pause, video, microphone, speaker, etc.
|
|
167
|
-
- **Money** (12 icons): wallet, card, receipt, piggybank, etc.
|
|
168
|
-
- **Nature and animals** (25 icons): sun, moon, flower, mountain, etc.
|
|
169
|
-
- **People** (38 icons): person, person-group, handshake, eye, etc.
|
|
170
|
-
- **Statistics and math** (28 icons): bar-chart, pie-chart, line-graph, etc.
|
|
171
|
-
- **Status** (36 icons): checkmark, x-mark, information, warning, etc.
|
|
172
|
-
- **Transportation** (21 icons): car, bus, train, airplane, bicycle, etc.
|
|
173
|
-
- **Wellness** (24 icons): first-aid, hospital, pill, stethoscope, etc.
|
|
174
|
-
- **Workplace** (24 icons): briefcase, buildings, door, meeting, etc.
|
|
75
|
+
- `hvi-icon-{name}`
|
|
175
76
|
|
|
176
|
-
|
|
77
|
+
Eksempler:
|
|
177
78
|
|
|
178
79
|
```html
|
|
179
80
|
<hvi-icon-checkmark size="md"></hvi-icon-checkmark>
|
|
180
81
|
<hvi-icon-x-mark size="md"></hvi-icon-x-mark>
|
|
181
|
-
<hvi-icon-information size="md"></hvi-icon-information>
|
|
182
|
-
<hvi-icon-exclamationmark-triangle size="md"></hvi-icon-exclamationmark-triangle>
|
|
183
82
|
<hvi-icon-chevron-down size="sm"></hvi-icon-chevron-down>
|
|
184
|
-
<hvi-icon-chevron-up size="sm"></hvi-icon-chevron-up>
|
|
185
83
|
<hvi-icon-person size="lg"></hvi-icon-person>
|
|
186
|
-
<hvi-icon-file-pdf size="md"></hvi-icon-file-pdf>
|
|
187
|
-
<hvi-icon-trash size="sm"></hvi-icon-trash>
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
Browse all icons at: https://aksel.nav.no/komponenter/ikoner
|
|
191
|
-
|
|
192
|
-
## Building
|
|
193
|
-
|
|
194
|
-
### Build the Angular Library
|
|
195
|
-
|
|
196
|
-
To build the library for npm distribution:
|
|
197
|
-
This section is for contributors developing the icon library itself.
|
|
198
|
-
|
|
199
|
-
### Project Structure
|
|
200
|
-
|
|
201
|
-
```
|
|
202
|
-
projects/icons/
|
|
203
|
-
├── src/
|
|
204
|
-
│ ├── lib/
|
|
205
|
-
│ │ ├── icons/ # 947 icon components
|
|
206
|
-
│ │ ├── base-icon.component.ts
|
|
207
|
-
│ │ └── register-elements.ts # Auto-generated
|
|
208
|
-
│ └── public-api.ts # Auto-generated exports
|
|
209
|
-
├── BLAZOR_GUIDE.md
|
|
210
|
-
├── IMPORT_NAV_ICONS.md
|
|
211
|
-
└── README.md
|
|
212
84
|
```
|
|
213
85
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
To import additional icons from NAV Aksel:
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
# Download and extract icons
|
|
220
|
-
Invoke-WebRequest -Uri "https://cdn.nav.no/aksel/icons/zip/aksel-icons.zip" -OutFile "aksel-icons.zip"
|
|
221
|
-
Expand-Archive -Path aksel-icons.zip -DestinationPath temp/aksel-icons
|
|
222
|
-
|
|
223
|
-
# Flatten to single directory
|
|
224
|
-
mkdir temp/all-icons
|
|
225
|
-
Get-ChildItem -Path "temp/aksel-icons" -Recurse -Filter "*.svg" | Copy-Item -Destination "temp/all-icons"
|
|
226
|
-
|
|
227
|
-
# Import all icons
|
|
228
|
-
npm run import:nav-icons temp/all-icons
|
|
229
|
-
|
|
230
|
-
# Generate register-elements.ts
|
|
231
|
-
npm run generate:register
|
|
232
|
-
|
|
233
|
-
# Build and test
|
|
234
|
-
npm run build:icons:bundle
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
See [IMPORT_NAV_ICONS.md](./IMPORT_NAV_ICONS.md) for detailed instructions.
|
|
238
|
-
This creates the library in `dist/icons/` with all necessary files for npm.
|
|
239
|
-
|
|
240
|
-
### Build the Web Components Bundle
|
|
241
|
-
|
|
242
|
-
To create the standalone Web Components bundle for Blazor and other frameworks:
|
|
243
|
-
|
|
244
|
-
```bash
|
|
245
|
-
npm run build:icons:bundle
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
use `currentColor` for the fill, so they inherit the text color. You can style them using CSS:
|
|
249
|
-
|
|
250
|
-
```css
|
|
251
|
-
/* Change color */
|
|
252
|
-
.success-icon {
|
|
253
|
-
color: #107c10; /* Green */
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
.error-icon {
|
|
257
|
-
color: #d83b01; /* Red */
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.info-icon {
|
|
261
|
-
color: #0078d4; /* Blue */
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/* Icons automatically adjust to font-size if not using size attribute */
|
|
265
|
-
.large-icon {
|
|
266
|
-
font-size: 48px;
|
|
267
|
-
}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Icon Sizes
|
|
271
|
-
|
|
272
|
-
Three predefined sizes are available via the `size` attribute:
|
|
273
|
-
|
|
274
|
-
- `size="sm"` - 16px (small)
|
|
275
|
-
- `size="md"` - 24px (medium, default)
|
|
276
|
-
- `size="lg"` - 32px (large)
|
|
277
|
-
|
|
278
|
-
````html
|
|
279
|
-
<hvi-icon-checkmark size="sm"></hvi-icon-checkmark>
|
|
280
|
-
<hvi-icon-checkmark size="md"></hvi-icon-checkmark>
|
|
281
|
-
<hvi-icon-checkmark size="lg"></hvi-icon-checkmark>
|
|
282
|
-
```bash npm run publish:icons
|
|
283
|
-
````
|
|
284
|
-
|
|
285
|
-
This will:
|
|
286
|
-
|
|
287
|
-
1. Bump the patch version
|
|
288
|
-
2. Build the Angular library
|
|
289
|
-
3. Build the Web Components bundle
|
|
290
|
-
4. Publish to npm
|
|
291
|
-
|
|
292
|
-
## Development
|
|
293
|
-
|
|
294
|
-
### Adding New Icons
|
|
295
|
-
|
|
296
|
-
1. Create a new component in `projects/icons/src/lib/icons/`
|
|
297
|
-
2. Export it from `public-api.ts`
|
|
298
|
-
3. Register it in `register-elements.ts`
|
|
299
|
-
|
|
300
|
-
### Running Tests
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
ng test icons
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
## Styling
|
|
307
|
-
|
|
308
|
-
Icons inherit the current text color via `currentColor`. You can style them using CSS:
|
|
309
|
-
|
|
310
|
-
```css
|
|
311
|
-
.my-icon {
|
|
312
|
-
color: blue;
|
|
313
|
-
font-size: 24px; /* For custom sizes */
|
|
314
|
-
}
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## Browser Support
|
|
318
|
-
|
|
319
|
-
- Modern browsers with Web Components support (Chrome, Firefox, Safari, Edge)
|
|
320
|
-
- Polyfills may be needed for older browsers
|
|
321
|
-
|
|
322
|
-
## License
|
|
323
|
-
|
|
324
|
-
See the LICENSE file in the repository.
|
|
325
|
-
|
|
326
|
-
## Running end-to-end tests
|
|
327
|
-
|
|
328
|
-
For end-to-end (e2e) testing, run:
|
|
329
|
-
|
|
330
|
-
```bash
|
|
331
|
-
ng e2e
|
|
332
|
-
```
|
|
86
|
+
Se alle tilgjengelige ikoner på NAV Aksel:
|
|
333
87
|
|
|
334
|
-
|
|
88
|
+
- https://aksel.nav.no/komponenter/ikoner
|
|
335
89
|
|
|
336
|
-
##
|
|
90
|
+
## Lisens
|
|
337
91
|
|
|
338
|
-
|
|
92
|
+
MIT
|