@helsevestikt/hviktor-icons 0.0.48 → 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.
Files changed (2) hide show
  1. package/README.md +35 -281
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,60 +1,35 @@
1
1
  # Hviktor Icons
2
2
 
3
- A collection of **900+ icons** as pure **Web Components** that work in any framework - Angular, React, Vue, Blazor, or vanilla JavaScript.
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
- ## Installation
5
+ ## Installasjon
6
6
 
7
7
  ```bash
8
8
  npm install @helsevestikt/hviktor-icons
9
9
  ```
10
10
 
11
- ## Features
11
+ ## Funksjoner
12
12
 
13
- - ✅ **900+ icons** based on NAV Aksel design system
14
- - **Pure Web Components** - no framework dependencies
15
- - **Works everywhere** - Angular, React, Vue, Blazor, vanilla JS
16
- - **Three sizes**: `sm` (16px), `md` (24px), `lg` (32px)
17
- - **Customizable** via CSS `color` property
18
- - ✅ **Full TypeScript support** with IntelliSense
19
- - ✅ **Tiny bundle** - no framework overhead
13
+ - 900+ ikoner basert 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
- ## TypeScript typings and metadata
20
+ ## Bruk
22
21
 
23
- The package publishes both:
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
- ```typescript
49
- // app.config.ts or main.ts
26
+ ```ts
27
+ // Importerer hele ikon-biblioteket:
50
28
  import '@helsevestikt/hviktor-icons';
51
- import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
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
- ### React
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
- <h1>Dashboard</h1>
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
- hvi-icon-checkmark-circle {
124
- color: #107c10;
125
- }
59
+ Tre forhåndsdefinerte størrelser er tilgjengelige via `size`-attributtet:
126
60
 
127
- hvi-icon-exclamationmark-triangle {
128
- color: #d83b01;
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
- <!DOCTYPE html>
138
- <html>
139
- <head>
140
- <script src="path/to/hviktor-icons.js"></script>
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
- All **947 icons** from [NAV Aksel](https://aksel.nav.no/komponenter/ikoner) are available. Icon names follow the pattern `hvi-icon-{name}`.
71
+ ## Tilgjengelige ikoner
156
72
 
157
- ### Icon Categories
73
+ Alle ikoner fra NAV Aksel er tilgjengelige med navnmønsteret:
158
74
 
159
- - **Accessibility** (12 icons): braille, wheelchair, hearing-loop, etc.
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
- ### Example Icon Names
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
- ### Adding New Icons
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
- Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
88
+ - https://aksel.nav.no/komponenter/ikoner
335
89
 
336
- ## Additional Resources
90
+ ## Lisens
337
91
 
338
- For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
92
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helsevestikt/hviktor-icons",
3
- "version": "0.0.48",
3
+ "version": "0.0.51",
4
4
  "description": "Pure Web Components icon library with 900+ icons, works in any framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -45,11 +45,11 @@
45
45
  "license": "MIT",
46
46
  "repository": {
47
47
  "type": "git",
48
- "url": "https://github.com/helsevestikt/hviktor-angular.git",
48
+ "url": "https://github.com/helsevestikt/hviktor.git",
49
49
  "directory": "projects/icons"
50
50
  },
51
51
  "dependencies": {
52
- "tslib": "^2.3.0"
52
+ "tslib": "^2.8.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "rimraf": "^5.0.0",