@ngu-no/ngu-designsystem 0.0.0 → 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 +89 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# @ngu-no/ngu-designsystem
|
|
2
|
+
|
|
3
|
+
The design system for [Norges geologiske undersøkelse (NGU)](https://www.ngu.no), built on [Designsystemet](https://designsystemet.no) from Digdir.
|
|
4
|
+
|
|
5
|
+
The package contains:
|
|
6
|
+
|
|
7
|
+
- **The NGU theme**: Designsystemet tokens (`--ds-*`) with NGU's colours and typography, plus NGU-only tokens (`--ngu-*`).
|
|
8
|
+
- **NGU components**: components Designsystemet doesn't have, as CSS classes (`.ngu-*`) and, where they need behaviour, light DOM custom elements (`<ngu-*>`).
|
|
9
|
+
|
|
10
|
+
Designsystemet's own components (buttons, tabs, forms and so on) are not copied into this package. You use them directly from `@digdir/designsystemet-css` and `@digdir/designsystemet-web`, and they get the NGU look from the theme.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install @ngu-no/ngu-designsystem @digdir/designsystemet-css @digdir/designsystemet-web
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`@digdir/designsystemet-css` and `@digdir/designsystemet-web` are peer dependencies. npm installs them automatically, but list them in your own `package.json` so that you control the version.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Load the files in this order, for example from your bundler's entry file:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import '@digdir/designsystemet-css';
|
|
26
|
+
import '@ngu-no/ngu-designsystem/tokens.css'; // NGU theme (--ds-*) + NGU tokens (--ngu-*)
|
|
27
|
+
import '@ngu-no/ngu-designsystem/styles.css'; // NGU component styles
|
|
28
|
+
import '@digdir/designsystemet-web'; // behaviour for Designsystemet components
|
|
29
|
+
import '@ngu-no/ngu-designsystem'; // registers the <ngu-*> elements
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then write plain HTML. No framework is needed:
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<button class="ds-button" data-variant="primary" type="button">Søk</button>
|
|
36
|
+
|
|
37
|
+
<a class="ds-card ngu-menu-card" href="/kart" data-variant="default" data-size="md">
|
|
38
|
+
<span class="ngu-menu-card__icon" aria-hidden="true"></span>
|
|
39
|
+
<span class="ds-paragraph ngu-menu-card__title" data-size="md" data-variant="short">Geologiske kart</span>
|
|
40
|
+
</a>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
NGU styles are in the CSS layer `ngu`, which comes after Designsystemet's `ds` layer, so NGU overrides win without `!important`.
|
|
44
|
+
|
|
45
|
+
### Font
|
|
46
|
+
|
|
47
|
+
Like Designsystemet, the package does not include a font. The theme uses [Inter](https://rsms.me/inter/), which you load yourself. The simplest option is the Altinn CDN, as recommended on [designsystemet.no](https://designsystemet.no/no/fundamentals/theme/typography#font-family):
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<link
|
|
51
|
+
rel="stylesheet"
|
|
52
|
+
href="https://altinncdn.no/fonts/inter/v4.1/inter.css"
|
|
53
|
+
integrity="sha384-OcHzc/By/OPw9uJREawUCjP2inbOGKtKb4A/I2iXxmknUfog2H8Adx71tWVZRscD"
|
|
54
|
+
crossorigin="anonymous"
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If you can't use an external CDN, host Inter yourself, for example with [`@fontsource-variable/inter`](https://www.npmjs.com/package/@fontsource-variable/inter).
|
|
59
|
+
|
|
60
|
+
### Light and dark mode
|
|
61
|
+
|
|
62
|
+
The theme supports both. Set `data-color-scheme="light"`, `"dark"` or `"auto"` on `<html>` or on any element.
|
|
63
|
+
|
|
64
|
+
## Package contents
|
|
65
|
+
|
|
66
|
+
| Import path | Contents |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `@ngu-no/ngu-designsystem` | JavaScript that registers the `<ngu-*>` custom elements |
|
|
69
|
+
| `@ngu-no/ngu-designsystem/tokens.css` | `theme.css` + `extensions.css` |
|
|
70
|
+
| `@ngu-no/ngu-designsystem/theme.css` | NGU theme for Designsystemet (`--ds-*`) |
|
|
71
|
+
| `@ngu-no/ngu-designsystem/extensions.css` | NGU-only tokens (`--ngu-*`) |
|
|
72
|
+
| `@ngu-no/ngu-designsystem/styles.css` | Styles for all NGU components |
|
|
73
|
+
|
|
74
|
+
## NGU components
|
|
75
|
+
|
|
76
|
+
| Component | Markup | Needs JavaScript |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| Hero | `.ngu-hero` on `.ds-card` | No |
|
|
79
|
+
| MenuCard | `.ngu-menu-card` on `<a class="ds-card">` | No |
|
|
80
|
+
| EmployeeCard | `.ngu-employee-card` on `.ds-card` | No |
|
|
81
|
+
| MapCard | `<ngu-map-card class="ds-card">` | Yes |
|
|
82
|
+
| MapDetails | `<ngu-map-details>` around `.ds-details` | Yes |
|
|
83
|
+
| AnchorNav | `<ngu-anchor-nav>` | Yes |
|
|
84
|
+
|
|
85
|
+
The full markup, variants and usage guidelines for each component are in the project's Storybook (Components → NGU). Documentation for Designsystemet's components is on [designsystemet.no](https://designsystemet.no/no/components).
|
|
86
|
+
|
|
87
|
+
## Versioning
|
|
88
|
+
|
|
89
|
+
The package follows [Semantic Versioning](https://semver.org/). Changes are listed in [CHANGELOG.md](https://github.com/ngu/ngu-designsystem/blob/main/CHANGELOG.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngu-no/ngu-designsystem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "NGU design system: theme tokens (--ds-*, --ngu-*) and NGU components, built on Designsystemet",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
|
-
"import": "./dist/index.js"
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"default": "./dist/index.js"
|
|
23
24
|
},
|
|
24
25
|
"./styles.css": "./dist/styles/index.css",
|
|
25
26
|
"./tokens.css": "./dist/tokens/index.css",
|